报错信息如下:
javax.servlet.jsp.JspException: Exception creating bean of class com.team5.hr.struts.form.LoginForm: {1}我已经确定包名类名没有写错。SSH集成中formbean的配置应该和只用structs一样吧,如果不是要怎么配置呢。struts文件如下:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"><struts-config>
<form-beans >
<form-bean name="loginForm" type="com.team5.hr.struts.form.LoginForm" />
</form-beans>
<action-mappings >
<action
attribute="loginForm"
input="/login.jsp"
name="loginForm"
path="/login"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="success" path="success.jsp" />
<forward name="error" path="error.jsp" />
</action>
</action-mappings> <message-resources parameter="com.team5.hr.struts.ApplicationResources" />
</struts-config>
javax.servlet.jsp.JspException: Exception creating bean of class com.team5.hr.struts.form.LoginForm: {1}我已经确定包名类名没有写错。SSH集成中formbean的配置应该和只用structs一样吧,如果不是要怎么配置呢。struts文件如下:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"><struts-config>
<form-beans >
<form-bean name="loginForm" type="com.team5.hr.struts.form.LoginForm" />
</form-beans>
<action-mappings >
<action
attribute="loginForm"
input="/login.jsp"
name="loginForm"
path="/login"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" >
<forward name="success" path="success.jsp" />
<forward name="error" path="error.jsp" />
</action>
</action-mappings> <message-resources parameter="com.team5.hr.struts.ApplicationResources" />
</struts-config>
解决方案 »
- org.xml.sax.SAXException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
- EJB3.0,jboss4.2.2,跨越多数据库时,出错,求解决方法!!!!
- for循环的疑问
- gwt与Hibernate集成(急求高手解决,在线等答案)
- spring+struts+ejb+jpa,实体映射上配有懒加载的,在web端调用会导致no sesssion or session has closed错误
- 哪位大虾能帮我分析下这个weblogic的threaddump?
- tomcat-5.0.28下如何访问JavaBean???
- 月薪6000~15000 招聘懂日语,英语Java 工程师
- 在struts 中怎样把jsp页面的from数据写到formBean
- 请问在jsp或别的java程序中如何调用Delphi做的com组件?问了很久,没人知道吗?
- 如何从结果集获得经过聚集函数处理过的数据
- 找不到类的问题 报找不到类异常
这个LoginForm是用myeclipse生成的绝对有继承
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<html>
<head>
<title>JSP for LoginForm form</title>
</head>
<body>
<html:form action="login.do">
password : <html:text property="password"/><html:errors property="password"/><br/>
name : <html:text property="name"/><html:errors property="name"/><br/>
id : <html:text property="id"/><html:errors property="id"/><br/>
<html:submit value="提交"/><html:cancel/>
</html:form>
</body>
</html>action:package com.team5.hr.struts.action;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;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 com.team5.entity.User;
import com.team5.hr.struts.form.LoginForm;
import com.team5.manage.UserManage;public class LoginAction extends Action {
private UserManage userManage; public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ActionForward af=null;
LoginForm loginForm = (LoginForm) form;
String username=loginForm.getName();
String pwd=loginForm.getPassword();
System.out.println(username);
System.out.println(pwd);
User user=new User();
user.setName(username);
user.setPassword(pwd);
if(userManage.login(user)==true){
af=mapping.findForward("success");
}else{
af=mapping.findForward("error");
}
return af;
}
public void setUserManage(UserManage userManage) {
this.userManage = userManage;
}
}
actionForm:
package com.team5.hr.struts.form;import org.apache.struts.action.ActionForm;
public class LoginForm extends ActionForm { private String password;
private String name;
private Integer id; public String getPassword() {
return password;
} public void setPassword(String password) {
this.password = password;
} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public Integer getId() {
return id;
} public void setId(Integer id) {
this.id = id;
}
}
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- 配置sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* com.team5.daoimpl.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
</aop:config> </beans>
这个屏蔽掉,看看
<html:form action="login.do" name="loginForm">
name : <html:text property="loginFrom.name"/><html:errors property="name"/><br/>
id : <html:text property="loginFrom.id"/><html:errors property="id"/><br/>