You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wes Wannemacher <we...@wantii.com> on 2010/04/27 17:55:13 UTC

Re: Issue with localization: Messages not picked up from properties file

Kartik,

First off, your first mapping doesn't "forward" it dispatches to the
login.jsp page. If the validation file you have created is picked up
when the user hits that url, then you are going to see the validation
errors. Second, in your form tag, I would remove the '.action' from
the action attribute. Also, to make your page flow better, i would
change the mapping as follows -

<action name = "login_*" class="LoginAction" method="{1}">
          <result name="input">/login.jsp</result>
          <result name="success">/login_success.jsp</result>
          <result name="error">/login.jsp</result>
</action>

Then, change your form tag so that it looks like this -

<s:form action="login_authenticate" ...

Notice that you no longer need a separate mapping for login_input. In
addition, the flow of validation will be easier to follow. The trick
is that your entry point will now be - /contextroot/login_input.action

-Wes

On Wed, Apr 21, 2010 at 1:26 PM, Kartik Kumar <kr...@gmail.com> wrote:
> Hi All,
>
> In my package structure, I have package.properties file with the following
> key value pair:
>
> username=User Name
> password=Password
>
> In my simple login page: the form elements are defined with  a key look up..
>
> <s:form action="login.action" method="POST" validate="true">
>    <s:textfield name="username" key="username" />
>    <s:password name="password" key="password"></s:password>
>    <s:submit value="Login" name="login" />
>  </s:form>
>
> My action xml mappings are given below. The first action is a forward action
> to the login page.
>
> <action name = "login_input">
>          <result>/login.jsp</result>
>  </action>
> <action name = "login" class="LoginAction" method="authenticate">
>          <result name="input">/login.jsp</result>
>          <result name="success">/login_success.jsp</result>
>          <result name="error">/login.jsp</result>
> </action>
>
> When I try to load the login page like this:
> http://localhost:8080/myApp/login_input.action, I don't see the messages
> picked up from the package.properties. I see the localized messages if I
> submit the application and when the validation fails.
>
> What can I do to resolve the issue?
>
> Thanks,
>
> Kartik
>
> http
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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