Of course parameters can pass by URL (result type Redirect/Redirect Action),
or pass to action by @Action(params) (Static Parameters Interceptor)
What I want
id=123 must exist in URL after validation errors (@Result(name="input"))
/update?id=123
Similar to RESTful url pattern (Struts2-rest-plugin not be considered) :
/update/123
I use the redirect-after-post technique + Message Store Interceptor for success action, but it this can’t be use for input after validation errors, because the data of action (include invalid data) will lost / restore to default.
Any solution / suggestion is welcome. Thanks.
Have you tried wildcards to capture the data?
Here is a link to some struts2 documentation (reading it quickly I didn’t think it was very useful): http://struts.apache.org/2.0.6/docs/wildcard-mappings.html
However if you follow though this post and solution you’ll clearly see how to capture data from the URL (Although the poster of that question was more interested in excluding parts of the url, but it just makes the topic more complete): Struts2 Wildcard action mapping with dummy data
It’s possible that your issue is largely because of using “Redirect After Post”. There is little value for doing this in struts2. In general this is better solved using a custom interceptor for what ever cross cutting concerns you have for those actions. If you’re worried about double submissions the TokenInterceptor interceptor already addresses this.