我是新手,用的是struts写了个表单查询功能,提交后报
exception java.lang.IllegalArgumentException: Resources cannot be null.
org.apache.commons.validator.Validator.<init>(Validator.java:188)
org.apache.struts.validator.Resources.initValidator(Resources.java:475)
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:104)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:950)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
struts-config.xml里的配置文件入下:
<action path="/selectdocuments" name="StockForm" type="cn.edu.ctgu.bysj.web.struts.action.SelectDocuments" validate="false">
<forward name="return" path="/pages/user/showexpress.jsp"/>
</action>请问高手问题出在什么地方?求指点一二
exception java.lang.IllegalArgumentException: Resources cannot be null.
org.apache.commons.validator.Validator.<init>(Validator.java:188)
org.apache.struts.validator.Resources.initValidator(Resources.java:475)
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:104)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:950)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
struts-config.xml里的配置文件入下:
<action path="/selectdocuments" name="StockForm" type="cn.edu.ctgu.bysj.web.struts.action.SelectDocuments" validate="false">
<forward name="return" path="/pages/user/showexpress.jsp"/>
</action>请问高手问题出在什么地方?求指点一二
非法参数异常:资源不能为空
import java.util.Iterator;
import java.util.List;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;import cn.edu.ctgu.bysj.dao.hibernate.HibernateUtil;
import cn.edu.ctgu.bysj.domain.Stock;
import cn.edu.ctgu.bysj.web.struts.form.StockForm;public class SelectDocuments extends Action { // --------------------------------------------------------- Instance
// Variables // --------------------------------------------------------- Methods /**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws UnsupportedEncodingException
*/
@SuppressWarnings("unchecked")
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws UnsupportedEncodingException { // TODO Auto-generated method stub HttpSession session = request.getSession();
Session s = HibernateUtil.currentSession();
StockForm stockForm = (StockForm) form;
System.out.println("2222222");
String ISBN = stockForm.getISBN();
System.out.println(ISBN);
Stock stock;
try {
HibernateUtil.beginTransaction();
String str = new String();
str = " from Stock stock where stock.ISBN = '" + ISBN+ "'";
int i=s.createQuery(str).list().size();
System.out.println(i);
List list=s.createQuery(str).list();
request.setAttribute("list", list);
Iterator it = list.iterator();
while (it.hasNext()){
stock = (Stock) it.next();
String entertime=stock.getEntertime();
String in_employeeid=stock.getIn_employeeid();
String outtime=stock.getOuttime();
String out_employeeid=stock.getOut_employeeid();
}
return mapping.findForward("return");
} catch (HibernateException e) {
e.printStackTrace();
} finally {
s.close();
} ActionMessages errors = new ActionMessages();
errors.add("login error", new ActionMessage("login.error"));
saveErrors(request, errors);
return mapping.getInputForward(); }
}StockForm.java页面代码如下:
package cn.edu.ctgu.bysj.web.struts.form;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class StockForm extends ActionForm { private static final long serialVersionUID = 6563998465524859573L; private Integer warehouseid; private String ISBN; private String entertime; private String outtime; private String in_employeeid;
private String out_employeeid; /**
* Method validate
*
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) { // TODO Auto-generated method stub
return null;
} /**
* Method reset
*
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) { // TODO Auto-generated method stub
} public Integer getWarehouseid() {
return warehouseid;
} public void setWarehouseid(Integer warehouseid) {
this.warehouseid = warehouseid;
} public String getISBN() {
return ISBN;
} public void setISBN(String isbn) {
ISBN = isbn;
} public String getEntertime() {
return entertime;
} public void setEntertime(String entertime) {
this.entertime = entertime;
} public String getOuttime() {
return outtime;
} public void setOuttime(String outtime) {
this.outtime = outtime;
} public String getIn_employeeid() {
return in_employeeid;
} public void setIn_employeeid(String in_employeeid) {
this.in_employeeid = in_employeeid;
}
public String getOut_employeeid() {
return out_employeeid;
} public void setOut_employeeid(String out_employeeid) {
this.out_employeeid = out_employeeid;
}}