<A HREF="http://www.mmorpgforums.com" TARGET=_blank rel="nofollow">An Online community for Online RPGs!</A>
Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
In a time of drastic change it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists.<br />Eric Hoffer
Originally posted by Tony Alicea:
I don't understand the question but I'll pretend that I do
A form is submitted to a JSP like this:
<FORM ACTION="myJSP.jsp" METHOD="post">
<INPUT TYPE="Text" NAME="username">
<INPUT TYPE="Submit">
</FORM>
I personally don't like the idea of FORMs submitting to JSPs directly but instead I prefer that an ACTION in a FORM points to a ([b]controller) Servlet. And then this servlet would forward to a JSP (view).[/B]
What is a "jsp pass to jsp"
This is not a sports forum!
I personally don't like the idea of FORMs submitting to JSPs directly but instead I prefer that an ACTION in a FORM points to a (controller) Servlet. And then this servlet would forward to a JSP (view).
If you want to use the same jsp for the form and also for the form processing you can do something like:
let's say you specified POST in your action, then you would say...
if(request.getMethod().equals("POST") {
// do all your processing here provided you have initialised some global variables at the top
do validation
insert into db or some other stuff
} // end main processing
I use this technique a lot because I normally just want one file instead of two say for login.
One last thing: in this case the you set the action to the name of this jsp since it is also being used for processing its own form!!
<A HREF="http://www.mmorpgforums.com" TARGET=_blank rel="nofollow">An Online community for Online RPGs!</A>
<A HREF="http://www.mmorpgforums.com" TARGET=_blank rel="nofollow">An Online community for Online RPGs!</A>
In a time of drastic change it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists.<br />Eric Hoffer
<A HREF="http://www.mmorpgforums.com" TARGET=_blank rel="nofollow">An Online community for Online RPGs!</A>
Hug your destiny! And hug this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|