我的struts + spring + hiberante整合有问题,谁能帮我看看,我是这样整合的
struts-config.xml<struts-config>
<data-sources />
<form-beans>
<form-bean name="loginForm"
type="com.chinamobile.struts.form.LoginForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action attribute="loginForm" input="/login.jsp"
name="loginForm" path="/login" scope="request"
type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="success" path="/admin/index.jsp" />
<forward name="failure" path="/index.jsp"></forward>
</action>
</action-mappings>
<message-resources parameter="com.chinamobile.struts.ApplicationResources" />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/beans.xml"/>
</plug-in>
</struts-config> bena.xml <bean name="/login" class="com.chinamobile.struts.action.LoginAction">
<property name="ioperator">
<ref bean="ioperatorimpl"/>
</property>
</bean>
2. beans.xml中, action bean应该用scope="prototype". 否则默认spring中的bean都是singleton的.
3. struts-config.xml中,加上parameter属性?
<action attribute="loginForm" input="/login.jsp"
name="loginForm" path="/login" scope="request" parameter="method"
type="org.springframework.web.struts.DelegatingActionProxy">
我的myeclipse6.0整合SSH怎么么都是不成功的啊,用myeclipse5.0就不问题,都是一模一样的整合,怎么就不行呢,别人的就行,我是这样整合的,帮我看看错在哪,它提示的是404错误, HTTP Status 404 - Servlet action is not available
The requested resource (Servlet action is not available) is not available. 我的 web.xml 是这样的 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>action </servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet </servlet-class>
<init-param>
<param-name>config </param-name>
<param-value>/WEB-INF/struts-config.xml </param-value>
</init-param>
<init-param>
<param-name>debug </param-name>
<param-value>3 </param-value>
</init-param>
<init-param>
<param-name>detail </param-name>
<param-value>3 </param-value>
</init-param>
<load-on-startup>0 </load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action </servlet-name>
<url-pattern>*.do </url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp </welcome-file>
</welcome-file-list>
</web-app>
jsp页面是这样的 test.jsp <%@ page language="java" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>test.jsp </title>
</head>
<body>
<form action="test.do" method="post">
login: <input type="test" name="login"> <br>
password: <input type="text" name="password"> <br>
<input type="submit">
</form>
</body>
</html> TestAction.java是这样的
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
TestForm testForm = (TestForm) form;// TODO Auto-generated method stub
return mapping.findForward("success");
} struts-config.xml是这样的 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<data-sources />
<form-beans>
<form-bean name="testForm" type="com.one.struts.form.TestForm" /></form-beans><global-exceptions />
<global-forwards />
<action-mappings>
<action attribute="testForm"
input="/test.jsp"
name="testForm"
path="/test"
scope="request"
parameter="method"
type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="success" path="/success.jsp" />
</action></action-mappings><message-resources parameter="com.one.struts.ApplicationResources" /><plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/beans.xml" />
</plug-in>
</struts-config>
beans.xml是这样的,省略了一部分数据源的配置
<bean name="/test" class="com.one.struts.action.TestAction"> </bean>
应该是这样整合吧,myeclipse5.0一点问题也没有.