Grabbing SiteMesh attributes using useBean

View: New views
2 Messages — Rating Filter:   Alert me  

Grabbing SiteMesh attributes using useBean

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If I don't want to use SiteMesh's JSP tags, is it possible to use <jsp:useBean> to get a page's elements in my decorator? The code below doesn't work:

<jsp:useBean id="html" type="com.opensymphony.module.sitemesh.HTMLPage" scope="request"/>

<jsp:getProperty name="html" property="title"/>

However, this code does:

<%@ page import = "com.opensymphony.module.sitemesh.HTMLPage" %>
<%
    HTMLPage html = (HTMLPage) request.getAttribute("__sitemesh__page");
    System.out.println("html.title: " + html.getTitle());
%>

Thanks,

Matt

Re: Grabbing SiteMesh attributes using useBean

by Torgeir Veimo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 12 Oct 2008, at 00:47, Matt Raible wrote:

> If I don't want to use SiteMesh's JSP tags, is it possible to use  
> <jsp:useBean> to get a page's elements in my decorator? The code  
> below doesn't work:
> [..]
> However, this code does:
>
> <%@ page import = "com.opensymphony.module.sitemesh.HTMLPage" %>
> <%
>     HTMLPage html = (HTMLPage)  
> request.getAttribute("__sitemesh__page");
>     System.out.println("html.title: " + html.getTitle());
> %>


Maybe try ${requestScope['__sitemesh__page'].title} ?

--
Torgeir Veimo
torgeir@...





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...