Anders,

Might I just say that you can do it 'cleaner' using SiteMesh properly :)

> some-page.jsp
> <%
>   request.setAttribute("current_view_name", "some-page");
> %>
> <html>
>   <yadda yadda />
> </html>

becomes:

> some-page.jsp
> <html>
>   <meta name="view_name" content="some-page">
>   <yadda yadda />
> </html>

And the decorator becomes:

Can just use <decorator:getProperty name="meta.view_name"> and
<decorator:isPropertySet name="meta.view_name"> to govern it's logic?

Using HTML META tags is a lot nicer for HTML guys!

Cheers,
Mike

On 13/6/03 12:13 AM, "Anders Engström" ([EMAIL PROTECTED]) penned the
words:

> On Wed, Jun 11, 2003 at 10:48:24PM -0400, Ken Yee wrote:
>> 
>> Mike Cannon-Brookes wrote:
>>> Well, I use JSP conditional tags in my SiteMesh decorators
>>> to do this personally? :)
>> 
>> I didn't see any special WW:ui tag that would make it obvious to
>> use WW either :-P
>> 
>> Could you post an example of what you do w/ JSP conditional tags?
>> Maybe it would be a good addition to WW's UI tags to encapsulate
>> something like this...
>> 
>> 
> 
> Not really related to WW in any way, but the way I do it is by setting a
> request attribute from the "body" JSP, and then use that attribute from
> the "menu" JSP:
> 
> decorator.jsp:
> 
> <table>
> <tr>
>   <td><%@ include file="../includes/menu.jsp"%></td>
>   <td><decorator:body/></td>
> </tr>
> </table>
> 
> some-page.jsp
> <%
>   request.setAttribute("current_view_name", "some-page");
> %>
> <html>
>   <yadda yadda />
> </html>
> 
> some-other-page.jsp
> <%
>   request.setAttribute("current_view_name", "some-other-page");
> %>
> <html>
>   <yadda again />
> </html>
> 
> menu.jsp
> <%!
>   String buildLink(HttpServletRequest req, String name, String url,
>   String viewName)
>   {
>     boolean isCurrentPage =
>     viewName.equals((String)req.getAttribute("current_view_name"));
>     StringBuffer buff = new StringBuffer();
>     if( !isCurrentPage ){
>       buff.append("<a href=\"").append(url).append("\">");
>     }
>     buff.append(name);
>     if( !isCurrentPage ){
>       buff.append("</a>");
>     }
> 
>     return buff.toString();
>   }
> %>
> 
> <ul>
>   <li>
>   <%=buildLink(request, "SomePage", "some.action", "some-page"%>
>   </li>
> 
>   <li>
>   <%=buildLink(request, "SomeOtherPage", "someother.action",
>   "some-other-page)%>
>   </li>
> </ul>
> 
> 
> The "strategy" can very likely be better encapsulated in custom taglibs
> or ww-actions, but IMO it's not something that WW should provide.
> 
> //Anders



-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to