aspose file tools*
The moose likes Struts and the fly likes redirect= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "redirect="true" not working" Watch "redirect="true" not working" New topic
Author

redirect="true" not working

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
I'm getting the following error message when I have redirect="true" in struts-config.xml:

Status report

message /siteRoot/WEB-INF/jsp/testJSP.jsp

description The requested resource (/siteRoot/WEB-INF/jsp/testJSP.jsp) is not available.

If I remove the forward, I get the JSP's output on another page so clearly Struts is finding things.

---------------
The browser seems to be trying to access the correct file and the JSP file indeed seems to be in the right place.

Here's the part of the forward definition that seems to be problematic:

<forward
name="failure"
redirect="true"
path="/WEB-INF/jsp/testJSP.jsp"/>

Any ideas why this wouldn't work?

I shouldn't need to include "siteRoot" in the forward's path above, should I?

Thanks in advance for any help or suggestions.

-- Mike
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
When you "redirect" it informs the browser to go fetch a different page. Outside users do not have access to files located under WEB-INF. Instead of redirecting to a jsp page, you can redirect to an Action that will show that page.

- Brent
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1075
Thanks!!!
Nishita Jain
Ranch Hand

Joined: Mar 30, 2006
Posts: 97
hello,
i m little confuse here
by redirecting you want the atual pagename in url. am i write?
what i want is that when i login i want http://localhost:8080/TestMaster/testListing.jsp as my URL
but actually it gives me url like http://localhost:8080/TestMaster/Login.do

and i think redirect="true" can help me but how to do that?
Mike is asking the same for this reason?

<action path="/Login"type="com.indusa.testmaster.master.LoginAction"
validate="true"
input="/jsp/login.jsp"
name="LoginBean"
redirect="true"
scope="request" >
<forward name="student" path="/jsp/studentInformation.jsp" />
<forward name="success" path="/jsp/testListing.jsp" />
<forward name="failure" path="/jsp/login.jsp" />
</action>


Thanks
-Nishita


Nishita
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
There is NO attribute called redirect in action tag. It should be part of forward tag.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: redirect="true" not working