struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: How to glue struts to JSPs
Date Thu, 05 Apr 2007 12:48:27 GMT
--- "Kraft, Daniel" wrote:
> I'm new to struts and just worked through the user's
> guide.  However, for me it was not clarified there
> how to connect the "View" component to a given JSP
> page or, in general, how to manage it to make a
> given JSP be displayed for the View-part of a
> struts-request.

Struts 1 or 2? Sounds like 1, but...

http://www.google.com/search?q=struts+%2Btutorial

If S1:

In a nutshell, an Action class returns a forward which
defines the JSP page (or tile, etc.)

<action path="/displaySomething"
        type="plugh.DisplaySomethingAction">
  <forward name="success" 
           path="/WEB-INF/jsp/displaySomething.jsp"/>
</action>

and in the Action class:

return mapping.findForward("success");

So you visit /displaySomething.do, the Action sets up
stuff for the presentation (JSP in this case) and
returns the appropriate forward (you could forward to,
say, a different JSP on error).

If the page doesn't need anything set up then you can
just do:

<action path="/displaySomething"
        forward="/WEB-INF/jsp/displaySomething.jsp"/>

(depending on which version of S2 you're using).

If it's S2 then it's totally different; someone else
or I will follow up if that's the case, but the S2
bootstrap tutorial pretty much sums it up.

d.



 
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message