请教struts中的request问题!!!

dupontwh 2003-10-17 11:28:02
在action中用request.setAttribute("xxx",xxx),
在转入的jsp中可以直接用request.getAttribute("xxx),接收吗?这个request从那儿来呢?
为什么我从action转入jsp时,jsp中显示如下信息:
Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.

...全文
120 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
煜知搬砖者 2003-10-17
  • 打赏
  • 举报
回复
JSP中得request对象是系统提供的,你不用申明新的request对象,直接用就可以了。
你上面的错误不是request的错误,而是你的uri地址无效
chenyun430 2003-10-17
  • 打赏
  • 举报
回复
先保证你的action里面执行的没有问题,如果没有问题,然后再最好把action和struts-config的代码完整的帖出来看看
dupontwh 2003-10-17
  • 打赏
  • 举报
回复
楼上各位好,我刚才试了,还是不行,我把详细情况再说一遍把:

我在weblogic的安装目录的DefaultWebApp目录下,有一个main.jsp文件,另外在DefaultWebApp/plan目录下有一个plan_all.jsp。
在jbuilder中,我把左边窗口的<Default Web App>目录下的Root directory的值设为weblogic的安装目录的DefaultWebApp目录,
然后,我想
(1)从main.jsp进入action,再转入plan_all.jsp,
在action中我用了return actionMapping.findForward("month_plan_all");
在struts-config.xml中我定义了<forward name="month_plan_all" path="/plan/plan_all.jsp" />,
但是,转入plan_all.jsp的结果却是
Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.

或者是Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.


(2)从main.jsp直接转入plan_all.jsp,
如在main.jsp中是用<a href ="/plan/plan_all.jsp">正确呢?(即映射到weblogic的安装目录的DefaultWebApp目录)
还是用<a href ="./plan/plan_all.jsp">正确呢?(即用相对目录)
gao277 2003-10-17
  • 打赏
  • 举报
回复
request的用法在action中指定了,在页面上就能使用

你出现这个错误肯定是你指定的forward页面不存在导致的,把你的xml配置文件贴出来看看吧
wizard0128 2003-10-17
  • 打赏
  • 举报
回复
对,是这样的
show90 2003-10-17
  • 打赏
  • 举报
回复
JSP中得request对象是系统提供的,你不用申明新的request对象 直接用xxx

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧