sending info from one jsp page to another...

G

graniteraju

i have 2 html pages as below:

page1.html:


<html><head>
<title>page1</title>
</head>
<body>
<table>
<tr><td>
Do you have cars?
<input type="radio" name="havecars" value="yes">yes
<input type="radio" name="havecars" value="no">no
</td></tr>
<tr>
<td>No:eek:f cars
<select name="cars">
<option>1</option>
<option>2</option>
<option>3</option>
</select></td></tr>
<tr><td>
<input type="button" value="next">
</td></tr>
</table>
</body></html>


page2.html


<html><head><title>page 2</title></head>
<table><tr><td>
have cars?
<input type="radio" name="havecars" value="yes">yes
<input type="radio" name="havecars" value="no">no
</td></tr>
<tr><td>
no:eek:f cars
<input type="text">
</td></tr>
</table>
</html>


when I enter the values for the fields in page1 and click next I should

go to page2, which should already have its fields populated depending
on the values in page1...
Using JSP and servlets how do I do that?


thanks,
 
J

John O'Conner

when I enter the values for the fields in page1 and click next I should

go to page2, which should already have its fields populated depending
on the values in page1...
Using JSP and servlets how do I do that?


thanks,


page1's "next" button should submit its contents (use a form) to a
servlet. That servlet will process the page1 form data and will then
forward to a page2.jsp. page2.jsp will populate the fields as you
require, and generate the page2.html that you need.

Use Google to search on things like "html+form", "html submit",
etc...that will get you started:
1. submit the form data
2. process it at the server
3. send it back via a jsp page

Solve each step in order.

Regards,
John O'Conner
 
H

Hal Rosser

i have 2 html pages as below:

page1.html:


<html><head>
<title>page1</title>
</head>
<body>
<table>
<tr><td>
Do you have cars?
<input type="radio" name="havecars" value="yes">yes
<input type="radio" name="havecars" value="no">no
</td></tr>
<tr>
<td>No:eek:f cars
<select name="cars">
<option>1</option>
<option>2</option>
<option>3</option>
</select></td></tr>
<tr><td>
<input type="button" value="next">
</td></tr>
</table>
</body></html>


page2.html


<html><head><title>page 2</title></head>
<table><tr><td>
have cars?
<input type="radio" name="havecars" value="yes">yes
<input type="radio" name="havecars" value="no">no
</td></tr>
<tr><td>
no:eek:f cars
<input type="text">
</td></tr>
</table>
</html>


when I enter the values for the fields in page1 and click next I should

go to page2, which should already have its fields populated depending
on the values in page1...
Using JSP and servlets how do I do that?

You have input tags - but they are not inside a form tag.
The form tag determines where to send the data when the user clicks the
submit button.
Take a look at http://www.w3schools.com
where you'll see some html tutorials to get you up to speed on the html code
for submitting data to a jsp (or asp, or cgi, or php ...) page.
 

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

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top