Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > problems with request.getparameter

Reply
Thread Tools

problems with request.getparameter

 
 
Rosebud
Guest
Posts: n/a
 
      04-18-2004
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.
 
Reply With Quote
 
 
 
 
Peter Kirk
Guest
Posts: n/a
 
      04-19-2004
"Rosebud" <> skrev i en meddelelse
news: om...
> 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

 
Reply With Quote
 
 
 
 
Rosebud
Guest
Posts: n/a
 
      04-21-2004
"Peter Kirk" <peter> wrote in message news:<40839c28$>...
> "Rosebud" <> skrev i en meddelelse
> news: om...
> > 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


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
 
Reply With Quote
 
Chris Smith
Guest
Posts: n/a
 
      04-21-2004
Rosebud wrote:
> here are some examples:
> <html>
> <head>
> <title>Passing title: <%request.getParameter ("id")%>
> </title>
> </head>
> </html>


That should be <%= ... %>.

> 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
 
Reply With Quote
 
Peter Kirk
Guest
Posts: n/a
 
      04-22-2004

"Rosebud" <> skrev i en meddelelse
news: om...
> "Peter Kirk" <peter> wrote in message news:<40839c28$>...
> > "Rosebud" <> skrev i en meddelelse

> 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>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving the web, charset problems and symbols problems Sak Na rede Ruby 0 01-30-2009 05:05 AM
Problems, problems for newbie Shelly ASP .Net 1 09-03-2007 02:10 AM
Problems compiling simple C++ code (also problems with std::string) Susan Baker C++ 2 06-26-2005 01:43 AM
Re: sound problems and modem problems Harold Potter Computer Support 5 12-04-2003 04:12 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57