Thanks.

The problem is there'are too many struts experts and best practices. For a beginner like me, it's really hard to follow.

At least, the bottom line is tiles can not work with logic:forward and logic:redirect.

Someone should put the words in struts website. Then, beginners do not need to waste time and try to debug.

From: "David Graham" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: RE: tiles and logic:forward
Date: Tue, 11 Mar 2003 12:48:37 -0700

You really shouldn't be using the forward or redirect tags anyways. I consider that business logic that belongs in java classes. A checklogin tag is also not a good idea because then you have to remember to place it in every page. The authentication code should be in a Filter or Action.

David



From: "Laker Shen" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: RE: tiles and logic:forward
Date: Tue, 11 Mar 2003 19:44:00 +0000

Understand. I think that's the case. Thanks.

But, still, it may cause a lot of extra troubles. I may need to create an extra action to handle those forward logic.

In Ted's Blueprinting Struts, he suggested to create a CheckLogin custom tag. To use tiles with the tag, either the check login logic is very simple and we can put the tag in the layout.jsp or the check login tag needs to be very smart and handle all the logic based on dynamic user information.

Still try to find a way around this.

From: "Zheng, Gang" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
Subject: RE: tiles and logic:forward
Date: Tue, 11 Mar 2003 14:43:01 -0500

I did not look at struts source code, but I guess the underlying
implementation of <logic:forward> is by using
javax.servlet.RequestDispatcher forward method. And <logic:redirect> is by
using sendRedirect.


In either case, as indicated by the Java documentation, the forward or
redirect will fail once you have already commit the output to HTTP response.
I think this is HTTP and servlet nature, rather than a tile issue.


IMHO, tile enables you to assemble the web page by including the outcome of
all the content tiles. The login redirect/forward logic should be handled
outside of tile's scope.


- GZ


-----Original Message----- From: Laker Shen [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2003 2:14 PM To: [EMAIL PROTECTED] Subject: RE: tiles and logic:forward


Thanks.


However, if it is the case, tiles is really silly.

The forward logic should be inside each content tile. There's no way I can
move the logic into a jsp page before calling any tile, e.g. layout.jsp.


There should be a better way, otherwise, tiles is not useful at all.

>From: "Zheng, Gang" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
>Subject: RE: tiles and logic:forward
>Date: Tue, 11 Mar 2003 14:08:04 -0500
>
>You have to make sure the the "forward" or "redirect" happens before
>anything is written out to the HTTP response.
>
>One way is to invoke the <logic:forward name="logon"/> the first thing
>in your JSP page before you call any tiles.
>
>- GZ
>
>-----Original Message-----
>From: Laker Shen [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, March 11, 2003 1:50 PM
>To: [EMAIL PROTECTED]
>Subject: tiles and logic:forward
>
>
>I tried to migrate my struts project to use tiles. Hit some problems
>with forward.
>
>In a tile, I have:
>     <logic:notPresent scope="session" name="user">
>       <logic:forward name="logon"/>
>     </logic:notPresent>
>
>If the user is not logged on, he will be directed to the logon page. It
>works as a standalone jsp page. However, once I put it into a tile, it
>is not working. The following exception is thrown: [ServletException
>in:/docs/SubmitFile.jsp] Exception forwarding for name
>logon: java.lang.IllegalStateException: Cannot forward after response
>has been committed'
>
>Looks like the way tiles works is to put all the tile definition into
>one http response and write to the response even before the forward
>happens.
>
>I tried to use logic:redirect, no exception is thrown, but the user is
>not directed to the logon page.
>
>Can someone help? Thanks.
>
>
>_________________________________________________________________
>The new MSN 8: advanced junk mail protection and 2 months FREE*
>http://join.msn.com/?page=features/junkmail
>
>
>---------------------------------------------------------------------
>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]


_________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


--------------------------------------------------------------------- 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]


_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



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


_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



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


_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail



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



Reply via email to