Hello,
I am using
struts 2 in my application. I have to implement validation in one of my form. I was able to do the basic validation using the struts default validators.
My issue is that, I have to submit the form only when the integer value I entered is greater than a predefined value which is database driven.
I have no idea in writing the interceptor and calling it in struts.xml
The basic code i wrote was like
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
public class AuctionValidationInterceptor implements Interceptor {
public String intercept(ActionInvocation invocation) throws Exception {
AuctionAction auction = (AuctionAction)invocation.getAction();
Integer bidPriceTextField = 0;
auction.setBidPriceTextField(bidPriceTextField );
AutoAction auto = (AutoAction)invocation.getAction();
auto.getReservepriceTextField();
if(bidPriceTextField <auto.getReservepriceTextField())
{
}
return invocation.invoke();
}
public void destroy() {
}
public void init() {
}
}
I don't know whether it is correct or not. AuctionAction and AutoAction are the 2 action classes used.
I someone can guide me in this, I will be really greatfull.
Thanks in advance
Aneesh