tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerry Thomas" <>
Subject Re: Passing parameters to a bean from a JSP
Date Wed, 05 Apr 2000 09:46:14 GMT
The responses that I have received on this subject have made it clear that I 
have not stated my problem as clear as I should have. Let me try again...

I do understand how to pull values from a request object once an HTML page 
has been submitted. What I am trying to do on my current JSP is pull data 
'on the fly' to send to my bean. The current exercise is to create two 
"SELECT" type objects on my FORM. The first SELECT object is populated with 
the states of the United States. The second SELECT object is left blank 
until the user selects a state from the first SELECT object. I would then 
like to dynamically enter all of the counties for the selected state into 
the 2nd SELECT object. Currently I have most of this working. The JSP draws 
an HTML FORM, calls a JavaScript function that uses the JSP Java bean to 
connect to my database and return a Vector object containing all of the 
states, using JavaScript I populate the SELECT object and then wait for user 
input. JavaScript detects the 'onChange' event associated with the SELECT 
object containing the states and passes an Object containing the SELECT 
object to another JavaScript function that pulls out the selected state as 
selected by the user. So far so good. Here comes my problem...
I would like to pass the selected state back to my JSP Java bean to retrieve 
a Vector containing the counties for the selected state. I can in fact hard 
code a string that is passed back and retrieve the Vector of counties. What 
I cannot figure out how to do is to pass text obtained from my HTML FORM 
(like a state selected from the SELECT object)as a parameter to my Java 
Is there a way to use scriptlets in a JSP to move data from variables 
obtained from HTML (using JavaScript or otherwise) into a Java variable or 
parameter list?

>From: Russell Hammer <>
>Reply-To: Russell Hammer <>
>Subject: Re: Passing parameters to a bean from a JSP
>Date: Tue, 4 Apr 2000 09:56:52 -0400 (EDT)
> > This HTML:
> >
> > <HTML>
> > <HEAD><TITLE>Example</TITLE></HEAD>
> > <BODY>
> > <H1>Your Name:</H1>
> > <FORM TYPE=POST ACTION=hello.jsp>
> > </FORM>
> > </BODY>
> > </HTML>
> >
> > With this hello.jsp:
> >
> > <HTML>
> > <HEAD><TITLE>Example</TITLE></HEAD>
> > <BODY>
> > <H1>Hello <% =request.getParameter("YOURNAME") %></H1>
>Shouldn't this be
>   <H1>Hello <%= request.getParameter("YOURNAME") %></H1>
> > </BODY>
> > </HTML>
> >
> > Should work. You can also check some of the examples at
> > /path/to/tomcat/webapps/examples/jsp.
> >
> > Can you post come of your HTTML/Javascript and your JSP?.
>To unsubscribe, email:
>For additional commmands, email:

Get Your Private, Free Email at

View raw message