problems with request.getparameter

R

Rosebud

rosebud:
Hi, I am not sure if this is the right place to as jsp questions or
not.

But, I am having problem getting url parameters and need some
assistance. The followin code is a simple example of a getparmeter
request that is not working:

<html>
<head>
<title>AddressBook: Modifying Address <%= request.getParameter
("id")%>
</title>
</head>
</html>

I think there is a problem with initiating jsp because other calls do
not work either:

<html
<head>
<SCRIPT language="javascript">
</script>

</head>
<body>

Current time: <%= new java.util.Date() %>


</body>
</html>


Any help would be appreciated. I am able to use form/button calls
using: <SCRIPT id="clientEventHandlersJS" language="javascript">

I am a beginner with jsp. So, donot assume I know what you mean if
you submit partial coding.
 
P

Peter Kirk

Rosebud said:
rosebud:
But, I am having problem getting url parameters and need some
assistance. The followin code is a simple example of a getparmeter
request that is not working:

<html>
<head>
<title>AddressBook: Modifying Address <%= request.getParameter
("id")%>
</title>
</head>
</html>
I think there is a problem with initiating jsp because other calls do
not work either:

Do you get some sort of error message? What is it that doesn't work?
Remember that getParameter can return null if the parameter is not in the
request.
Is your file a "jsp" file?
Have you installed your jsp in an appropriate "jsp/servlet container/runner/
web server" ? (Eg. Tomcat). Are you calling it correctly?

Peter
 
R

Rosebud

Peter Kirk said:
Do you get some sort of error message? What is it that doesn't work?
Remember that getParameter can return null if the parameter is not in the
request.
Is your file a "jsp" file?
Have you installed your jsp in an appropriate "jsp/servlet container/runner/
web server" ? (Eg. Tomcat). Are you calling it correctly?

Peter

rosebud:
I am running the servlet on a server that is suppose to handle all
types of internet servelets. I am not the guy who does hosting.

The jsp is not part a jsp it is embeded in the html doc.

here are some examples:
<html>
<head>
<title>Passing title: <%request.getParameter ("id")%>
</title>
</head>
</html>


Where the url has www.?????.com?id=title name

another:
<html>
<head>
<title>Neighborhoods</title>
</head>
<body>
<!--#include file ="<%request.getParameter
("locale")%>Neighborhoods.htm" -->
</body>
</html>

or:
<html>
<head>
<title>Neighborhoods</title>
</head>
<body>
<!--#include file =<%request.getParameter
("locale")%>"Neighborhoods.htm" -->
</body>
</html>

where url has www.####.com?locale=saline
 
C

Chris Smith

Rosebud said:
here are some examples:
<html>
<head>
<title>Passing title: <%request.getParameter ("id")%>
</title>
</head>
</html>

That should be said:
another:
<html>
<head>
<title>Neighborhoods</title>
</head>
<body>
<!--#include file ="<%request.getParameter
("locale")%>Neighborhoods.htm" -->
</body>
</html>

Again, that should be <%= ... %>. Also, I don't know who you expect to
interpret the <!--#include ... --> statement. It's not valid JSP, and
the web browser won't do anything with it.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
P

Peter Kirk

Rosebud said:
I am running the servlet on a server that is suppose to handle all
types of internet servelets. I am not the guy who does hosting.

The jsp is not part a jsp it is embeded in the html doc.

I am not sure I follow you here. I am pretty sure your file has to have
"jsp" as its extension. Or if you are combining multiple files, then at
least the outer file has to be a jsp.

I any case, why don't you try to install Tomcat, and experiment for
yourself?

Here are two jsps, one which sends a request parameter to the other:

test.jsp:
<html>
<head>
<title>
A JSP TEst
</title>
</head>
<body>
Hello!<br>
<%= "Hello again" %> <br>
<a href="test_02.jsp?my_param=hi there">click here</a>
</body>
</html>

test_02.jsp:
<html>
<head>
<title>
A JSP TEst 02
</title>
</head>
<body>
Hello from JSP 02<br>
You sent: <%= request.getParameter( "my_param" ) %>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top