How to use strips to clear bean fields
•
Java
In JSP, I have the following fields:
<stripes:text name="email"/>
This field is in my action bean (fragment):
public class CreateClaim implements ActionBean { private String email; public void setEmail(String email) { this.email = email; } public String getEmail() { return email; } public Resolution alc(){ email = "poodle"; return new ForwardResolution("aForward.jsp"); } }
In the ALC () method, I set the email to null However, when the page is rendered, the value of the email field is exactly the same as originally entered Is there any way to clear this field once and trigger the event?
Cheers!
Dave
Solution
This is related to the population strategy of the strips framework By default, it has a request first policy (due to backward compatibility with earlier versions), but I always change it to bean first population strategy
Just edit the web XML to add init param to the strips filter:
<filter> <filter-name>StripesFilter</filter-name> <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class> <init-param> <param-name>PopulationStrategy.Class</param-name> <param-value> net.sourceforge.stripes.tag.BeanFirstPopulationStrategy </param-value> </init-param> ..etc...
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码