Believe me there are many ways to do it and I am not the best but I like to
treat any JSP defined in the tiles def xml and any JSPs that are like
templates as in classic_layout.jsp which assembles all of the other JSPs as
the equivalent of an abstract class and I don't forward to any of those. I
will extend (in the tiles def xml file) the doc.classicLayout, which uses
classic_layout.jsp to assemble the look of the page, and those extended defs
are what I forward to.  So Tiles is doing all my assembly.

"doc.umHome" extends doc.classicLayout and then I forward to doc.umHome if
that is where I want to go.

In posts from yesterday or the day before I posted exactly how I do it for a
concrete example.

-----Original Message-----
From: Davidson, Glenn [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 04, 2003 4:48 PM
To: 'Struts Users Mailing List'
Subject: RE: Newbie Question: Tiles and html:link how to make it work.

Shane,
You have been most helpful and correct. Please bear with me for one more
moment. When I do my links I link to a forward and not directly to a JSP. I
agree that the best way to handle the "is logged in" question is by sub
classing the ActionServlet (Ted Husted's Book has a nice example of this).
What I have working is this:

I create a link to a forward, the forward is mapped to a JSP, within the JSP
is a tiles include definition. If I have an action the forward of the action
mapping is taking the tiles definition and working correctly. Is this the
correct way of handling this?

Thanks

Glenn

-----Original Message-----
From: Bailey, Shane C. [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 3:19 PM
To: 'Struts Users Mailing List'
Subject: RE: Newbie Question: Tiles and html:link how to make it work.



Like I said. Don't link to any JSPs from a JSP.  So you need to look into
things a little more or you will have problems in the long run.  If you
really don't need to do any type of preparation for the display of a JSP
(i.e. nothing put in the request,session,etc. for the JSP to pull out) then
use:
    <action    path="/home"
            parameter="doc.welcome"
            type="org.apache.struts.action.ForwardAction" 
            scope="request">
    </action>

Most of the time you will want to go to a real action and do something.
Especially a check for login (already authenticated).  You shouldn't do it
in every JSP (that's what it sounds like you are doing).  I suggest to
subclass the ActionServlet to do a login check.

I hope this helps but you really should learn more before doing your
implementation of struts.

I feel I have the basics of struts decently but learn something all the time
on this forum.



-----Original Message-----
From: Davidson, Glenn [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 04, 2003 2:45 PM
To: 'Struts Users Mailing List'
Subject: RE: Newbie Question: Tiles and html:link how to make it work.

Thanks for the quick response!!!!!

Lets say I have a "menu item" that I want to use to call another jsp page.
This new jsp page is defined as a new tile. 

More detail:

Lets say I have a welcome page (which is defined in tiles-defs.xml). In the
header.jsp I look to see if the user is logged in. If they are logged in I
display a greeting in the header. If they are not logged in I print "Please
logon" in the menu.jsp and I when they click on that I would like to jump to
the logon page which is defined in the tiles-defs.xml. The logon page has a
different menu.jsp and body.jsp defined. 

Thanks

Glenn 

-----Original Message-----
From: Bailey, Shane C. [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 2:25 PM
To: 'Struts Users Mailing List'
Subject: RE: Newbie Question: Tiles and html:link how to make it work.



Your forward path can be a Tiles Def in the struts-config. You don't want to
ever link directly to a Def (or JSP) so it sounds like you are fine.  Need
more detail otherwise.


-----Original Message-----
From: Davidson, Glenn [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 04, 2003 2:22 PM
To: 'Struts Users Mailing List'
Subject: Newbie Question: Tiles and html:link how to make it work.

I am new to Struts and Tiles and am trying to make it work. I have written a
simple web site that uses the <html:link forward="some forward name" ... and
this works well.  The "some forward name" is currently defined in the
<global forwards> section of the struts-config.xml I have looked at the
documentation on line and it is a little shy on this. I also have Ted
Husted's book which is really great but I am still having a problem. Can
anyone get me some guidance here? 

Thanks

Glenn Davidson

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

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

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

Reply via email to