JSP项目我使用struts1.2不能跳转到action!
我在action中打点,根本进不去,也没有错误提示!估计是哪里配置错了!!请高手帮忙解决!!谢谢web.xml<servlet><servlet-name>action<...
我在action中打点,根本进不去,也没有错误提示!估计是哪里配置错了!!请高手帮忙解决!!谢谢
web.xml
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
struts-config.xml
<action-mappings >
<action
parameter="op"
path="/index"
type="com.we.struts.action.IndexAction" />
</action-mappings>
index.jsp
<body>
<jsp:forward page="index.do?op=doAnLi"></jsp:forward>
</body>
IndexAction.java
public ActionForward doAnLi(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
return mapping.findForward("MyX.html");
}
都只发主要代码!!就是进不了 MyX.html 。 展开
web.xml
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
struts-config.xml
<action-mappings >
<action
parameter="op"
path="/index"
type="com.we.struts.action.IndexAction" />
</action-mappings>
index.jsp
<body>
<jsp:forward page="index.do?op=doAnLi"></jsp:forward>
</body>
IndexAction.java
public ActionForward doAnLi(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
return mapping.findForward("MyX.html");
}
都只发主要代码!!就是进不了 MyX.html 。 展开
4个回答
展开全部
第一,修改配置文件如下:
struts-config.xml
<action-mappings >
<action
parameter="op"
path="/index"
type="com.we.struts.action.IndexAction" />
<forward name="myok" path="/Myx.html" />//加的这句
</action-mappings>
第二,修改IndexAction.java如下:
public ActionForward doAnLi(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
return mapping.findForward("myok");//这个myok和我加在配置文件中对应
}
struts-config.xml
<action-mappings >
<action
parameter="op"
path="/index"
type="com.we.struts.action.IndexAction" />
<forward name="myok" path="/Myx.html" />//加的这句
</action-mappings>
第二,修改IndexAction.java如下:
public ActionForward doAnLi(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
return mapping.findForward("myok");//这个myok和我加在配置文件中对应
}
展开全部
<action-mappings >
<action
parameter="op"
path="/index"
type="com.we.struts.action.IndexAction" >
<forward name="unique" path="/ose_express/ya_manager/yes-asia.jsp?url=practice" />
</action>
</action-mappings>
<action
parameter="op"
path="/index"
type="com.we.struts.action.IndexAction" >
<forward name="unique" path="/ose_express/ya_manager/yes-asia.jsp?url=practice" />
</action>
</action-mappings>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你在action重写execute方法看下会进去哪个方法波!如果进去啦!说明你的配置没有错
在把return mapping.findForward("MyX.html");
改为:return new ActionForward("/MyX.html");
在把return mapping.findForward("MyX.html");
改为:return new ActionForward("/MyX.html");
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用strut2.0做跳转很简单。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询