`
gordon20082008
  • 浏览: 25479 次
  • 性别: Icon_minigender_1
  • 来自: 合肥
社区版块
存档分类
最新评论

捣鼓ssh上手的例子---struts2+spring+hibernate3(一)

    博客分类:
  • SSH
阅读更多
log4j.properties

log4j.rootLogger=info,console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.SimpleLayout
log4j.logger.com.wehave=DEBUG

log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=info
log4j.logger.java.sql.PreparedStatement=info
log4j.logger.java.sql.ResultSet=info
log4j.logger.javax.sql=info


login.jsp
<%@ page language="java" pageEncoding="gb2312"%>
<%
	String path = request.getParameter("info");
	if(null==path)path="";
	else path="该用户名已经存在";
%>
<!-- 导入struts2标签库 -->
<%@taglib uri="/struts-tags" prefix="s"%>

<html> 
<head>
   <title>用户登录</title>
</head>
<body>
<center>

   <div id="login">
    <s:form action="loginAction">
    <%= path %>
     <s:textfield label="用户名" name="userName"></s:textfield>
     <s:password label="密码" name="userPassword"></s:password>
     <s:submit value="登录"></s:submit>
    </s:form>
   </div>

</center>
</body>
</html>


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/applicationContext.xml</param-value>
</context-param>

<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>login.jsp</welcome-file>
</welcome-file-list>

<listener>
<listener-class>
   org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

</web-app>


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics