This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes WAS 5 logout page using tiles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "WAS 5 logout page using tiles" Watch "WAS 5 logout page using tiles" New topic
Author

WAS 5 logout page using tiles

Jason Berk
Ranch Hand

Joined: May 03, 2006
Posts: 41
my shop uses WAS5 currently and I have struts + tiles running as desired. I have a tile named "logout" that has the magical IBM logout form:

<form method="post" action="ibm_security_logout" name="logout">
<input type="submit" name="logout" value="Logout">
<input type="hidden" name="logoutExitPage" value="<%=logoutURL%>">
</form>

I would like the logoutURL I specify to use tiles like all the other pages...is that possible? The form isn't processed by struts, so how do I set this up?

Jason
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Since the logout page isn't displayed directy by Struts, you can't use a tile definition directly. However, I'd try specifying a Struts action as my logout exit page, and then have that action forward to the tile you want.

example:

<input type="hidden" name="logoutExitPage" value="logout.do" >


Merrill
Consultant, Sima Solutions
Jason Berk
Ranch Hand

Joined: May 03, 2006
Posts: 41
Merrill,

funny, that's exactly what I did and it worked just fine. Now however, my group and I have decided to go a different direction. Instead of each WAR we create having to have all the images/stylesheets/javascripts/shared JSPs we created a SharedContent WAR that is struts enabled. The only action is a forward like so:

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

in the webcontent area there is a logout.jsp with a logic:redirect to "logout.do"

The idea is that all future WARs will be built from a "BaseWAR" so that all WARs have a similar design.

in each WAR this IBM magical logout form will be provided and won't need to be changed:

<form method="post" action="ibm_security_logout" name="logout">
<input type="submit" name="logout" value="Logout">
<input type="hidden" name="logoutExitPage"
value="<SharedContent:path />/logout.jsp">
</form>

I created a custome tag SharedContent that ends up producing this:
https://some.server.com/context/root/SharedContent

(This also allows me to do:
<img src="<SharedContent:path />/images/my_image.jpg">)

problem is struts seems to be doing something to the URL. When I click the logout button, I get a 404 and the URL reads:

https://my.server.com/context/root/MyApp/context/root/SharedContent

is this a situation where I should have the logout form point to an action declared in the local struts config file which then redirects to a JSP in a completely different WAR?

curious,

Jason
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Jason,

I suspect it may not be Struts, but IBM that is modifying the URL. I don't know what the rules are for this "magical logout form", but I suspect that one of them may be that the URL of the page must be in the same web application.

I like your idea of calling a Struts action in the same application that forwards to a page in the common application. In this forward, make sure you specify redirect="true". Unless you do so, you won't be able to forward to a page outside the application.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WAS 5 logout page using tiles