eclipse下配置struts2.docVIP

  • 3
  • 0
  • 约1.25千字
  • 约 3页
  • 2017-07-31 发布于河南
  • 举报
eclipse下配置struts2

配置struts2 在eclipse下配置struts2 1、导入struts所要用到jar包,导入WebContent/WEB-INF/lib目录下。以下为目录结构:基础结构包已经放在网盘上,下载地址 /s/125Gw0 2、在WebContent/WEB-INF目录下创建web.xml 内容为: ?xml version=1.0 encoding=UTF-8? web-app id=WebApp_9 version=2.4 xmlns=/xml/ns/j2ee xmlns:xsi=/2001/XMLSchema-instance xsi:schemaLocation=/xml/ns/j2ee /xml/ns/j2ee/web-app_2_4.xsd filter filter-namestruts2/filter-name filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter/filter-class /filter filter-mapping filter-namestruts2/filter-name url-pattern/*/url-pattern /filter-mapping /web-app 3、在项目目录下srccom.struts2.action,再创建一个类,命名为HelloWord.java。代码如下:package com.struts2.action; public class HelloWord { public String execute() throws Exception{ return success; } } 4、struts.xml进行配置?xml version=1.0 encoding=UTF-8? !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.3//EN /dtds/struts-2.3.dtd struts package name=struts2 extends=struts-default action name=HelloWord class=com.struts2.action.HelloWord result name=successHelloWord.jsp/result /action /package /struts 5、测试,输入:8080/SSH2/HelloWord.action 有什么不对的地方请指正

文档评论(0)

1亿VIP精品文档

相关文档