struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Cronemeyer <j...@ink.org>
Subject Re: Tiles - getting parent attribute?
Date Tue, 11 May 2004 13:42:27 GMT
On Mon, 2004-05-10 at 16:40, John Moore wrote:

IN the meantime I've got around it with what I regard as a kludge, but
I'll be getting back to the point again in a couple of days.


A kludge eh?  Well, I've got one for you.  Perhaps we can compare
kludges to see who has the ugliest one.  I have wanted to do something
similar to what you are talking about, and here is how I did it.


<!--==========================Layout.jsp=======================-->
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

<c:set var="actionDescription" scope="page"><tiles:getAsString
name="actionDescriptor"/></c:set>

<!--The above allowed me to use some logic tags to display options to
the user depending on the value of actionDescription.  

In your case you probably just need to set a session variable equal to
the current page value.-->
<!--============================================================-->

I used this devious little tag: <c:set>.  It allows you to store as a
variable the evaluated result of another tag.  For page scoped kludging
this is an ok solution.  However, you can take it too far.  I think the
line should be drawn at session scoping such things in struts. I
remember, with no little embarassment, setting a session variable in my
JSP one day.  That particular day turned into a stinking mess because I
ended up re-doing that piece of my application.  Such JSP tricks might
save lots of redundancy in your Struts-Config and Action Classes, but
they make the general flow of the code more obscure, and I'll take
clarity over compactness any day.

-josh


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


Mime
View raw message