我用netbeans配置struts2
首先 我下载了所有jar 并且引入
新建web.xml 在 WEB-INF:http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"><display-name>Basic Strust 2 Project setup on Glassfish 3.0.1</display-name><filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter><filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
然后我新建了 struts.xml在 WEB-INF:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"/WEB-INF/classes/struts-2.1.7.dtd"><struts>
<!--
You could also set the constatnts in the struts.properties file
placed in the same directory as struts.xml
-->
<constant name="struts.devMode" value="true" /> <package name="test" extends="struts-default" namespace="/"> <!--
If no class attribute is specified the framework will assume success and
render the result index.jsp
If no name value for the result node is specified the success value is the default
-->
<action name="help">
<result>/help.jsp</result>
</action> </package></struts>
然后我根目录新建了个help.jspAlso, I built the action class help:import com.opensymphony.xwork2.ActionSupport;public class help extends ActionSupport{
@Override
public String execute() throws Exception {
return SUCCESS;
}
}
我觉得现在我不需要这个因为我只是想看看router怎么工作但是我运行时候 出现这个错误 HTTP Status 404 - There is no Action mapped for namespace [/] and action name [help] associated with context path [/131X].
首先 我下载了所有jar 并且引入
新建web.xml 在 WEB-INF:http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"><display-name>Basic Strust 2 Project setup on Glassfish 3.0.1</display-name><filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter><filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
然后我新建了 struts.xml在 WEB-INF:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"/WEB-INF/classes/struts-2.1.7.dtd"><struts>
<!--
You could also set the constatnts in the struts.properties file
placed in the same directory as struts.xml
-->
<constant name="struts.devMode" value="true" /> <package name="test" extends="struts-default" namespace="/"> <!--
If no class attribute is specified the framework will assume success and
render the result index.jsp
If no name value for the result node is specified the success value is the default
-->
<action name="help">
<result>/help.jsp</result>
</action> </package></struts>
然后我根目录新建了个help.jspAlso, I built the action class help:import com.opensymphony.xwork2.ActionSupport;public class help extends ActionSupport{
@Override
public String execute() throws Exception {
return SUCCESS;
}
}
我觉得现在我不需要这个因为我只是想看看router怎么工作但是我运行时候 出现这个错误 HTTP Status 404 - There is no Action mapped for namespace [/] and action name [help] associated with context path [/131X].
解决方案 »
- MyEclipse创建的JSP、Servlet的版本??
- 鼠标悬停后,如何才能在鼠标悬停位置右下方弹出个装有N个链接的框。求代码啊。。急。。。
- 关于tomcat的reloadable问题
- 一个很简单的问题!!!
- jxl如何实现在同一个cell里写入两种不同format风格的字符串
- 程序连接运行时提示数据库连接失败
- 关于HTML也面的一个问题。
- 在向form中提交参数的同时,如何向action中传参数?
- 锁概念
- mybatis 3.2.5 insert into
- ie9 showModalDialog 点弹出按钮导致页面死掉,ie8则没有问题,不知道是怎么回事
- 用Xfire做文件服务器,速进,好吗?
<result>/help.jsp</result>
</action>径,
具体项目实例可以参考我的博客,基于spring,security,struts开源