First, you do not need to use request.getSession(false); in your code. The
JSP engine will automatically add a request.getSession(true) in the
converted java code it produces, unless you add: <%@ page session="false" %>
at the top of your page. Furthermore, you have access to a number of
variables automatically in JSP. You don't need to get a session from the
request. You can use the "session" variable directly in JSP, as well as
request, response, page, application and so on.

As for submitting two forms at one time..as far as I know you can't do this.
Once you submit one, the browser is already gone off the page. What I
suggest is you look into using a MVC framework like Struts or Theseus. You
would then submit one form and in the method handle both capabilities in
whatever manner necessary. It seems quite odd to me why you would need to
submit two forms at one time, except in on particular case. I worked on a
project where we divided up as creen into 3 frames to emulate what a
client-side application can do. In the top frame we wanted the menus and a
simple status. In the second frame it was a big worksheet, and in the 3rd
frame, it was a section of totals. Now, when they edited the middle-frame
worksheet, we wanted the totals to be in real-time, so the natural thing was
using javascript. But, working in a browser window severely limits your
ability to see stuff, so we decided that when they changed something that
required a set of totals, it would submit the form to the server, calculate
the totals, then come back. The problem..how do we submit the middle form so
that it recalculates the bottom page properly. Worse..if we submitted BOTH
forms, there was no guarantee that the bottom form would arrive AFTER the
middle-form and thus be able to use any modifications the middle-form had
done in it to get accurate totals. On top of that, if they changed the
status in the top frame, it had to update ALL 3 frames, and again it was
impossible to control the firing sequence to time the forms. There was one
trick we could do..but it would require a lot of extra coding. In each
<body> tag of each frame, we could call an onLoad="" call to a javascript
function that would then try to time the sequence of each frame being
submitted. For example, if they submitted the middle-frame, when the
resposne came back, the <body onLoad=""> would then submit the bottom frame
to update the totals. This could all work, but the problem you have with
this now is that the first time the page is displayed it would try to submit
the bottom frame, and we had the same code in the top frame as well..which
when updated would submit the middle frame, which would then submit the
bottom frame. It got quite complex. I think its doable, but we ended up
scrapping the project before we had to figure all that out.

In your case, it sounds like your talking about two forms in one frame. What
I am not clear about is if the one form must be excuted and completed beore
the other form can be submitted. If this is the case, the only way you can
do this is use two frames, and in the onLoad tag of the first frame that
first form is in that must be completed first, have it submit the second
frame. Again..you'll have to set some sort of flag in you server-side
indicating that the onLoad SHOULD be called or not. If the page is first
displayed, often you don't want to submit the second form..it may cuase
NPE's and what not if data from the first form doing its thing is NOT
present yet (because the first form is just displayed and hasn't been
submitted yet).

If you can elaboarte more on why you feel you must submit two forms from one
page at the same time (or one after the other), and can't combine it into a
single form, that would be helpful.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to