当前位置: 代码迷 >> Java Web开发 >> jsp页面跳转问题?应该怎么写啊?
  详细解决方案

jsp页面跳转问题?应该怎么写啊?

热度:177   发布时间:2007-08-18 17:21:52.0
jsp页面跳转问题?应该怎么写啊?
request.getRequestDispatcher("/adminQueryPlate").forward(request,response);

红色的部分写的对不对啊?可不可以这样写:

request.getRequestDispatcher("adminQueryPlate.do").forward(request,response);

或是
request.getRequestDispatcher("adminQueryPlate").forward(request,response);

我用的是Eclipse开发工具

我想从一个Action类提交到另一个Action类,应该是上面的写法,可以我的程序为什么报404错误?

我的想法是: Action类到(通过什么方法跳转)Action类再到页面

我相应的配置文件如下:

<action path="/adminQueryPlate" type="com.yourcompany.struts.action.AdminQueryPlateAction">
<forward name="adminQueryPlateAll" path="/admin_5_1.jsp" />
</action>
应该怎么写才对啊?急

[此贴子已经被作者于2007-8-20 10:30:54编辑过]

搜索更多相关主题的帖子: jsp  页面  

----------------解决方案--------------------------------------------------------
在你的Action中有一个ActionMapping 吧
用那个对象 mapping.findForward("adminQueryPlateAll");
这样就可以跳到 admin_5_1.jsp了
----------------解决方案--------------------------------------------------------
404那就是找不到页面啊
----------------解决方案--------------------------------------------------------
我是想转到一个Action类,不是页面。难道是我表达的清楚?
----------------解决方案--------------------------------------------------------
request.getRequestDispatcher("/项目名称/adminQueryPlate").forward(request,response);
例如:
我的项目是:text1

request.getRequestDispatcher("/text1/adminQueryPlate").forward(request,response);

应该这样,我没有用过!!你试试!!

----------------解决方案--------------------------------------------------------
Gramary版主说得没错呀,mapping.findForward("adminQueryPlateAll");引号里的内容是你想跳转的ACTION的映射
----------------解决方案--------------------------------------------------------

或:
request.getRequestDispatcher("/项目名称/adminQueryPlate.do").forward(request,response);
例如:
我的项目是:text1

request.getRequestDispatcher("/text1/adminQueryPlate.do").forward(request,response);

应该这样,我没有用过!!你试试!!


----------------解决方案--------------------------------------------------------
j2ee2008:
` 你的方法不能通过,不行。

Gramary:
你的方法能跳转到,可是不能跳转到页面上与我写的一个效果(request.getRequestDispatcher("/adminQueryPlate").forward(request,response);唯一的不同就是Gramary的方法不报404错误,而我的报404
先声明一下,我的方法虽然报404错误,但也成功执行程序,也是没跳转
----------------解决方案--------------------------------------------------------

都不行?? 哪我在找找看!!


----------------解决方案--------------------------------------------------------

说也奇怪,连Action类都执行了,而且也正常,但就是不跳转,真是晕


----------------解决方案--------------------------------------------------------
  相关解决方案