<package name="login" namespace="/" extends="struts-default">
<action name="loginAction" class="com.trojan.lebronye.action.LoginAction">
<result name="login1">/foreground/index.jsp</result>
<result name="login2">/background/index.jsp</result>
<result name="loginfail">/loginfail.jsp</result>
<result name="error">/error.jsp</result>
</action>
</package>我的登录页面和foreground,background文件夹在同一个页面下~~我的struts2配置怎么写才能跳转到foreground或background下的另一个页面呢?

解决方案 »

  1.   

    就是路径问题~~login在foreground文件外面~~action的路径怎么写能够跳进foreground文件夹里面的页面~~~我是根据登录的角色不同跳转到不同的文件夹下的页面
      

  2.   

    写个相对路径不就可以了吗
    你文件夹foreground如果在webRoot下/foreground/index.jsp
    如果不是/***/.../foreground/index.jsp这样写不行吗
      

  3.   

    try 
      <result name="login1">./foreground/index.jsp</result>
      

  4.   

    <result name="login1">foreground/index.jsp</result>
    <result name="login2">background/index.jsp</result>试试这个
      

  5.   

    我觉得是这样的= =!~~~可惜不知道为什么我的跳不到,,,,她好像又跳回webRoot下的index.jsp那样子...可是我的路劲写的是foredround下的index.jsp吖....
      

  6.   

    就是路径问题~~login在foreground文件外面~~action的路径怎么写能够跳进foreground文件夹里面的页面~~~我是根据登录的角色不同跳转到不同的文件夹下的页面
    你可以在业务逻辑里面写啊 execute方法里面
      

  7.   

    什么意思?区分我已经写了~~就是跳转不行...是不是struts2跳不到其它文件夹的???
      

  8.   

    大哥 麻烦你把意思表达清楚 我才好帮你 foreground,background文件夹在同一个页面下是什么意思啊。还有就是你是跳不到指定页面还是什么啊 
    关注Java
      

  9.   

    她没有报404,,,,她就是没有跳到result指定的页面/foreground/index.jsp,,,她跳到另一个和login同目录下的index.jsp
      

  10.   

    把  namespace="/" 去掉试试。
      

  11.   

    还是不行吖- -!~~~究竟struts2能不能跳转到别的文件中的页面的??
      

  12.   

    楼主可以设置namespace="/foreground"
      

  13.   

    s2返回的时候。指定一下就行了
    return "login1"; 
      

  14.   

    <action name="foreground" class="..." method="forreground">
    <result name="success" type="redirect">/foreground.jsp</result>
    </action>在jsp页面中只要把路径写对就可以了<s:form action="foreground">
    ......
    </s:form>
      

  15.   

    能截图给大家看嘛 你的JSP文件放WEB-INFO下吗