2013年9月11日星期三

struts1.3 on struts-config.xml a problem

Baba Sports Network Project struts1.3 tomcat7.0 jdk7.0
browser to visit : http://localhost:8000/user/reg.do?method=regUI tips 404 , tomcat error message that there are not only a warning not know if there relationship
WARNING : [SetContextPropertiesRule] {Context} Setting property 'source' to 'org.eclipse.jst.jee.server: shop_01' did not find a matching property.

debugging a bit, feeling struts-config.xml web.xml Skip It seems to go wrong , because the struts-config.xml configuration file inside me how to pass parameters to change are not error messages , such as form- bean's name is inconsistent with the action of the name change does not give prompt error.

get a long time did not come up with a result , the web plate before posting there did not care , eggs hurt , nobody would really it ? This problem did not solve the project can not go ah


key code as follows :
web.xml

xmlns = "http://java.sun.com/xml/ns/j2ee"
xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi: schemaLocation = "http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">



contextConfigLocation
classpath: beans.xml



org.springframework.web.context.ContextLoaderListener



struts
org.apache.struts.action.ActionServlet

config
/ WEB-INF/struts-config.xml

0


struts
*. do


/ index.jsp




struts-config.xml

"- / / Apache Software Foundation / / DTD Struts Configuration 1.3 / / EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">










;




BuyerRegAction.java
package cn.itcast.web.action.user;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.springframework.stereotype.Controller;
@ Controller ("/ user / reg")
public class BuyerRegAction extends DispatchAction {

public ActionForward regUI (ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
System.out.println ("comein");
return mapping.findForward ("regUI");
}

}


BuyerForm.java
package cn.itcast.web.formbean.user;
import org.apache.struts.action.ActionForm;
public class BuyerForm extends ActionForm {
private String username;
private String password;
private String email;

public void BuyerForm () {
System.out.print ("come in"); / / here no console output , should not enter here
}


public String getUsername () {
return username;
}
public void setUsername (String username) {
this.username = username;
}
public String getPassword () {
return password;
}
public void setPassword (String password) {
this.password = password;
}
public String getEmail () {
return email;
}
public void setEmail (String email) {
this.email = email;
}

}

------ Solution ------------------------------------ --------
contents of your project seems to be wrong, to integrate online to see examples of struts and spring .
------ For reference only -------------------------------------- -
--- Warning : [SetContextPropertiesRule] {Context} Setting property 'source' to 'org.eclipse.jst.jee.server: shop_01' did not find ; a matching property. -
The tomcat removed, re-adding a , then go up the deployment project .
------ For reference only -------------------------------------- -
not work, try a few times a
------ For reference only --------------------------- ------------
used to use struts2 + spring3.0 comparison , this version of the project is low, not very familiar with / /
------ For reference only ---------------------------------------
springMVC with struts1 mix ? Too talented.
------ For reference only -------------------------------------- -
not like me to use, is the previous project "Baba movement Network" tutorial , say useless springMVC, the overall frame spring + struts + JPA

没有评论:

发表评论