日期:2014-05-18  浏览次数:20619 次

struts中如何跳转到不同目录的jsp页面,请高手帮忙
struts中如何跳转到不同目录的jsp页面,请高手帮忙

------解决方案--------------------
问题不是特别懂.

不过我按我的理解回答:

这个是配置文件里写的
<action
path = "/访问名 "
type = "处理的ACTION "
scope = "request ">
<forward name = "返回1 " path = "/路径1/页面1 "/>
<forward name = "返回2 " path = "/路径2/页面2 "/>
</action>
这个是ACTION里写的
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
if(条件1)
return mapping.findForward( "返回1 ");
else
return mapping.findForward( "返回2 ");
}

基本就这个意思了.
------解决方案--------------------
我大概知道你的问题了.
你在前面加上
<%
String path = request.getContextPath();
String basePath = request.getScheme()+ ":// "+request.getServerName()+ ": "+request.getServerPort()+path+ "/ ";
%>
在html的head里加上
<base href= " <%=basePath%> ">