You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Henrik Lindqvist <li...@hlindqvist.com> on 2003/07/03 18:35:46 UTC

tile attribute as message key?

Hi All,

Is there any easy way to use a tile definition attribute as 
an bean:message key?

Or do you have to useAttribute to declare a Java variable, 
and then <bean:message key="<%=key%>"/>

...very awkward.

/ h e n r i k


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


Re: tile attribute as message key?

Posted by Marc BEGUIGNEAU <ma...@yahoo.fr>.
Hi,

I use a similar method:

My solution is to put in the session a string who is
the message key and then in my jsp page i just display
this.

My code look like this:

In the action

------------------------------------------
String message = new String("input.sucess");
request.setAttribute("message", message);
------------------------------------------

then you forward to the appropriate jsp. In the jsp,
the code look like:

--------------------------------------------
<bean:define
		id="message"
		name="message"
		scope="request"
		toScope="page"
		type="java.lang.String" />

<h3><bean:message key='<%= message %>' /></h3>
-------------------------------------------

Now, tile take bean in the session scope too, i think
you can use the same method. If in you tiles-defs.xml
you have a think like this:

---------------------------------------------------
<definition name="menuacteur"
path="/include/layout.jsp">
        <put name="title"  value="Menu Acteur" />
        <put name="header" value=".mainMenu" />
        <put name="menu"   value=".menuActeur" />
        <put name="usermenu" value="/include/user.jsp"
/>
        <put name="footer" value="/include/footer.jsp"
/>
        <put name="body"   value="/pages/welcome.jsp"
/>
    </definition>
---------------------------------------------------

I think you can use the same solution I use. Except
the <bean:define/> is different:

--------------------------------------------
<bean:define
		id="message"
		name="title"
		scope="request"
		toScope="page"
		type="java.lang.String" />

<h3><bean:message key='<%= message %>' /></h3>
-------------------------------------------

Let my now i this work.

Regards

Marc BEGUIGNEAU


 --- Henrik Lindqvist <li...@hlindqvist.com> a écrit :
> 
> Hi All,
> 
> Is there any easy way to use a tile definition
> attribute as 
> an bean:message key?
> 
> Or do you have to useAttribute to declare a Java
> variable, 
> and then <bean:message key="<%=key%>"/>
> 
> ...very awkward.
> 
> / h e n r i k
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>  

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

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


Re: tile attribute as message key?

Posted by Sandeep Takhar <sa...@yahoo.com>.
tiles:importAttribute

with bean:message name=""

sandeep
--- Henrik Lindqvist <li...@hlindqvist.com> wrote:
> 
> Hi All,
> 
> Is there any easy way to use a tile definition
> attribute as 
> an bean:message key?
> 
> Or do you have to useAttribute to declare a Java
> variable, 
> and then <bean:message key="<%=key%>"/>
> 
> ...very awkward.
> 
> / h e n r i k
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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