5, implement form interaction
(1) Auxiliary Action: PriceIncReaseform
Package web;
Import org.apache.commons.logging.log;
Import org.apache.commons.logging.logfactory;
Import bus.priceincrease;
Import com.opensymphony.xwork.actionsupport;
Public class priceIncreaseform extends actionSupport {
/ ** Logger for this class and subclasses * /
Protected final log logger = logfactory.getlog (getclass ());
Private priceIncrease priceincrease;
Public String Execute () throws exception {
PriceinCrease = new priceIncrease ();
PriceinCrease.setpercentage (20);
Logger.info ("Show PriceInCrease Form.");
RETURN SUCCESS;
}
Public PriceInCrease getPriceIncRease () {
Return PriceinCrease;
}
Public void setPriceIncrease (PriceIncrease PriceIncrease) {
this.priceincrease = priceIncrease;
}
}
l WebWork2 does not provide SimpleFormController mechanisms similar to Spring MVC Framework, which cannot be automatically oriented to form views, so use the auxiliary PriceInCreaseform class to redirect (who has a better way?)
l Here, use the PriceInCrease object to encapsulate the form of single field elements, and initialize in Execute ().
l PriceIncReaseform The configuration in xwork.xml is as follows:
Class = "Web.PriceIncReaseform"> / web-inf / jsp / priceIncrease.jsp param> result> action> (2) Table view page: PriceinCrease.jsp <% @ Taglib Uri = "Webwork" prefix = "ww"%>