|
-
Jan 3rd, 2002, 03:18 AM
#1
Thread Starter
Junior Member
JSP Problem
HI I have a problem I don't think it's a big one but I'm rather new to JSP.
Here goes.
For a webpage I'll be coding on there is more than one button, I need to determine which button was pressed store it in a session and go to the nest page(the buttons will be image buttons). I've tried a lot but my problem mostly is that the value of the last button gets storedin the session and not that of the button pressed, each button is on it's own form if U need any info more let me know
Thanx
Time Waits for no-one, no matter how important you think you are.
-
Jan 14th, 2002, 08:42 AM
#2
Member
Hi,
You appear to have several different problems.
All objects stored in the session are stored by key. If the key already exists, the data that was present in the session will be replaced by the new object. That may explain why the last buttons keeps ending up in the session.
But, why keep track of buttons in the session? You can get them returned in the HTTP request from the user!
Here's an example (on the fly, I haven't tested this):
<% boolean button1Pressed = request.getParameter("Button1") != null;
boolean button2Pressed = request.getParameter("Button2") != null;
%>
<HTML>
<HEAD></HEAD>
<BODY>
<FORM NAME="Form1">
<BUTTON TYPE="Submit" NAME="Button1" value="Button 1">
<BUTTON TYPE="Submit" NAME="Button2" value="Button 2">
</FORM>
</BODY>
</HTML>
With a submit, the form data is reposted to your JSP.
And you can have a form post to anywhere you want, using:
<FORM ACTION="http://myNewURL">
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|