Java jetty+struts 2:如何将操作添加到映射自命名空间[]中?
我在网上搜索了一段时间,没有找到我问题的答案。欢迎有任何见解 我按照的说明进行了操作,可以在访问servlet 现在我想让hello_world下的servlet可以通过直接访问。我对struts.xml做了如下更改:Java jetty+struts 2:如何将操作添加到映射自命名空间[]中?,java,spring,jsp,struts2,action-mapping,Java,Spring,Jsp,Struts2,Action Mapping,我在网上搜索了一段时间,没有找到我问题的答案。欢迎有任何见解 我按照的说明进行了操作,可以在访问servlet 现在我想让hello_world下的servlet可以通过直接访问。我对struts.xml做了如下更改: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts C
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="false" />
<package name="basicstruts2" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="helloworld.action.HelloWorldAction" method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Hello World Struts 2</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<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>
</web-app>
我使用Jetty 8.1.15作为集装箱 您无法访问http://myhost.net:8080 因为您尚未将操作映射到此url。更改您的配置
<action name="">
<result>/index.jsp</result>
</action>
<action name="">
<result>/index.jsp</result>
</action>