• Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts2 key attribute  RSS feed

MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a new learner to struts2
I read on struts2 apache site http://struts.apache.org/2.x/docs/message-resource-files.html that
To enable the struts2 key attribute to find the properties file, the display of the view page must be the result of executing a Struts 2 Action class.

If the page with key attribute is not the result of execution of struts2 action, then there is one trick given on the site to make this work.
Suppose there is one register.jsp page with the form asking user information and there is use of struts2 key attribute on this page.
and in order to make the key attribute from this page to work it has to be the result of execution of struts2 action.
So instead of using the standard url from index.jsp to go to this register.jsp
We can do it in following way so that register.jsp is the result of execution of struts2 action.

But what i think is, if we do this second way, register.jsp page will work fine but just to make it work we will end up in executing the execute method and other logic written in
as part of execution of action class because after clicking to above link, it will cause to execute the registerInput action. If the action class is written in such a way that it will work on some user submitted form data, then in this case there will not be such form data as we have executed the action in other way and not as part of submission of form

so how to cope with this situation?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!