MyEclipse 中配置struts2.2.1的方法

东坡下载 2013年06月26日 00:42:01

      1,首先就是要建立一个web project项目

      2,设置jdk和servers路径,如果jdk和servers已经配置ok,跳过这一步骤。

      在菜单中的window选项中配置jdk和servers

      对于jdk,点击java-.>找到jre那个东西,然后输入你的jdk安装目录

      对于servers,点击myeclipse中的servers中的tomcat,一定记得要选择上面的enable

      然后,在找到你的安装地方

      3,配置struts

      一共要做四件事

      第一个

      首先就是在你的struts2解压的包中找到apps/struts2-blank-2.2.1.war/WEB-INF

      /classes/struts.xml复制到你的myeclipse项目中的src中,然后要进行修改

      第二件

      在刚才的那个目录下将其lib中的类库文件全部复制到你的myeclipse/lib种就行了。

      第三件

      在你的项目中从刚才的目录下的web-xml中复制下面东西到你的web-xml里

      <web-app id=WebApp_9 xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4" < p>

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

      http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

      Struts Blank

      struts2

      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

      struts2

      /*

      第四件

      修改你的struts2的配置文件也就是struts.xml,记得将其中的东西都删除或者注释

      "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

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

      /upload.jsp

      /upload

      /succ.jsp