s2sh 搭建框架出现的问题啊??求助
我的配置文件如下:
//struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!--
<include file="com.ssh.struts.struts-user.xml"></include>
<constant name="struts.objectFactory" value="spring" />
-->
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
<package name="default" extends="struts-default" namespace="/login">
<action name="find" method="find" class="usersAction">
<result name="success" type="redirect">index.jsp</result>
<result name="failure" type="redirect">index.jsp</result>
</action>
</package>
</struts>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!--
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/com/ssh/spring/applicationContext-*.xml
</param-value>
</context-param>
-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:com/ssh/spring/applicationContext-*.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
//login/index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>login jsp</title>
</head>
<script language="javascript" type="text/javascript">
function isblank(){
var user=document.lname.username.value;
var pass=document.lname.password.value;
if(user==""){
alert(5555);
alert("用户名为空,请您从新输入!!");
document.lname.username.focus();
return false;
}
if(pass==""){
alert("密码为空");
document.lname.password.focus();
return false;
}
return true;
}
</script>
<body>
<s:form name="lname" action="/login/find" method="post" onsubmit="return isblank()">
<s:textfield label="用户名:" name="username" id="userid" tooltip="enter your name"></s:textfield>
<s:textfield label="密码:" name="password" id="passid" tooltip="enter your pass"></s:textfield>
<s:submit></s:submit>
</s:form>
</body>
</html>
applicationContext-resource.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!--配置数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"></property>
<property name="username" value="zhang"></property>
<property name="password" value="zhang"></property>
<property name="maxActive" value="100"></property>
<property name="maxIdle" value="30"></property>
<property name="maxWait" value="500"></property>
<property name="defaultAutoCommit" value="true"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.OracleDialect
</prop>
<prop key="show_sql">true</prop>
<!-- <prop key="hbm2ddl.auto">update</prop> -->
</props>
</property>
<property name="mappingResources">
<list>
<value>com/ssh/login/entity/Users.hbm.xml</value>
</list>
</property>
</bean>
</beans>
applicationContext-action.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="usersAction" class="com.ssh.login.action.UsersAction"
scope="prototype">
<property name="usersService">
<ref bean="usersService" />
</property>
</bean>
</beans>
applicationContext-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="usersService"
class="com.ssh.login.service.impl.UsersServiceImpl">
<property name="usersDao">
<ref bean="usersDao" />
</property>
</bean>
</beans>
applicationContext-dao.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="usersDao" class="com.ssh.login.dao.impl.UsersDaoImpl"
scope="singleton">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
</beans>
UsersAction.java
package com.ssh.login.action;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.ssh.login.service.UsersService;
public class UsersAction extends ActionSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
private UsersService usersService;
public String find(){
HttpServletRequest request=ServletActionContext.getRequest();
String username=request.getParameter("username");
String password=request.getParameter("password");
String result=this.usersService.find(username);
if(result.equals(password)){
return "success";
}else{
return "failure";
}
}
public UsersService getUsersService() {
return usersService;
}
public void setUsersService(UsersService usersService) {
this.usersService = usersService;
}
}
下面是我的工程结构图:
[解决办法]
提示找不到文件耶
[解决办法]