手艺人赵鹏

技术也是一门手艺

在myeclipse中实现struts2的登录例子

  在myeclipse中实现struts2的登录例子

  环境:myeclipse 6.0.1 GA

  jdk:myeclipse自带

  tomcat:6.0

  struts2:2.1.6

  过程:

  1、使用myeclipse建立web工程

  2、由于在struts2中使用过滤器调用action的机制,所以需要在web.xml中添加过滤器代码

  

  struts2

  

  org.apache.struts2.dispatcher.FilterDispatcher

  

  

  

  struts2

  /*

  

  3、将struts2的所需的jar拷到lib目录下

  commons-logging-1.1.jar

  freemarker-2.3.13.jar

  ognl-2.6.11.jar

  struts2-core-2.1.6.jar

  xwork-2.1.2.jar

  在许多教程中都写着,只要有以上5个jar包就可以了,但是我在使用中却不行,添加了commons-fileupload-1.2.1.jar这个jar包以后,才可以正确执行。

  4、在src建立struts.xml文件,

  

  http://struts.apache.org/dtds/struts-2.0.dtd

  

  

  

  /result.jsp

  

  

  

  5、建立LoginAction文件

  6、建立login.jsp和result.jsp文件

  7、发布





Leave a Reply