File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Help,Invalid path /jsp/viewinfo was requested? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help,Invalid path /jsp/viewinfo was requested?" Watch "Help,Invalid path /jsp/viewinfo was requested?" New topic

Help,Invalid path /jsp/viewinfo was requested?

lyo Yashnoo
Ranch Hand

Joined: Sep 15, 2003
Posts: 50
Hi everyone :
I write a jsp page using struts.In jsp,I write:"<a href="<bean:write name="categ" property="category"/>&id=<bean:write name="map" property="id"/>"/><bean:write name="map" property="name"/></a>"
I use this code to get tow parameter.When I move mouse to the hyperlink the statusbar display:"http://localhost:3030/myweb/jsp/".It's right.But when I click it Tomcat report error:
HTTP Status 400 - Invalid path /jsp/viewinfo was requested
type Status report
message Invalid path /jsp/viewinfo was requested
description The request sent by the client was syntactically incorrect (Invalid path /jsp/viewinfo was requested).

In my struts-config.xml there is action for the request indeed.
<action path="/viewinfo" type="" input="filemiss.jsp">
<forward name="success" path="/jsp/viewinfo.jsp"/>
Even I add the "<forward name="viewinfo" path="/"/>" it can't work too. :roll:

Finally,I change the jsp code to ":"<a href="myweb/jsp/<bean:write name="categ" property="category"/>&id=<bean:write name="map" property="id"/>"/><bean:write name="map" property="name"/></a>"
It also can't work property and the error is the same as before.
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
From the looks of it, your webapp root is /myweb, and the action is mapped to /viewinfo, so the link should point to /myweb/ not to /myweb/jsp/ You could achieve this with minimal change:I would strongly discourage this though. The problem is that this URL is relative to the request path. In an MVC application, your JSP should not make assumptions about the request path: after all, the Struts configuration file can map all manner of requests to your JSP. Making assumptions about the path introduces hidden dependencies that will come back to haunt you sooner or later.
You need an absolute path. Sticking in one by hand:Is bad practice as well, because you unnecessarily hardcode where the web-app root is going to be. Use the link tag instead:If putting name and category in a Map is too much trouble, then you can use <html:rewrite>:Both the link and rewrite tags will prepend the path you give by the web-app root path, and also add the .do suffix (or whatever extension you have mapped to the Struts ActionServlet).
- Peter
[ October 11, 2003: Message edited by: Peter den Haan ]
I agree. Here's the link:
subject: Help,Invalid path /jsp/viewinfo was requested?
It's not a secret anymore!