"Craig R. McClanahan" wrote:

> Arun Thomas wrote:
>
> > Karl,
> >
> > You were answering another question at the time, but your note inspires me
> > to ask....
> > You've noted that if a form has no action statement, then it automatically
> > submits
> > back to itself.
> >
>
> One thing to note on this topic -- the ACTION attribute is not required in the HTML
> 3.2 DTD, but it is marked required in the HTML 4.0 DTD.

(oops) in that case you can always make the action point to
 <FORM METHOD="POST" ACTION="<%=
response.encodeURL(HttpUtils.getRequestURL(request).toString()) %>" >
</FORM>


>
>
> >
> > First, I assume that it actually automatically submits back to whatever URL
> > was used to
> > get the data in the first place.  If the data was obtained from a servlet
> > via a forward to
> > a jsp page, the submit would still send data to the servlet URL.  (Is this a
> > correct
> > assumption?)
> >
>
> If you submit to a servlet's URL, and then use RequestDispatcher.forward() to
> forward to a JSP page for display, the original URL (of the servlet) is still what
> the browser thinks it submitted to, and what shows on the Location bar.  Therefore,
> if a FORM element without an ACTION attribute really does submit to the originating
> URL (I have not tried it myself), then your assumption is correct.

I've tested it and it works.

>
>
> >
> > Do you know whether or not sessions can be maintained without an explicit
> > action statement
> > if URL rewriting is being used for this purpose?  (Cookies are disabled.)
> >
>
> It should probably work.  If you are using URL rewriting for session maintenance,
> then the URL of the servlet you are submitting to will already have the encoded
> session ID, so it should already be included on the resubmit.  But I have not tried
> any of this, so there may be something else going on.

Sessions can be maintained (I tested it) however if you put the action statement in
(as above) then it is prudent to put the encodeURL() bit in and sessions are also
maintained.

>
>
> >
> > Thanks,
> > -AMT
> >
>
> Craig McClanahan

Karl

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to