k pruthi

Greenhorn
+ Follow
since Aug 11, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by k pruthi

David Newton wrote:Putting messages into an action-specific properties file is only one of several places messages can be store. As detailed in the localization docs you can keep shared messages in a package.properties file anywhere in the classpath, a superclass property file, or an application-wide property file.

The reason validation is being invoked immediately is because you're executing the action. If you example the default "workflow" interceptor configuration you'll see that it skips validation for a small set of action methods, including input(). If you don't want a validation failure to take you to the input page you need to use some mechanism to bypass the validation.



Thanks i got the internationalization part and included everything in global..

Regarding validation problem, i want validation on an Action and dont want to skip that.. Here is scenario, let me explain again -it must be common problem for struts

Form1 -> Click Continue-> Action 1 invoked and validation done- > if all passed fwd to Form 2 -> On form 2 if i want to change language->i have to re-invoke Action 1 with request_locate = es -> Now validator is invoked again and expecting Form1 values to be posted again-> as Form1 fields are not there with this repost of action->it is redirecting to previous form (form1 ) with validation errors...
Please tell me how to solve this
15 years ago
I dont understand how Struts2 handle this basic problem, didnt find a conclusive answer

Example:- I have
- 1 simple Action CustomerAction.java ,
- CustmerAction.properties contains label key/values for username/password
- Customer.jsp with two textfield fields username/password,
- CustomerAction-Validation.xml , having a simple validation


Now if i give URI as http://somserver/CustomerAction.action , immediately validator framework is invoked and i see my page loading with 2 errors.. Instead i want my page to load first clean without invoking at Validator, so i create another action say DummyAction1, which redirects to Customer.jsp ... But Customer.jsp is fetching labels using <s:text ... > which are defined in CustomerAction.properties , and which is not invoked yet.. So i have to duplicate my same label keys in DummyAction1.properties and CustomerAction.properties.

Is this kind of duplication approach common in Struts2? How to get rid of? It is creating problem for every form, 1 for initial display, 1 after validation.. Is defining global properties only solution? I dont understand the use of Actionname.properties at first place, what Struts2 is trying to achieve when we have to duplicate keys in 2 different actions???Or i may be missing avery basic concept...correct me..
15 years ago

David Newton wrote:You can just return to the page you were on, I suppose. The I18N is handled by the interceptor--if the form tag contains no action it will do a post-back.




problem with post back is previous page/form values are not re-submitted so control goes to 1 page behind complaining to re-submit the values...here is my problem..

i have a very basic requirement to put a toggle link between english and spanish on top of tile (say header.jsp) and this toggle link to be available in all pages in application... So user can change language on any of the page.. My very basic question is that if i follow struts2 documentation, i need to call an action and specify request_locale=en with that action.. But with this approach i will be redirected from my current form/jsp to another one..
i have one common header.jsp which is available in all pages..my flow works that action is executed and on its success a page with tiles is rendered, now on this tiles page (in header.jsp) i want to change language, which means i need to find dynamically what is my current action and then re-send previous request or call this action again with "request_locale=es" as parameter.

- How do i find current or last action in header.jsp?
- how do i re-submit same action with different locale, if i invoke URI for already processed action, it might complain about where previous form values are as it need those again to come to current page? As a matter of fact i will be returned to previous page form.. Am i wrong here

Any sample code, how header.jsp should look like for changing language in any page?if i have to invoke a new action alltogether, how will i come back to my current page. How does i18 work
15 years ago