> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] Behalf Of Chuck Chopp
> Sent: Thursday, September 02, 2004 12:21 PM
> To: [EMAIL PROTECTED]
> Subject: forwarding to an action w/o an input JSP
> 
> 
> I'm looking for some good solid examples that show how to 
> configure the JSP 
> files, struts-config.xml [global forwards, action mappings, 
> form beans] and 
> action classes where a JSP may forward/redirect to an action 
> [may end up 
> being a chain of actions] before another JSP is finally 
> displayed.  The 2 
> books that I've been using for learning Struts are "The 
> Struts Framework: A 
> Practical Guide for Java Programmers" by Sue Spielman and 
> "Programming 
> Jakarta Struts" by Chuck Cavaness.  Both of these books seem 
> to be lacking 
> solid explanations & examples of the the full range of 
> configurations for 
> forwards & actions.  I keep getting the feeling that if I 
> could see one good 
> comprehensive working example everything would be clear to me 
> about how this 
> is supposed to work.

There are several excellent example apps on sourceforge, as well as on the links page 
of the basic struts documentation at struts.jakarta.apache.org

> 
> I have a welcome file named "index.jsp".  I'm questioning if 
> it should be 
> forwarding to the JSP file "login.jsp" [which I want to 
> protect from direct 
> access from the browser] or should it be forwarding to the 
> action named 
> "login" [or would it be "login.do"]?  The action named 
> "login" expects to 
> use "login.jsp" as its input, and I'm just not certain now whether 
> forwarding to a JSP will invoke the action or if forwarding 
> to the action 
> will cause its input form to be displayed.

index.jsp shouldn't forward anywhere.  Redirect maybe... post maybe... but not forward.
Contemplate the definition of forward for wisdom.  It's a tricky little bugger.

> Also, in my web.xml file, I have a url-pattern of "*.do" set in my 
> servlet-mapping.  What I'm not clear on is how/why URLs 
> appear back in the 
> browser such as "login.do" and "success.do" when the global 
> forwards that my 
> actions are using are called by their configured names of "login" and 
> "success".  I'm concerned about the browser backward/forward 
> buttons and the 
> reload button being clicked & what this might do to 
> navigation within my webapp.

Struts knows that actions need to have the appropriate url pattern, and is capable of 
applying that pattern.

Back, next and reload will do to a struts app what they do with any other app:  Allow 
the user to break your application in new and interesting ways.

--Jim Barrows

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to