You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Andrey Botalov <bo...@gmail.com> on 2012/08/20 20:05:08 UTC
How to get request attribute shown in JSP when using Apache Tiles?
I use Apache Tiles 3.
In servlet I do:
request.setAttribute("field-message", "Message");
Then request is forwarded to /WEB-INF/pages/something.jsp:
<tiles:insertDefinition name="something" />
In tiles.xml I have:
<definition name="something" template="/WEB-INF/layouts/default.jsp">
<put-attribute name="main-content"
value="/WEB-INF/tiles/something.jsp" />
</definition>
In /WEB-INF/tiles/something.jsp I have:
<p>${field-message}</p>
And I see 0 instead of "Message" in result HTML file.
What should I do to get "Message" shown there?
Re: How to get request attribute shown in JSP when using Apache Tiles?
Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.
An idea : perhaps it has nothing to do with Tiles, but with EL. Try to
change your variable name with "fieldMessage" instead of
"field-message". I think the EL translation is the substraction of two
unknown values, "field" and "message", that results "zero"...
I hope this helps.
Regards.
Ephemeris Lappis
Le 20/08/2012 20:05, Andrey Botalov a écrit :
> I use Apache Tiles 3.
> In servlet I do:
>
> request.setAttribute("field-message", "Message");
>
> Then request is forwarded to /WEB-INF/pages/something.jsp:
>
> <tiles:insertDefinition name="something" />
>
> In tiles.xml I have:
>
> <definition name="something" template="/WEB-INF/layouts/default.jsp">
> <put-attribute name="main-content"
> value="/WEB-INF/tiles/something.jsp" />
> </definition>
>
> In /WEB-INF/tiles/something.jsp I have:
>
> <p>${field-message}</p>
>
> And I see 0 instead of "Message" in result HTML file.
>
> What should I do to get "Message" shown there?
>
Re: How to get request attribute shown in JSP when using Apache Tiles?
Posted by Nicolas LE BAS <ma...@nlebas.net>.
Tiles has nothing to do with it, this a pure JSP issue.
On 12-08-20 02:05 PM, Andrey Botalov wrote:
> <p>${field-message}</p>
This is the difference between two attributes: "field" and "message".
Both are nulls, so the difference is zero...
Either you choose another name for your attribute, or you use the
construct <p>${requestScope['field-message']}</p>
Hope this helps,
Nick