WEB开发网
开发学院软件开发Java SSH笔记四 整合struts2 阅读

SSH笔记四 整合struts2

 2009-09-23 00:00:00 来源:WEB开发网   
核心提示: ssim-user.xml<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xml

ssim-user.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="userManager" class="net.selitech.ssim.user.UserManager">
        <property name="ssimUserDAO">
            <ref bean="SsimUserDAO" />
        </property>
    </bean>
    <bean id="userAction" class="net.selitech.ssim.web.user.UserAction">
        <property name="userManager">
            <ref bean="userManager"/>
        </property>
    </bean>
</beans>

7. 添加login.jsp和 welcome.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>SSIM</title>
    
    <SCRIPT language=javascript>
    function check() {
        var s = "";
        var n = document.getElementById("user.userEmail").value ? null : s+= "用户名不能为空\n";
        var p = document.getElementById("user.userPassword").value ? null : s+="密码不能为空\n";    
        if(n || p){
            alert(s);
            return false;
        }else{
            document.userLoginForm.submit();
        }
    }
</SCRIPT>
  </head>
  
  <body>
  <form name="userLoginForm" action="<%=path %>/user/login.action" method=post>
  <table>
  <tr>
  <td>用户名:<input id="user.userEmail" type="text" name="user.userEmail" size="15"/></td></tr>
  <tr><td>密  码:<input id="user.userPassword" type="password" name="user.userPassword" size="16"/></td></tr>
  <tr><td><input type="submit" value="登录" /></td></tr>
  </table>
   
   </form>
  </body>
</html>

welcome.jsp

<html>
<body>
<h2>登录成功</h2>
</body>
</html>

如果你输入邮箱和密码,点击登录看到“登录成功”,那么恭喜你

上一页  1 2 3 4 5 

Tags:SSH 笔记 整合

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接