当前位置: 代码迷 >> J2EE >> s2sh 搭建框架出现的有关问题啊
  详细解决方案

s2sh 搭建框架出现的有关问题啊

热度:574   发布时间:2016-04-22 02:40:19.0
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()">
   
  相关解决方案