You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rubens Gomes <ru...@pocketgear.com> on 2011/01/07 23:51:25 UTC

Struts 2 - s:text garbled

Hello,

I already spent several hours on this problem.   And I have done some search on the mailing lists as well.

I am using the latest Struts 2 (2.2.1) along with struts-tiles JSP plugin (2.2.2), and I running into a problem with rendering garbled foreign characters from s:text.  If I remove the pageEncoding tag from the top of the JSP page, the <s:text...> works okay.

This line when added to the top of the JSP causes <s:text ...> to render incorrect garbled Portuguese characters.

<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" language="java" %>

All my resource files are saved in UTF-8.  And so is my JSPs.  And I also have the following on all pages.

<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />

And I have following settings too:

struts.xml:
...
<constant name="struts.i18n.encoding" value="UTF-8"/>
...

freemaker.properties:
default_encoding=UTF-8


--
Rubens


Re: Struts 2 - s:text garbled

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
Hi Rubens,

I've had a similar issue foreign text was displayed as rubbish) not just
with the latest version but the last few. The difference is that we use
sitemesh not tiles.

In the what I found was that I had to change the filter order in my
web.xml. To be honest I couldn't see why this should have an impact but it
did and as I'm sure you're aware after a while you're just happy to have a
fix.

Here's the snippet of my web.xml I changed:

    <filter>
        <filter-name>struts-prepare</filter-name>
        
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</
filter-class>
    </filter>
    <filter>
        <filter-name>struts-execute</filter-name>
        
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</
filter-class>
    </filter>
    <filter>
        <filter-name>sitemesh</filter-name>
        
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-cl
ass>
    </filter>
    <filter-mapping>
        <filter-name>struts-prepare</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts-execute</filter-name>
        <url-pattern>*.action</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts-execute</filter-name>
        <url-pattern>/struts/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>



I hope this helps.

Z.

On 8/01/11 10:27 AM, "Rubens Gomes" <ru...@pocketgear.com> wrote:

>No.  I use Struts-2 resource bundle only. And I am running my application
>on Tomcat 6 with JDK 1.6.  I use titles though.  And below is a page that
>I have problem.  
>
>If I remove the first line <%@ page ... %>, <s:text
>name="pageTitle.common"> renders the correct characters to the page.
>
><!-- Remove following line makes <s:text ...> to render correct
>Portuguese foreign characters -->
><%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
>language="java" %>
>
><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
><%@ taglib prefix="s" uri="/struts-tags" %>
><%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"  %>
>
><c:if test="${sessionScope.userSession.mobile}">
>  <s:url var="login" forceAddSchemeHostAndPort="true" scheme="https"
>namespace="/ssl/security" action="login" />
>  <c:redirect url="${login}" />
></c:if>
>
><c:set var="pageTitle" scope="request">EZLista - <s:text
>name="pageTitle.common" /></c:set>
><c:set var="homePage" value="true" scope="request" />
><c:set var="loginPage" value="true" scope="request" />
><c:set var="transitional" value="true" scope="request" />
><c:set var="iframe" value="true" scope="request" />
><s:set name="redirectUrl" scope="request">/</s:set>
>
><tiles:insertDefinition
>name="${sessionScope.userSession.browser}.home.definition">
>  <tiles:putAttribute
>name="title">${requestScope.pageTitle}</tiles:putAttribute>
></tiles:insertDefinition>
>
>
>-----Original Message-----
>From: Dave Newton [mailto:davelnewton@gmail.com]
>Sent: Friday, January 07, 2011 6:19 PM
>To: Struts Users Mailing List
>Subject: Re: Struts 2 - s:text garbled
>
>Are you using a custom ResourceBundle that handles non-encoded files? Or a
>ResourceBundle.control?
>
>Otherwise I'd assume the default XWork/S2 resource bundle isn't the one
>that
>takes an encoding argument, which is a 1.6 (?) thing, so I'd have no
>problem
>believing that was the case.
>
>Dave
>
>On Fri, Jan 7, 2011 at 6:06 PM, Rubens Gomes <ru...@pocketgear.com>
>wrote:
>
>> No. I do not use native2ascii.  The resource is saved/stored under the
>> UTF-8 character set.  Because I edit my resource files from within
>>Eclipse,
>> and I have preferences set to UTF-8.
>>
>> Another piece of information, I know that if I convert the resource
>>file to
>> Unicode characters and save it.  Then, the page is rendered okay having
>>the
>> pageEncoding tag on the JSP.
>>
>>
>>
>> -----Original Message-----
>> From: Dave Newton [mailto:davelnewton@gmail.com]
>> Sent: Friday, January 07, 2011 6:03 PM
>> To: Struts Users Mailing List
>> Subject: Re: Struts 2 - s:text garbled
>>
>> Out of curiosity, did you try after using the native2ascii (or whatever
>> it's
>> called) tool?
>>
>> (I've never actually tried non-encoded resource files, but I'm usually
>> using
>> a tool to create them, so I'm not always sure what I'm actually ending
>>up
>> with, because I'm lazy.)
>>
>> Dave
>>
>> On Fri, Jan 7, 2011 at 5:51 PM, Rubens Gomes <ru...@pocketgear.com>
>> wrote:
>>
>> > Hello,
>> >
>> > I already spent several hours on this problem.   And I have done some
>> > search on the mailing lists as well.
>> >
>> > I am using the latest Struts 2 (2.2.1) along with struts-tiles JSP
>>plugin
>> > (2.2.2), and I running into a problem with rendering garbled foreign
>> > characters from s:text.  If I remove the pageEncoding tag from the
>>top of
>> > the JSP page, the <s:text...> works okay.
>> >
>> > This line when added to the top of the JSP causes <s:text ...> to
>>render
>> > incorrect garbled Portuguese characters.
>> >
>> > <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
>> > language="java" %>
>> >
>> > All my resource files are saved in UTF-8.  And so is my JSPs.  And I
>>also
>> > have the following on all pages.
>> >
>> > <meta http-equiv="Content-Type" content="application/xhtml+xml;
>> > charset=UTF-8" />
>> >
>> > And I have following settings too:
>> >
>> > struts.xml:
>> > ...
>> > <constant name="struts.i18n.encoding" value="UTF-8"/>
>> > ...
>> >
>> > freemaker.properties:
>> > default_encoding=UTF-8
>> >
>> >
>> > --
>> > Rubens
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> 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
>



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


RE: Struts 2 - s:text garbled

Posted by Rubens Gomes <ru...@pocketgear.com>.
No.  I use Struts-2 resource bundle only. And I am running my application on Tomcat 6 with JDK 1.6.  I use titles though.  And below is a page that I have problem.  

If I remove the first line <%@ page ... %>, <s:text name="pageTitle.common"> renders the correct characters to the page.  

<!-- Remove following line makes <s:text ...> to render correct Portuguese foreign characters -->
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" language="java" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"  %>

<c:if test="${sessionScope.userSession.mobile}">
  <s:url var="login" forceAddSchemeHostAndPort="true" scheme="https" namespace="/ssl/security" action="login" />
  <c:redirect url="${login}" />
</c:if>

<c:set var="pageTitle" scope="request">EZLista - <s:text name="pageTitle.common" /></c:set>
<c:set var="homePage" value="true" scope="request" />
<c:set var="loginPage" value="true" scope="request" />
<c:set var="transitional" value="true" scope="request" />
<c:set var="iframe" value="true" scope="request" />
<s:set name="redirectUrl" scope="request">/</s:set>

<tiles:insertDefinition name="${sessionScope.userSession.browser}.home.definition">
  <tiles:putAttribute name="title">${requestScope.pageTitle}</tiles:putAttribute>
</tiles:insertDefinition>


-----Original Message-----
From: Dave Newton [mailto:davelnewton@gmail.com] 
Sent: Friday, January 07, 2011 6:19 PM
To: Struts Users Mailing List
Subject: Re: Struts 2 - s:text garbled

Are you using a custom ResourceBundle that handles non-encoded files? Or a
ResourceBundle.control?

Otherwise I'd assume the default XWork/S2 resource bundle isn't the one that
takes an encoding argument, which is a 1.6 (?) thing, so I'd have no problem
believing that was the case.

Dave

On Fri, Jan 7, 2011 at 6:06 PM, Rubens Gomes <ru...@pocketgear.com> wrote:

> No. I do not use native2ascii.  The resource is saved/stored under the
> UTF-8 character set.  Because I edit my resource files from within Eclipse,
> and I have preferences set to UTF-8.
>
> Another piece of information, I know that if I convert the resource file to
> Unicode characters and save it.  Then, the page is rendered okay having the
> pageEncoding tag on the JSP.
>
>
>
> -----Original Message-----
> From: Dave Newton [mailto:davelnewton@gmail.com]
> Sent: Friday, January 07, 2011 6:03 PM
> To: Struts Users Mailing List
> Subject: Re: Struts 2 - s:text garbled
>
> Out of curiosity, did you try after using the native2ascii (or whatever
> it's
> called) tool?
>
> (I've never actually tried non-encoded resource files, but I'm usually
> using
> a tool to create them, so I'm not always sure what I'm actually ending up
> with, because I'm lazy.)
>
> Dave
>
> On Fri, Jan 7, 2011 at 5:51 PM, Rubens Gomes <ru...@pocketgear.com>
> wrote:
>
> > Hello,
> >
> > I already spent several hours on this problem.   And I have done some
> > search on the mailing lists as well.
> >
> > I am using the latest Struts 2 (2.2.1) along with struts-tiles JSP plugin
> > (2.2.2), and I running into a problem with rendering garbled foreign
> > characters from s:text.  If I remove the pageEncoding tag from the top of
> > the JSP page, the <s:text...> works okay.
> >
> > This line when added to the top of the JSP causes <s:text ...> to render
> > incorrect garbled Portuguese characters.
> >
> > <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
> > language="java" %>
> >
> > All my resource files are saved in UTF-8.  And so is my JSPs.  And I also
> > have the following on all pages.
> >
> > <meta http-equiv="Content-Type" content="application/xhtml+xml;
> > charset=UTF-8" />
> >
> > And I have following settings too:
> >
> > struts.xml:
> > ...
> > <constant name="struts.i18n.encoding" value="UTF-8"/>
> > ...
> >
> > freemaker.properties:
> > default_encoding=UTF-8
> >
> >
> > --
> > Rubens
> >
> >
>
> ---------------------------------------------------------------------
> 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: How to use an application scoped variable in ?

Posted by "Biesbrock, Kevin" <Bi...@aoins.com>.
Awesome!  Glad that worked for ya!

Beez

-----Original Message-----
From: Rubens Gomes [mailto:rubens@pocketgear.com] 
Sent: Tuesday, January 11, 2011 12:01 PM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a
href=""/>?

Thanks.  The following also worked:

<s:a href="%{#application['view-register']}"
title="%{getText('textTitle.account.register')}">
          <s:text name="link.account.register" /></s:a>

Bottom-line, if we want to use "-" hyphen on OGNL expressions we must
define them in the following way

%{application['var-name']}

This is great.  Now I can name my JSP URL action variables the same way
as the equivalent Struts 2 Annotation actions.

Thank you very much.

Rubens.


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


RE: How to use an application scoped variable in ?

Posted by Rubens Gomes <ru...@pocketgear.com>.
Thanks.  The following also worked:

<s:a href="%{#application['view-register']}"  title="%{getText('textTitle.account.register')}">
          <s:text name="link.account.register" /></s:a>

Bottom-line, if we want to use "-" hyphen on OGNL expressions we must define them in the following way

%{application['var-name']}

This is great.  Now I can name my JSP URL action variables the same way as the equivalent Struts 2 Annotation actions.

Thank you very much.

Rubens.


________________________________________
From: Biesbrock, Kevin [Biesbrock.Kevin@aoins.com]
Sent: Tuesday, January 11, 2011 11:51 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a href=""/>?

Sorry, I had a typo...I meant you could use your hyphens and try this:
%{#application['view-register']}


Beez
r 5347

-----Original Message-----
From: Rubens Gomes [mailto:rubens@pocketgear.com]
Sent: Tuesday, January 11, 2011 11:45 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a
href=""/>?

BTW,  the only reason I strated using the "-" minus sign in my JSP URL
variable is to follow the convention used by Struts Annotation that uses
"-" sign to map to the corresponding Action class name.

For example, if the actions are in a package
"com.softlagos.web.struts2.action";

And I have a class called
"com.softlagos.web.struts2.action.ViewRegister.class", then, the action
name "view-register" maps to the ViewRegister class.

Therefore, the Struts 2 Annotation is using the "-" minus to map action
names to action classes.

And since my URLs map to actions, I therefore named the variables the
same way.  That is, with the "-" minus sign in it.  However, I did not
know that I would have problems with OGNL in the <s:a href="..." />.
Now, that I know OGNL does not work with "-" minus sign, I am renaming
all my variables to use the "camel" notation which is what I use
throughout all my Java code anyway.

Thanks,

Rubens.
________________________________________
From: Biesbrock, Kevin [Biesbrock.Kevin@aoins.com]
Sent: Tuesday, January 11, 2011 11:43 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a
href=""/>?

I prefer camel case anyway for my variable names but if you like the
hyphen, I think you could do something like this:
%{#application['viewRegister']}


Beez
r 5347

-----Original Message-----
From: Rubens Gomes [mailto:rubens@pocketgear.com]
Sent: Tuesday, January 11, 2011 11:38 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a
href=""/>?

That fixed the problem.

The following works:

<s:a href="%{#application.viewRegister}"
title="%{getText('textTitle.account.register')}">
          <s:text name="link.account.register" /></s:a>

Bottom-line: We *cannot* use "-" (minus-sign) when naming variables that
are used by the OGNL parser.  Like in the case of the <s:a href="..."
/>.

Thank you very much.

Rubens.
________________________________________
From: Chris Pratt [thechrispratt@gmail.com]
Sent: Tuesday, January 11, 2011 11:23 AM
To: Struts Users Mailing List
Subject: Re: How to use an application scoped variable in <s:a
href=""/>?

It seems to me that the minus sign in your expression might be being
confused by the OGNL parser.  You might try renaming your variable to
something that is consistent with the Java bean naming convention and
stay away from arithmetic operands.

Maybe change

<s:a href="%{#application.view-register}"
 title="%{getText('textTitle.account.register')}">

to

<s:a href="%{#application.viewRegister}"
 title="%{getText('textTitle.account.register')}">


  (*Chris*)



On Tue, Jan 11, 2011 at 7:25 AM, Rubens Gomes <ru...@pocketgear.com>
wrote:

> I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard

> <a href=".." /> tag.
>
> And I would like to be able to de-reference an application scope
> variable in the href argument of the <s:a href="???" /> tag.  I have
> already tried
>
> <s:a href='%{#application.var}' />
>
> and it did not work.  Below is an example (please see href).
>
> <s:a href="%{#application.view-register}"
>  title="%{getText('textTitle.account.register')}">
>  <s:text name="link.account.register" /></s:a>
>
>
>
> <!-- portion of i_url.jsp where I define my url variables.... -->
> <c:if test="${empty urls_defined}">
>
>  <s:set var="view-register" scope="application"><s:url
> forceAddSchemeHostAndPort="true" scheme="https"
namespace="/ssl/account"
> action="view-register"  /></s:set>
>  <s:set var="urls_defined" value="true" scope="application"/>
>
> </c:if>
>
>
> then, I import the above jsp into my page using
>
> <c:import url="/jsp/resources/i_urls.jsp" />
>
>
> And now I want to use the above define application scoped URL
> variables in the <s:a href="???" /> tags.
>
> Rubens.
>
> ________________________________________
> From: Maurizio Cucchiara [maurizio.cucchiara@gmail.com]
> Sent: Monday, January 10, 2011 10:27 PM
> To: Struts Users Mailing List
> Subject: Re: How to use an application scoped variable in <s:a
href=""/>?
>
> I'm pretty sure that the property tag is a better candidate in order
> to evaluate OGNL expressions like this.
> Try this
> <a href="<s:property value="#application['...']"/>">Test</a>
>
>
> 2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
> > I am using the <s:a ...> tags in my JSP pages.  And I am using
> > <s:url..>
> to define URLs for the <s:a href="" />.
> > I have recently made some changes to place the URLs <s:url.../>
> > variables
> on the application scope (so that they can
> > be shared by all requests/threads).   Since I made this change I
need to
> change the href in <s:a.../> to point to an
> > application scoped variable instead.  Is there any way to do that?
> >
> > I already tried:  <s:a href="%{#application.var}"...>, and as far as

> > I
> know it does not work.
> >
> > Thanks,
> >
> > Rubens.
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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


---------------------------------------------------------------------
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


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


RE: How to use an application scoped variable in ?

Posted by "Biesbrock, Kevin" <Bi...@aoins.com>.
Sorry, I had a typo...I meant you could use your hyphens and try this:
%{#application['view-register']}


Beez
r 5347 

-----Original Message-----
From: Rubens Gomes [mailto:rubens@pocketgear.com] 
Sent: Tuesday, January 11, 2011 11:45 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a
href=""/>?

BTW,  the only reason I strated using the "-" minus sign in my JSP URL
variable is to follow the convention used by Struts Annotation that uses
"-" sign to map to the corresponding Action class name.

For example, if the actions are in a package
"com.softlagos.web.struts2.action";

And I have a class called
"com.softlagos.web.struts2.action.ViewRegister.class", then, the action
name "view-register" maps to the ViewRegister class.

Therefore, the Struts 2 Annotation is using the "-" minus to map action
names to action classes.

And since my URLs map to actions, I therefore named the variables the
same way.  That is, with the "-" minus sign in it.  However, I did not
know that I would have problems with OGNL in the <s:a href="..." />.
Now, that I know OGNL does not work with "-" minus sign, I am renaming
all my variables to use the "camel" notation which is what I use
throughout all my Java code anyway.

Thanks,

Rubens.
________________________________________
From: Biesbrock, Kevin [Biesbrock.Kevin@aoins.com]
Sent: Tuesday, January 11, 2011 11:43 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a
href=""/>?

I prefer camel case anyway for my variable names but if you like the
hyphen, I think you could do something like this:
%{#application['viewRegister']}


Beez
r 5347

-----Original Message-----
From: Rubens Gomes [mailto:rubens@pocketgear.com]
Sent: Tuesday, January 11, 2011 11:38 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a
href=""/>?

That fixed the problem.

The following works:

<s:a href="%{#application.viewRegister}"
title="%{getText('textTitle.account.register')}">
          <s:text name="link.account.register" /></s:a>

Bottom-line: We *cannot* use "-" (minus-sign) when naming variables that
are used by the OGNL parser.  Like in the case of the <s:a href="..."
/>.

Thank you very much.

Rubens.
________________________________________
From: Chris Pratt [thechrispratt@gmail.com]
Sent: Tuesday, January 11, 2011 11:23 AM
To: Struts Users Mailing List
Subject: Re: How to use an application scoped variable in <s:a
href=""/>?

It seems to me that the minus sign in your expression might be being
confused by the OGNL parser.  You might try renaming your variable to
something that is consistent with the Java bean naming convention and
stay away from arithmetic operands.

Maybe change

<s:a href="%{#application.view-register}"
 title="%{getText('textTitle.account.register')}">

to

<s:a href="%{#application.viewRegister}"
 title="%{getText('textTitle.account.register')}">


  (*Chris*)



On Tue, Jan 11, 2011 at 7:25 AM, Rubens Gomes <ru...@pocketgear.com>
wrote:

> I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard

> <a href=".." /> tag.
>
> And I would like to be able to de-reference an application scope 
> variable in the href argument of the <s:a href="???" /> tag.  I have 
> already tried
>
> <s:a href='%{#application.var}' />
>
> and it did not work.  Below is an example (please see href).
>
> <s:a href="%{#application.view-register}"
>  title="%{getText('textTitle.account.register')}">
>  <s:text name="link.account.register" /></s:a>
>
>
>
> <!-- portion of i_url.jsp where I define my url variables.... --> 
> <c:if test="${empty urls_defined}">
>
>  <s:set var="view-register" scope="application"><s:url 
> forceAddSchemeHostAndPort="true" scheme="https"
namespace="/ssl/account"
> action="view-register"  /></s:set>
>  <s:set var="urls_defined" value="true" scope="application"/>
>
> </c:if>
>
>
> then, I import the above jsp into my page using
>
> <c:import url="/jsp/resources/i_urls.jsp" />
>
>
> And now I want to use the above define application scoped URL 
> variables in the <s:a href="???" /> tags.
>
> Rubens.
>
> ________________________________________
> From: Maurizio Cucchiara [maurizio.cucchiara@gmail.com]
> Sent: Monday, January 10, 2011 10:27 PM
> To: Struts Users Mailing List
> Subject: Re: How to use an application scoped variable in <s:a
href=""/>?
>
> I'm pretty sure that the property tag is a better candidate in order 
> to evaluate OGNL expressions like this.
> Try this
> <a href="<s:property value="#application['...']"/>">Test</a>
>
>
> 2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
> > I am using the <s:a ...> tags in my JSP pages.  And I am using 
> > <s:url..>
> to define URLs for the <s:a href="" />.
> > I have recently made some changes to place the URLs <s:url.../> 
> > variables
> on the application scope (so that they can
> > be shared by all requests/threads).   Since I made this change I
need to
> change the href in <s:a.../> to point to an
> > application scoped variable instead.  Is there any way to do that?
> >
> > I already tried:  <s:a href="%{#application.var}"...>, and as far as

> > I
> know it does not work.
> >
> > Thanks,
> >
> > Rubens.
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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


---------------------------------------------------------------------
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: How to use an application scoped variable in ?

Posted by Rubens Gomes <ru...@pocketgear.com>.
BTW,  the only reason I strated using the "-" minus sign in my JSP URL variable is to follow the
convention used by Struts Annotation that uses "-" sign to map to the corresponding Action class
name.

For example, if the actions are in a package "com.softlagos.web.struts2.action";

And I have a class called "com.softlagos.web.struts2.action.ViewRegister.class", then, 
the action name "view-register" maps to the ViewRegister class.

Therefore, the Struts 2 Annotation is using the "-" minus to map action names to action classes.

And since my URLs map to actions, I therefore named the variables the same way.  That is,
with the "-" minus sign in it.  However, I did not know that I would have problems with OGNL in the
<s:a href="..." />.  Now, that I know OGNL does not work with "-" minus sign, I am renaming all
my variables to use the "camel" notation which is what I use throughout all my Java code anyway.

Thanks,

Rubens.
________________________________________
From: Biesbrock, Kevin [Biesbrock.Kevin@aoins.com]
Sent: Tuesday, January 11, 2011 11:43 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a href=""/>?

I prefer camel case anyway for my variable names but if you like the
hyphen, I think you could do something like this:
%{#application['viewRegister']}


Beez
r 5347

-----Original Message-----
From: Rubens Gomes [mailto:rubens@pocketgear.com]
Sent: Tuesday, January 11, 2011 11:38 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a
href=""/>?

That fixed the problem.

The following works:

<s:a href="%{#application.viewRegister}"
title="%{getText('textTitle.account.register')}">
          <s:text name="link.account.register" /></s:a>

Bottom-line: We *cannot* use "-" (minus-sign) when naming variables that
are used by the OGNL parser.  Like in the case of the <s:a href="..."
/>.

Thank you very much.

Rubens.
________________________________________
From: Chris Pratt [thechrispratt@gmail.com]
Sent: Tuesday, January 11, 2011 11:23 AM
To: Struts Users Mailing List
Subject: Re: How to use an application scoped variable in <s:a
href=""/>?

It seems to me that the minus sign in your expression might be being
confused by the OGNL parser.  You might try renaming your variable to
something that is consistent with the Java bean naming convention and
stay away from arithmetic operands.

Maybe change

<s:a href="%{#application.view-register}"
 title="%{getText('textTitle.account.register')}">

to

<s:a href="%{#application.viewRegister}"
 title="%{getText('textTitle.account.register')}">


  (*Chris*)



On Tue, Jan 11, 2011 at 7:25 AM, Rubens Gomes <ru...@pocketgear.com>
wrote:

> I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard

> <a href=".." /> tag.
>
> And I would like to be able to de-reference an application scope
> variable in the href argument of the <s:a href="???" /> tag.  I have
> already tried
>
> <s:a href='%{#application.var}' />
>
> and it did not work.  Below is an example (please see href).
>
> <s:a href="%{#application.view-register}"
>  title="%{getText('textTitle.account.register')}">
>  <s:text name="link.account.register" /></s:a>
>
>
>
> <!-- portion of i_url.jsp where I define my url variables.... -->
> <c:if test="${empty urls_defined}">
>
>  <s:set var="view-register" scope="application"><s:url
> forceAddSchemeHostAndPort="true" scheme="https"
namespace="/ssl/account"
> action="view-register"  /></s:set>
>  <s:set var="urls_defined" value="true" scope="application"/>
>
> </c:if>
>
>
> then, I import the above jsp into my page using
>
> <c:import url="/jsp/resources/i_urls.jsp" />
>
>
> And now I want to use the above define application scoped URL
> variables in the <s:a href="???" /> tags.
>
> Rubens.
>
> ________________________________________
> From: Maurizio Cucchiara [maurizio.cucchiara@gmail.com]
> Sent: Monday, January 10, 2011 10:27 PM
> To: Struts Users Mailing List
> Subject: Re: How to use an application scoped variable in <s:a
href=""/>?
>
> I'm pretty sure that the property tag is a better candidate in order
> to evaluate OGNL expressions like this.
> Try this
> <a href="<s:property value="#application['...']"/>">Test</a>
>
>
> 2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
> > I am using the <s:a ...> tags in my JSP pages.  And I am using
> > <s:url..>
> to define URLs for the <s:a href="" />.
> > I have recently made some changes to place the URLs <s:url.../>
> > variables
> on the application scope (so that they can
> > be shared by all requests/threads).   Since I made this change I
need to
> change the href in <s:a.../> to point to an
> > application scoped variable instead.  Is there any way to do that?
> >
> > I already tried:  <s:a href="%{#application.var}"...>, and as far as

> > I
> know it does not work.
> >
> > Thanks,
> >
> > Rubens.
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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


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


RE: How to use an application scoped variable in ?

Posted by "Biesbrock, Kevin" <Bi...@aoins.com>.
I prefer camel case anyway for my variable names but if you like the
hyphen, I think you could do something like this:
%{#application['viewRegister']} 


Beez
r 5347 

-----Original Message-----
From: Rubens Gomes [mailto:rubens@pocketgear.com] 
Sent: Tuesday, January 11, 2011 11:38 AM
To: Struts Users Mailing List
Subject: RE: How to use an application scoped variable in <s:a
href=""/>?

That fixed the problem. 

The following works:

<s:a href="%{#application.viewRegister}"
title="%{getText('textTitle.account.register')}">
          <s:text name="link.account.register" /></s:a>

Bottom-line: We *cannot* use "-" (minus-sign) when naming variables that
are used by the OGNL parser.  Like in the case of the <s:a href="..."
/>.

Thank you very much.

Rubens.
________________________________________
From: Chris Pratt [thechrispratt@gmail.com]
Sent: Tuesday, January 11, 2011 11:23 AM
To: Struts Users Mailing List
Subject: Re: How to use an application scoped variable in <s:a
href=""/>?

It seems to me that the minus sign in your expression might be being
confused by the OGNL parser.  You might try renaming your variable to
something that is consistent with the Java bean naming convention and
stay away from arithmetic operands.

Maybe change

<s:a href="%{#application.view-register}"
 title="%{getText('textTitle.account.register')}">

to

<s:a href="%{#application.viewRegister}"
 title="%{getText('textTitle.account.register')}">


  (*Chris*)



On Tue, Jan 11, 2011 at 7:25 AM, Rubens Gomes <ru...@pocketgear.com>
wrote:

> I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard

> <a href=".." /> tag.
>
> And I would like to be able to de-reference an application scope 
> variable in the href argument of the <s:a href="???" /> tag.  I have 
> already tried
>
> <s:a href='%{#application.var}' />
>
> and it did not work.  Below is an example (please see href).
>
> <s:a href="%{#application.view-register}"
>  title="%{getText('textTitle.account.register')}">
>  <s:text name="link.account.register" /></s:a>
>
>
>
> <!-- portion of i_url.jsp where I define my url variables.... --> 
> <c:if test="${empty urls_defined}">
>
>  <s:set var="view-register" scope="application"><s:url 
> forceAddSchemeHostAndPort="true" scheme="https"
namespace="/ssl/account"
> action="view-register"  /></s:set>
>  <s:set var="urls_defined" value="true" scope="application"/>
>
> </c:if>
>
>
> then, I import the above jsp into my page using
>
> <c:import url="/jsp/resources/i_urls.jsp" />
>
>
> And now I want to use the above define application scoped URL 
> variables in the <s:a href="???" /> tags.
>
> Rubens.
>
> ________________________________________
> From: Maurizio Cucchiara [maurizio.cucchiara@gmail.com]
> Sent: Monday, January 10, 2011 10:27 PM
> To: Struts Users Mailing List
> Subject: Re: How to use an application scoped variable in <s:a
href=""/>?
>
> I'm pretty sure that the property tag is a better candidate in order 
> to evaluate OGNL expressions like this.
> Try this
> <a href="<s:property value="#application['...']"/>">Test</a>
>
>
> 2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
> > I am using the <s:a ...> tags in my JSP pages.  And I am using 
> > <s:url..>
> to define URLs for the <s:a href="" />.
> > I have recently made some changes to place the URLs <s:url.../> 
> > variables
> on the application scope (so that they can
> > be shared by all requests/threads).   Since I made this change I
need to
> change the href in <s:a.../> to point to an
> > application scoped variable instead.  Is there any way to do that?
> >
> > I already tried:  <s:a href="%{#application.var}"...>, and as far as

> > I
> know it does not work.
> >
> > Thanks,
> >
> > Rubens.
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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: How to use an application scoped variable in ?

Posted by Rubens Gomes <ru...@pocketgear.com>.
That fixed the problem. 

The following works:

<s:a href="%{#application.viewRegister}"  title="%{getText('textTitle.account.register')}">
          <s:text name="link.account.register" /></s:a>

Bottom-line: We *cannot* use "-" (minus-sign) when naming variables that are used by the OGNL parser.  Like in the case of the <s:a href="..." />.

Thank you very much.

Rubens.
________________________________________
From: Chris Pratt [thechrispratt@gmail.com]
Sent: Tuesday, January 11, 2011 11:23 AM
To: Struts Users Mailing List
Subject: Re: How to use an application scoped variable in <s:a href=""/>?

It seems to me that the minus sign in your expression might be being
confused by the OGNL parser.  You might try renaming your variable to
something that is consistent with the Java bean naming convention and stay
away from arithmetic operands.

Maybe change

<s:a href="%{#application.view-register}"
 title="%{getText('textTitle.account.register')}">

to

<s:a href="%{#application.viewRegister}"
 title="%{getText('textTitle.account.register')}">


  (*Chris*)



On Tue, Jan 11, 2011 at 7:25 AM, Rubens Gomes <ru...@pocketgear.com> wrote:

> I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard <a
> href=".." /> tag.
>
> And I would like to be able to de-reference an application scope variable
> in the href argument
> of the <s:a href="???" /> tag.  I have already tried
>
> <s:a href='%{#application.var}' />
>
> and it did not work.  Below is an example (please see href).
>
> <s:a href="%{#application.view-register}"
>  title="%{getText('textTitle.account.register')}">
>  <s:text name="link.account.register" /></s:a>
>
>
>
> <!-- portion of i_url.jsp where I define my url variables.... -->
> <c:if test="${empty urls_defined}">
>
>  <s:set var="view-register" scope="application"><s:url
> forceAddSchemeHostAndPort="true" scheme="https" namespace="/ssl/account"
> action="view-register"  /></s:set>
>  <s:set var="urls_defined" value="true" scope="application"/>
>
> </c:if>
>
>
> then, I import the above jsp into my page using
>
> <c:import url="/jsp/resources/i_urls.jsp" />
>
>
> And now I want to use the above define application scoped URL variables in
> the <s:a href="???" /> tags.
>
> Rubens.
>
> ________________________________________
> From: Maurizio Cucchiara [maurizio.cucchiara@gmail.com]
> Sent: Monday, January 10, 2011 10:27 PM
> To: Struts Users Mailing List
> Subject: Re: How to use an application scoped variable in <s:a href=""/>?
>
> I'm pretty sure that the property tag is a better candidate in order
> to evaluate OGNL expressions like this.
> Try this
> <a href="<s:property value="#application['...']"/>">Test</a>
>
>
> 2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
> > I am using the <s:a ...> tags in my JSP pages.  And I am using <s:url..>
> to define URLs for the <s:a href="" />.
> > I have recently made some changes to place the URLs <s:url.../> variables
> on the application scope (so that they can
> > be shared by all requests/threads).   Since I made this change I need to
> change the href in <s:a.../> to point to an
> > application scoped variable instead.  Is there any way to do that?
> >
> > I already tried:  <s:a href="%{#application.var}"...>, and as far as I
> know it does not work.
> >
> > Thanks,
> >
> > Rubens.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> 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
>
>

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


Re: How to use an application scoped variable in ?

Posted by Dave Newton <da...@gmail.com>.
Oh, yeah, didn't even see that--that will parse as (#application.view) -
register.

Dave

On Tue, Jan 11, 2011 at 11:23 AM, Chris Pratt <th...@gmail.com>wrote:

> It seems to me that the minus sign in your expression might be being
> confused by the OGNL parser.  You might try renaming your variable to
> something that is consistent with the Java bean naming convention and stay
> away from arithmetic operands.
>
> Maybe change
>
> <s:a href="%{#application.view-register}"
>  title="%{getText('textTitle.account.register')}">
>
> to
>
> <s:a href="%{#application.viewRegister}"
>  title="%{getText('textTitle.account.register')}">
>
>
>  (*Chris*)
>
>
>
> On Tue, Jan 11, 2011 at 7:25 AM, Rubens Gomes <ru...@pocketgear.com>
> wrote:
>
> > I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard <a
> > href=".." /> tag.
> >
> > And I would like to be able to de-reference an application scope variable
> > in the href argument
> > of the <s:a href="???" /> tag.  I have already tried
> >
> > <s:a href='%{#application.var}' />
> >
> > and it did not work.  Below is an example (please see href).
> >
> > <s:a href="%{#application.view-register}"
> >  title="%{getText('textTitle.account.register')}">
> >  <s:text name="link.account.register" /></s:a>
> >
> >
> >
> > <!-- portion of i_url.jsp where I define my url variables.... -->
> > <c:if test="${empty urls_defined}">
> >
> >  <s:set var="view-register" scope="application"><s:url
> > forceAddSchemeHostAndPort="true" scheme="https" namespace="/ssl/account"
> > action="view-register"  /></s:set>
> >  <s:set var="urls_defined" value="true" scope="application"/>
> >
> > </c:if>
> >
> >
> > then, I import the above jsp into my page using
> >
> > <c:import url="/jsp/resources/i_urls.jsp" />
> >
> >
> > And now I want to use the above define application scoped URL variables
> in
> > the <s:a href="???" /> tags.
> >
> > Rubens.
> >
> > ________________________________________
> > From: Maurizio Cucchiara [maurizio.cucchiara@gmail.com]
> > Sent: Monday, January 10, 2011 10:27 PM
> > To: Struts Users Mailing List
> > Subject: Re: How to use an application scoped variable in <s:a href=""/>?
> >
> > I'm pretty sure that the property tag is a better candidate in order
> > to evaluate OGNL expressions like this.
> > Try this
> > <a href="<s:property value="#application['...']"/>">Test</a>
> >
> >
> > 2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
> > > I am using the <s:a ...> tags in my JSP pages.  And I am using
> <s:url..>
> > to define URLs for the <s:a href="" />.
> > > I have recently made some changes to place the URLs <s:url.../>
> variables
> > on the application scope (so that they can
> > > be shared by all requests/threads).   Since I made this change I need
> to
> > change the href in <s:a.../> to point to an
> > > application scoped variable instead.  Is there any way to do that?
> > >
> > > I already tried:  <s:a href="%{#application.var}"...>, and as far as I
> > know it does not work.
> > >
> > > Thanks,
> > >
> > > Rubens.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> >
> >
> > --
> > Maurizio Cucchiara
> >
> > ---------------------------------------------------------------------
> > 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: How to use an application scoped variable in ?

Posted by Chris Pratt <th...@gmail.com>.
It seems to me that the minus sign in your expression might be being
confused by the OGNL parser.  You might try renaming your variable to
something that is consistent with the Java bean naming convention and stay
away from arithmetic operands.

Maybe change

<s:a href="%{#application.view-register}"
 title="%{getText('textTitle.account.register')}">

to

<s:a href="%{#application.viewRegister}"
 title="%{getText('textTitle.account.register')}">


  (*Chris*)



On Tue, Jan 11, 2011 at 7:25 AM, Rubens Gomes <ru...@pocketgear.com> wrote:

> I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard <a
> href=".." /> tag.
>
> And I would like to be able to de-reference an application scope variable
> in the href argument
> of the <s:a href="???" /> tag.  I have already tried
>
> <s:a href='%{#application.var}' />
>
> and it did not work.  Below is an example (please see href).
>
> <s:a href="%{#application.view-register}"
>  title="%{getText('textTitle.account.register')}">
>  <s:text name="link.account.register" /></s:a>
>
>
>
> <!-- portion of i_url.jsp where I define my url variables.... -->
> <c:if test="${empty urls_defined}">
>
>  <s:set var="view-register" scope="application"><s:url
> forceAddSchemeHostAndPort="true" scheme="https" namespace="/ssl/account"
> action="view-register"  /></s:set>
>  <s:set var="urls_defined" value="true" scope="application"/>
>
> </c:if>
>
>
> then, I import the above jsp into my page using
>
> <c:import url="/jsp/resources/i_urls.jsp" />
>
>
> And now I want to use the above define application scoped URL variables in
> the <s:a href="???" /> tags.
>
> Rubens.
>
> ________________________________________
> From: Maurizio Cucchiara [maurizio.cucchiara@gmail.com]
> Sent: Monday, January 10, 2011 10:27 PM
> To: Struts Users Mailing List
> Subject: Re: How to use an application scoped variable in <s:a href=""/>?
>
> I'm pretty sure that the property tag is a better candidate in order
> to evaluate OGNL expressions like this.
> Try this
> <a href="<s:property value="#application['...']"/>">Test</a>
>
>
> 2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
> > I am using the <s:a ...> tags in my JSP pages.  And I am using <s:url..>
> to define URLs for the <s:a href="" />.
> > I have recently made some changes to place the URLs <s:url.../> variables
> on the application scope (so that they can
> > be shared by all requests/threads).   Since I made this change I need to
> change the href in <s:a.../> to point to an
> > application scoped variable instead.  Is there any way to do that?
> >
> > I already tried:  <s:a href="%{#application.var}"...>, and as far as I
> know it does not work.
> >
> > Thanks,
> >
> > Rubens.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> 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: RE: How to use an application scoped variable in ?

Posted by Maurizio Cucchiara <ma...@gmail.com>.
Don't take in consideration my last email.

Maurizio Cucchiara

On Jan 11, 2011 4:30 PM, "Maurizio Cucchiara" <ma...@gmail.com>
wrote:

Did you try the set tag [1]?
http://struts.apache.org/2.0.14/docs/set.html

Maurizio Cucchiara



On Jan 11, 2011 4:25 PM, "Rubens Gomes" <ru...@pocketgear.com> wrote:
> I am using the <s:a href=...

Re: RE: How to use an application scoped variable in ?

Posted by Maurizio Cucchiara <ma...@gmail.com>.
Did you try the set tag [1]?
http://struts.apache.org/2.0.14/docs/set.html

Maurizio Cucchiara

On Jan 11, 2011 4:25 PM, "Rubens Gomes" <ru...@pocketgear.com> wrote:
> I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard <a
href=".." /> tag.
>
> And I would like to be able to de-reference an application scope variable
in the href argument
> of the <s:a href="???" /> tag. I have already tried
>
> <s:a href='%{#application.var}' />
>
> and it did not work. Below is an example (please see href).
>
> <s:a href="%{#application.view-register}"
title="%{getText('textTitle.account.register')}">
> <s:text name="link.account.register" /></s:a>
>
>
>
> <!-- portion of i_url.jsp where I define my url variables.... -->
> <c:if test="${empty urls_defined}">
>
> <s:set var="view-register" scope="application"><s:url
forceAddSchemeHostAndPort="true" scheme="https" namespace="/ssl/account"
action="view-register" /></s:set>
> <s:set var="urls_defined" value="true" scope="application"/>
>
> </c:if>
>
>
> then, I import the above jsp into my page using
>
> <c:import url="/jsp/resources/i_urls.jsp" />
>
>
> And now I want to use the above define application scoped URL variables in
the <s:a href="???" /> tags.
>
> Rubens.
>
> ________________________________________
> From: Maurizio Cucchiara [maurizio.cucchiara@gmail.com]
> Sent: Monday, January 10, 2011 10:27 PM
> To: Struts Users Mailing List
> Subject: Re: How to use an application scoped variable in <s:a href=""/>?
>
> I'm pretty sure that the property tag is a better candidate in order
> to evaluate OGNL expressions like this.
> Try this
> <a href="<s:property value="#application['...']"/>">Test</a>
>
>
> 2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
>> I am using the <s:a ...> tags in my JSP pages. And I am using <s:url..>
to define URLs for the <s:a href="" />.
>> I have recently made some changes to place the URLs <s:url.../> variables
on the application scope (so that they can
>> be shared by all requests/threads). Since I made this change I need to
change the href in <s:a.../> to point to an
>> application scoped variable instead. Is there any way to do that?
>>
>> I already tried: <s:a href="%{#application.var}"...>, and as far as I
know it does not work.
>>
>> Thanks,
>>
>> Rubens.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> 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: How to use an application scoped variable in ?

Posted by Dave Newton <da...@gmail.com>.
On Tue, Jan 11, 2011 at 10:25 AM, Rubens Gomes <ru...@pocketgear.com>wrote:

> I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard <a
> href=".." /> tag.
>

Why?

(Man, that seems like a confusing way to add another layer of
complexity--aren't action names already supposed to add a layer of
abstraction onto functionality?

RE: How to use an application scoped variable in ?

Posted by Rubens Gomes <ru...@pocketgear.com>.
I am using the <s:a href=".." /> Struts 2 tag, *not* the HTML standard <a href=".." /> tag.

And I would like to be able to de-reference an application scope variable in the href argument
of the <s:a href="???" /> tag.  I have already tried 

<s:a href='%{#application.var}' />

and it did not work.  Below is an example (please see href).

<s:a href="%{#application.view-register}"  title="%{getText('textTitle.account.register')}">
  <s:text name="link.account.register" /></s:a>



<!-- portion of i_url.jsp where I define my url variables.... -->
<c:if test="${empty urls_defined}">

  <s:set var="view-register" scope="application"><s:url forceAddSchemeHostAndPort="true" scheme="https" namespace="/ssl/account" action="view-register"  /></s:set>
  <s:set var="urls_defined" value="true" scope="application"/>

</c:if>


then, I import the above jsp into my page using

<c:import url="/jsp/resources/i_urls.jsp" />


And now I want to use the above define application scoped URL variables in the <s:a href="???" /> tags.

Rubens.

________________________________________
From: Maurizio Cucchiara [maurizio.cucchiara@gmail.com]
Sent: Monday, January 10, 2011 10:27 PM
To: Struts Users Mailing List
Subject: Re: How to use an application scoped variable in <s:a href=""/>?

I'm pretty sure that the property tag is a better candidate in order
to evaluate OGNL expressions like this.
Try this
<a href="<s:property value="#application['...']"/>">Test</a>


2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
> I am using the <s:a ...> tags in my JSP pages.  And I am using <s:url..> to define URLs for the <s:a href="" />.  
> I have recently made some changes to place the URLs <s:url.../> variables on the application scope (so that they can 
> be shared by all requests/threads).   Since I made this change I need to change the href in <s:a.../> to point to an
> application scoped variable instead.  Is there any way to do that?
>
> I already tried:  <s:a href="%{#application.var}"...>, and as far as I know it does not work.
>
> Thanks,
>
> Rubens.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



--
Maurizio Cucchiara

---------------------------------------------------------------------
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: How to use an application scoped variable in ?

Posted by Maurizio Cucchiara <ma...@gmail.com>.
I'm pretty sure that the property tag is a better candidate in order
to evaluate OGNL expressions like this.
Try this
<a href="<s:property value="#application['...']"/>">Test</a>


2011/1/11 Rubens Gomes <ru...@pocketgear.com>:
> I am using the <s:a ...> tags in my JSP pages.  And I am using <s:url..> to define URLs for the <s:a href="" />.  I have recently made some changes to place the URLs <s:url.../> variables on the application scope (so that they can be shared by all requests/threads).   Since I made this change I need to change the href in <s:a.../> to point to an application scoped variable instead.  Is there any way to do that?
>
> I already tried:  <s:a href="%{#application.var}"...>, and as far as I know it does not work.
>
> Thanks,
>
> Rubens.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Maurizio Cucchiara

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


How to use an application scoped variable in ?

Posted by Rubens Gomes <ru...@pocketgear.com>.
I am using the <s:a ...> tags in my JSP pages.  And I am using <s:url..> to define URLs for the <s:a href="" />.  I have recently made some changes to place the URLs <s:url.../> variables on the application scope (so that they can be shared by all requests/threads).   Since I made this change I need to change the href in <s:a.../> to point to an application scoped variable instead.  Is there any way to do that?

I already tried:  <s:a href="%{#application.var}"...>, and as far as I know it does not work.

Thanks,

Rubens.

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


Re: Struts 2 - s:text garbled

Posted by Dave Newton <da...@gmail.com>.
Are you using a custom ResourceBundle that handles non-encoded files? Or a
ResourceBundle.control?

Otherwise I'd assume the default XWork/S2 resource bundle isn't the one that
takes an encoding argument, which is a 1.6 (?) thing, so I'd have no problem
believing that was the case.

Dave

On Fri, Jan 7, 2011 at 6:06 PM, Rubens Gomes <ru...@pocketgear.com> wrote:

> No. I do not use native2ascii.  The resource is saved/stored under the
> UTF-8 character set.  Because I edit my resource files from within Eclipse,
> and I have preferences set to UTF-8.
>
> Another piece of information, I know that if I convert the resource file to
> Unicode characters and save it.  Then, the page is rendered okay having the
> pageEncoding tag on the JSP.
>
>
>
> -----Original Message-----
> From: Dave Newton [mailto:davelnewton@gmail.com]
> Sent: Friday, January 07, 2011 6:03 PM
> To: Struts Users Mailing List
> Subject: Re: Struts 2 - s:text garbled
>
> Out of curiosity, did you try after using the native2ascii (or whatever
> it's
> called) tool?
>
> (I've never actually tried non-encoded resource files, but I'm usually
> using
> a tool to create them, so I'm not always sure what I'm actually ending up
> with, because I'm lazy.)
>
> Dave
>
> On Fri, Jan 7, 2011 at 5:51 PM, Rubens Gomes <ru...@pocketgear.com>
> wrote:
>
> > Hello,
> >
> > I already spent several hours on this problem.   And I have done some
> > search on the mailing lists as well.
> >
> > I am using the latest Struts 2 (2.2.1) along with struts-tiles JSP plugin
> > (2.2.2), and I running into a problem with rendering garbled foreign
> > characters from s:text.  If I remove the pageEncoding tag from the top of
> > the JSP page, the <s:text...> works okay.
> >
> > This line when added to the top of the JSP causes <s:text ...> to render
> > incorrect garbled Portuguese characters.
> >
> > <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
> > language="java" %>
> >
> > All my resource files are saved in UTF-8.  And so is my JSPs.  And I also
> > have the following on all pages.
> >
> > <meta http-equiv="Content-Type" content="application/xhtml+xml;
> > charset=UTF-8" />
> >
> > And I have following settings too:
> >
> > struts.xml:
> > ...
> > <constant name="struts.i18n.encoding" value="UTF-8"/>
> > ...
> >
> > freemaker.properties:
> > default_encoding=UTF-8
> >
> >
> > --
> > Rubens
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: Struts 2 - s:text garbled

Posted by Rubens Gomes <ru...@pocketgear.com>.
No. I do not use native2ascii.  The resource is saved/stored under the UTF-8 character set.  Because I edit my resource files from within Eclipse, and I have preferences set to UTF-8.  

Another piece of information, I know that if I convert the resource file to Unicode characters and save it.  Then, the page is rendered okay having the pageEncoding tag on the JSP.



-----Original Message-----
From: Dave Newton [mailto:davelnewton@gmail.com] 
Sent: Friday, January 07, 2011 6:03 PM
To: Struts Users Mailing List
Subject: Re: Struts 2 - s:text garbled

Out of curiosity, did you try after using the native2ascii (or whatever it's
called) tool?

(I've never actually tried non-encoded resource files, but I'm usually using
a tool to create them, so I'm not always sure what I'm actually ending up
with, because I'm lazy.)

Dave

On Fri, Jan 7, 2011 at 5:51 PM, Rubens Gomes <ru...@pocketgear.com> wrote:

> Hello,
>
> I already spent several hours on this problem.   And I have done some
> search on the mailing lists as well.
>
> I am using the latest Struts 2 (2.2.1) along with struts-tiles JSP plugin
> (2.2.2), and I running into a problem with rendering garbled foreign
> characters from s:text.  If I remove the pageEncoding tag from the top of
> the JSP page, the <s:text...> works okay.
>
> This line when added to the top of the JSP causes <s:text ...> to render
> incorrect garbled Portuguese characters.
>
> <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
> language="java" %>
>
> All my resource files are saved in UTF-8.  And so is my JSPs.  And I also
> have the following on all pages.
>
> <meta http-equiv="Content-Type" content="application/xhtml+xml;
> charset=UTF-8" />
>
> And I have following settings too:
>
> struts.xml:
> ...
> <constant name="struts.i18n.encoding" value="UTF-8"/>
> ...
>
> freemaker.properties:
> default_encoding=UTF-8
>
>
> --
> Rubens
>
>

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


Re: Struts 2 - s:text garbled

Posted by Dave Newton <da...@gmail.com>.
Out of curiosity, did you try after using the native2ascii (or whatever it's
called) tool?

(I've never actually tried non-encoded resource files, but I'm usually using
a tool to create them, so I'm not always sure what I'm actually ending up
with, because I'm lazy.)

Dave

On Fri, Jan 7, 2011 at 5:51 PM, Rubens Gomes <ru...@pocketgear.com> wrote:

> Hello,
>
> I already spent several hours on this problem.   And I have done some
> search on the mailing lists as well.
>
> I am using the latest Struts 2 (2.2.1) along with struts-tiles JSP plugin
> (2.2.2), and I running into a problem with rendering garbled foreign
> characters from s:text.  If I remove the pageEncoding tag from the top of
> the JSP page, the <s:text...> works okay.
>
> This line when added to the top of the JSP causes <s:text ...> to render
> incorrect garbled Portuguese characters.
>
> <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
> language="java" %>
>
> All my resource files are saved in UTF-8.  And so is my JSPs.  And I also
> have the following on all pages.
>
> <meta http-equiv="Content-Type" content="application/xhtml+xml;
> charset=UTF-8" />
>
> And I have following settings too:
>
> struts.xml:
> ...
> <constant name="struts.i18n.encoding" value="UTF-8"/>
> ...
>
> freemaker.properties:
> default_encoding=UTF-8
>
>
> --
> Rubens
>
>