You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Al...@toyotatr.com on 2006/09/11 16:03:30 UTC

using tag in scriptlet

Hi Everybody,

i have a struts application which gives multilanguage support.
And i want to a assign a property file key value to a string in scriptlet.

Here is the example jsp:
.
.
.
<%
        String str="<bean:message key='test.hello'/>";
        out.print(str);
%>
.
.
When i want to print "str" value, there is no output shown at the page.
In addition, I do not have any error message 
Any other solutions please?

Best Regards.


Re: using tag in scriptlet

Posted by Laurie Harper <la...@holoweb.net>.
You can't use JSP tags in scriptlets like that. For your example, just 
remove the scriptlet, i.e. instead of

     <%
         String str="<bean:message key='test.hello'/>";
         out.print(str);
     %>

just write

     <bean:message key='test.hello'/>

If you need the value retrieved by the bean:message tag in some other 
code within a scriptlet, you'll need to set it into a scripting variable 
in JSP (e.g. using c:set) and then access that variable in the scriptlet.

L.

Alperen.PAKER@toyotatr.com wrote:
> Yes i have already try " instead of ' as value deliminator.
> I also tried: key=\"test.hello\" 
> but it does not work too.
> 
> I have also set up resource bundle in strutsconfig. it works, when i use 
> <bean> tag out of scriplet.
> 
> 
> 
> 
> David Grundberg <c0...@cs.umu.se> 
> 09/11/2006 05:12 PM
> Please respond to
> "Struts Users Mailing List" <us...@struts.apache.org>
> 
> 
> To
> Struts Users Mailing List <us...@struts.apache.org>
> cc
> 
> Subject
> Re: using <bean> tag in scriptlet
> 
> 
> 
> 
> 
> 
> I would try using " instead of ' as value delimiter. (key="test.hello" 
> instead of key='test.hello') Have you set up the resource bundle in 
> strutsconfig?
> 
> Alperen.PAKER@toyotatr.com wrote:
> 
>> Hi Everybody,
>>
>> i have a struts application which gives multilanguage support.
>> And i want to a assign a property file key value to a string in 
> scriptlet.
>> Here is the example jsp:
>> .
>> .
>> .
>> <%
>>        String str="<bean:message key='test.hello'/>";
>>        out.print(str);
>> %>
>> .
>> .
>> When i want to print "str" value, there is no output shown at the page.
>> In addition, I do not have any error message 
>> Any other solutions please?
>>
>> Best Regards.
>>
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 


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


Re: using tag in scriptlet

Posted by Al...@toyotatr.com.
Yes i have already try " instead of ' as value deliminator.
I also tried: key=\"test.hello\" 
but it does not work too.

I have also set up resource bundle in strutsconfig. it works, when i use 
<bean> tag out of scriplet.




David Grundberg <c0...@cs.umu.se> 
09/11/2006 05:12 PM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>


To
Struts Users Mailing List <us...@struts.apache.org>
cc

Subject
Re: using <bean> tag in scriptlet






I would try using " instead of ' as value delimiter. (key="test.hello" 
instead of key='test.hello') Have you set up the resource bundle in 
strutsconfig?

Alperen.PAKER@toyotatr.com wrote:

>Hi Everybody,
>
>i have a struts application which gives multilanguage support.
>And i want to a assign a property file key value to a string in 
scriptlet.
>
>Here is the example jsp:
>.
>.
>.
><%
>        String str="<bean:message key='test.hello'/>";
>        out.print(str);
>%>
>.
>.
>When i want to print "str" value, there is no output shown at the page.
>In addition, I do not have any error message 
>Any other solutions please?
>
>Best Regards.
>
>
> 
>


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



Re: using tag in scriptlet

Posted by David Grundberg <c0...@cs.umu.se>.
I would try using " instead of ' as value delimiter. (key="test.hello" 
instead of key='test.hello') Have you set up the resource bundle in 
strutsconfig?

Alperen.PAKER@toyotatr.com wrote:

>Hi Everybody,
>
>i have a struts application which gives multilanguage support.
>And i want to a assign a property file key value to a string in scriptlet.
>
>Here is the example jsp:
>.
>.
>.
><%
>        String str="<bean:message key='test.hello'/>";
>        out.print(str);
>%>
>.
>.
>When i want to print "str" value, there is no output shown at the page.
>In addition, I do not have any error message 
>Any other solutions please?
>
>Best Regards.
>
>
>  
>


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