I need to access httpServletRequest in the validate method of spring webflow. Please help me how to do this.
My webflow for view state is:
<var name="search" class="com.test.form.Search"/>
...................
<view-state id="search" model="search" view="searchPage">
<transition on="submit" to="searchAction">
</transition>
</view-state>
...............
validate method in search model class is:
public void validateLoanSearch(ValidationContext context) {
//I need to get a httpServletRequest here...
}
In action/controller class I can get it thru RequestContext but ValidationContext gives only the messageContext. Any idea? Please help.
I got the solution.
In the bean class or validator class inside the validate method use this:
RequestContext rc = RequestContextHolder.getRequestContext();
RequestContextHolder is becoming available inside the validate method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With