Re: [Struts 2.1.8.1] Internationalization: how to remain in the current page ?

2010-03-19 Thread Ulf Liedén
Hi Celinio,

personally, I would build a method that gives back the URL of the page you
are currently visiting, including all parameters. You put this method in a
superclass of all your actions, so that its available everywhere. In the
code you decide which locale parameter to set, according to your current
locale.

The method in the action class could look something like this:

 public String getLocaleSwitchURL() { String url = getContextPath() +
ServletActionContext.getActionMapping().getName() + ".action?" +
"request_locale="; if (getLocale().toString().equals("en_EN")) { url +=
"fr_FR"; flagURL = "fra.jpg"; } else { url += "en_EN"; flagURL = "eng.jpg";
} url += "&"; url += ServletActionContext.getRequest().getQueryString();
return url; } public String getFlagURL() { return getContextPath() +
"images/" + this.flagURL; }
All Strings should of course be configurable, and not hard coded like this.
But just to give you an idea how it could work.  You output the link like
this:

">
   " />


So if the user clicks the link, he will actually call the same page again,
with the same parameters.

Regards,
Ulf

On Fri, Mar 19, 2010 at 12:33 PM, Celinio Fernandes wrote:

> hi,
> I have a quick and basic question.
> Regarding internationalization, whenever a user clicks on a link with a
> flag, i want to change the locale (language)
> of the web application.
> That works well with the i18n interceptor.
> However i always redirect the user to the home page (home.jsp) when i do
> that because that is how i have setup the input result :
>  method="changeLocale">
>   /home/home.jsp
>
>
> My JSP looks like this :
> 
>  fr
> 
>  src="<%=request.getContextPath()%>/images/flag_fr.png" />
>
> So my question is :
> how do you specify the current page in the input result name ?
> so that the user stays on the current page when he changes languages.
> Thanks for helping.
>
>
>


Re: Request Encoding

2010-03-15 Thread Ulf Liedén
Hi Manos, Lukasz,

and thanks for the replies. Setting the URIEncoding="UTF-8" in the
server.xml didn't do the trick for me, but so did an UTF8Filter in the
web.xml.

Best regards,
Ulf

On Mon, Mar 15, 2010 at 11:20 AM, Manos Batsis
wrote:

> Ulf Liedén wrote:
>
>> when my struts application receives form entries containing french
>> character
>> (i.e. é è) they are converted to something else, like é è.
>>
>> This has probably something to do with how the request is encoded. I've
>> tried to add
>>
>> ServletActionContext.getRequest().setCharacterEncoding("UTF-8");
>>
>> to the action class validate() method, and
>>
>> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
>>
>> to the JSP, but this doesn't help. Any suggestions?
>>
>
>
> If you are using Tomcat, you need to update $CATALINA_HOME/conf/server.xml
>
> More specifically, you need to add the
>
> URIEncoding="UTF-8"
>
> to the Connector element for port 80 or 8080.
>
> Cheers,
>
> Manos
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Request Encoding

2010-03-15 Thread Ulf Liedén
Hi all,

when my struts application receives form entries containing french character
(i.e. é è) they are converted to something else, like é è.

This has probably something to do with how the request is encoded. I've
tried to add

ServletActionContext.getRequest().setCharacterEncoding("UTF-8");

to the action class validate() method, and

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

to the JSP, but this doesn't help. Any suggestions?

Best regards,
Ulf


Re: Encoding of french characters in

2010-03-11 Thread Ulf Liedén
Hi Alex,

I had characterset set to ISO-8859-1, but changing to UTF-8, according to
your suggestion, did the trick! Thanks a lot!

Cheers!

On Thu, Mar 11, 2010 at 1:00 PM, Alex Rodriguez Lopez <
alo...@flordeutopia.pt> wrote:

> Hi Ulf,
>
> do you have your charset declared as utf8 like this?
>
> <%@ page contentType="text/html; charset=UTF-8"%>
>
> Maybe you have to write the special characters in the string as html
> entities...
>
> Em 11-03-2010 09:10, Ulf Liedén escreveu:
>
>  Hi all,
>>
>> my first post to this list :-). Sorry if I'm double posting, not sure if
>> the
>> first message reached the list.
>>
>> I'm using Struts 2.1.6 and want to display a string that contains both
>> HTML
>> markup as well as french characters (i.e. é è ê etc) on a webpage.
>>
>> If I use  the french
>> characters are correctly displayed, but the markup is escaped, and
>> displayed
>> as normal text.
>>
>> If I set escape="false" the tag interrupts the string at the first french
>> character, nothing is displayed of it or anything else of the subsequent
>> characters in the string.
>>
>> How can I solve this problem? Update to a newer Struts version?
>>
>> Best regards,
>> Ulf
>>
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Encoding of french characters in

2010-03-11 Thread Ulf Liedén
Hi all,

my first post to this list :-). Sorry if I'm double posting, not sure if the
first message reached the list.

I'm using Struts 2.1.6 and want to display a string that contains both HTML
markup as well as french characters (i.e. é è ê etc) on a webpage.

If I use  the french
characters are correctly displayed, but the markup is escaped, and displayed
as normal text.

If I set escape="false" the tag interrupts the string at the first french
character, nothing is displayed of it or anything else of the subsequent
characters in the string.

How can I solve this problem? Update to a newer Struts version?

Best regards,
Ulf


Encoding of french characters in

2010-03-11 Thread Ulf Liedén
Hi all,

my first post to this list :-).

I'm using Struts 2.1.6 and want to display a string that contains both HTML
markup as well as french characters (i.e. é è ê etc) on a webpage.

If I use  the french
characters are correctly displayed, but the markup is escaped, and displayed
as normal text.

If I set escape="false" the tag interrupts the string at the first french
character, nothing is displayed of it or anything else of the subsequent
characters in the string.

How can I solve this problem? Update to a newer Struts version?

Best regards,
Ulf