You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tin Pham <tt...@learn.senecac.on.ca> on 2003/06/19 15:03:33 UTC

i18n, passing variable into arg0 using bean:message

Hi,

Individually these all work

deleteBusiness.confirm.p1 = Confirm company <b>{0}</b> is correct.

<bean:message key="deleteBusiness.confirm.p1" arg0="Esso"/>

<bean:write name="deleteOganizationForm" property="organizationName"
scope="session" ignore="true"/>

Instead of using a literal of esso we want to use the value taken from our
formBean, deleteOganizationForm.

We have tried various combinations. Can somebody please provide an example?




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


Re: i18n, passing variable into arg0 using bean:message

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 20 Jun 2003, Tin Pham wrote:

> Date: Fri, 20 Jun 2003 02:15:39 -0400
> From: Tin Pham <tt...@learn.senecac.on.ca>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: Re: i18n, passing variable into arg0 using bean:message
>
> Thanks! I really appreciate your help.
>
> I guess JSTL will eventually replace struts custom tags?

The Struts logic tags will *not* go away (that would break backwards
compatibility), but I would recommend that you use JSTL (perhaps in
conjunction with the struts-el library to allow the use of EL expressions
in Struts-like tags) for new development.

Craig McClanahan

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


Re: i18n, passing variable into arg0 using bean:message

Posted by Tin Pham <tt...@learn.senecac.on.ca>.
Thanks! I really appreciate your help.

I guess JSTL will eventually replace struts custom tags?

"Jason Lea" <ja...@kumachan.net.nz> wrote in message
news:3EF22C6A.1040302@kumachan.net.nz...
> Tin Pham wrote:
> > Hi,
> >
> > Individually these all work
> >
> > deleteBusiness.confirm.p1 = Confirm company <b>{0}</b> is correct.
> >
> > <bean:message key="deleteBusiness.confirm.p1" arg0="Esso"/>
> >
> > <bean:write name="deleteOganizationForm" property="organizationName"
> > scope="session" ignore="true"/>
> >
> > Instead of using a literal of esso we want to use the value taken from
our
> > formBean, deleteOganizationForm.
> >
> > We have tried various combinations. Can somebody please provide an
example?
>
> You are unable to use a bean inside the arg0="" parameter (as you have
> no doubt found out).
>
> You probably have 2 choices here:
>
> 1. Use JSTL (preferred)
> You would have to use the struts-el tags in the contrib directory
> It should look something like this
>
> <bean:message key="deleteBusiness.confirm.p1"
> arg0="${deleteOganizationForm.organizationName}"/>
>
>
>
> 2. Use Scriptlets
>
> <bean:define id="orgName" name="deleteOganizationForm"
> property="organizationName" />
>
> <bean:message key="deleteBusiness.confirm.p1" arg0="<%=orgName%>"/>
>
> -- 
> Jason Lea




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


Re: i18n, passing variable into arg0 using bean:message

Posted by Tin Pham <tt...@learn.senecac.on.ca>.
On thing that wasn't mentioned.

You have to cast to (String) in the scriptlets example as define does not
set a type.

<bean:message key="deleteBusiness.confirm.p1" arg0="<%=(String)orgName%>"/>


"Jason Lea" <ja...@kumachan.net.nz> wrote in message
news:3EF22C6A.1040302@kumachan.net.nz...
> Tin Pham wrote:
> > Hi,
> >
> > Individually these all work
> >
> > deleteBusiness.confirm.p1 = Confirm company <b>{0}</b> is correct.
> >
> > <bean:message key="deleteBusiness.confirm.p1" arg0="Esso"/>
> >
> > <bean:write name="deleteOganizationForm" property="organizationName"
> > scope="session" ignore="true"/>
> >
> > Instead of using a literal of esso we want to use the value taken from
our
> > formBean, deleteOganizationForm.
> >
> > We have tried various combinations. Can somebody please provide an
example?
>
> You are unable to use a bean inside the arg0="" parameter (as you have
> no doubt found out).
>
> You probably have 2 choices here:
>
> 1. Use JSTL (preferred)
> You would have to use the struts-el tags in the contrib directory
> It should look something like this
>
> <bean:message key="deleteBusiness.confirm.p1"
> arg0="${deleteOganizationForm.organizationName}"/>
>
>
>
> 2. Use Scriptlets
>
> <bean:define id="orgName" name="deleteOganizationForm"
> property="organizationName" />
>
> <bean:message key="deleteBusiness.confirm.p1" arg0="<%=orgName%>"/>
>
> -- 
> Jason Lea




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


Re: i18n, passing variable into arg0 using bean:message

Posted by Jason Lea <ja...@kumachan.net.nz>.
Tin Pham wrote:
> Hi,
> 
> Individually these all work
> 
> deleteBusiness.confirm.p1 = Confirm company <b>{0}</b> is correct.
> 
> <bean:message key="deleteBusiness.confirm.p1" arg0="Esso"/>
> 
> <bean:write name="deleteOganizationForm" property="organizationName"
> scope="session" ignore="true"/>
> 
> Instead of using a literal of esso we want to use the value taken from our
> formBean, deleteOganizationForm.
> 
> We have tried various combinations. Can somebody please provide an example?

You are unable to use a bean inside the arg0="" parameter (as you have 
no doubt found out).

You probably have 2 choices here:

1. Use JSTL (preferred)
You would have to use the struts-el tags in the contrib directory
It should look something like this

<bean:message key="deleteBusiness.confirm.p1" 
arg0="${deleteOganizationForm.organizationName}"/>



2. Use Scriptlets

<bean:define id="orgName" name="deleteOganizationForm" 
property="organizationName" />

<bean:message key="deleteBusiness.confirm.p1" arg0="<%=orgName%>"/>

-- 
Jason Lea


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