You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gregor Rayman <gr...@gmx.net> on 2001/07/03 00:40:58 UTC

I18n was: jsp vs do

Thanks, this can be the source of some problems I've had with the i18n.
I am using Struts only about one month, I has some problems with figuring
out, how bean:message determines the locale it should use.

So I peeked in the sources and found out, it uses a session sttribute. I
haven't
look in the sources deep enough, so I did not find, who actually sets the
session attribute.

So I used a tiny scriplet which checks to see whether the attribute is set,
and if it is not, the scriplet sets it according to the request's
preferences.

I mean, this could/should be done by the <bean:message> tag as well.

--
gR

----- Original Message -----
"Timothy Shadel" <sh...@mtc.byu.edu> wrote:


One thing to note, however, is that the internationalization (<bean:message>
tags) won't go to non-default mappings unless you use a *.do extension.  I
can't remember if our tests showed that going first to a *.do and then to a
*.jsp worked or not...I don't think so.  If you need to make your login
screen available (to continue the example) in several languages, you need to
link to the *.do version, and write your Action class in a way that either
won't auto-validate the ActionForm, or won't require info up front.

Tim Shadel

>>> "Gregor Rayman" <gr...@gmx.net> 07/02/01 11:52AM >>>
"Anthony Martin" <An...@TRAMS.com> wrote:

> In general, however, you can go to actions directly as long as you supply
> the required fields in the url (if any).
>
> In the case of the struts-example, going to logon.do gives a validation
> error because it was expecting the correct query string.  For example:
>
> http://localhost/struts-example/logon.do?username=foo&password=bar
>
>
> Anthony

Yes, you can always go directly to the action, as long as you provide
the necessary data. Some actions do not need any input at all. (e. g.
/admin/restart.do)

It wouldn't be very bad to go directly to login.do without any data, since
this would simply report an error and forward to its input (login.jsp)
itself.


--
gR


>
> -----Original Message-----
> From: Gregor Rayman [mailto:grayman@gmx.net]
> Sent: Monday, July 02, 2001 10:28 AM
> To: struts-user@jakarta.apache.org
> Subject: Re: jsp vs do
>
>
> "Anthony Martin" <An...@TRAMS.com> wrote:
>
>
> > This is how I understand it.  A .do maps to an action then to a .jsp.
If
> > you link directly to a .jsp, the action never executes.  Actions are
> mapped
> > to a .jsp in the struts-config.xml file.
> >
> > I'm sure there are more clear explanations to follow.
> >
> >
> > Anthony
>
> DO takes you to an action which needs some input from your currently
> displayed from. If you don't have yet the data necessary for the
> action, you cannot go to the action. In such case you can go to
> HTML or JSP, which contains the input fields you can fill out and
> submit to a DO action.
>
> In the example application, the link goes to login.jsp, since it is
> the place where you can enter the credentials. They are then validated
> in a action (DO). You cannot go to the action directly, since you
> do not have the username/password yet.
>
> --
> gR
>