Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

redirect="true" not working

 
Bartender
Posts: 1700
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1700
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!!!
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is NO attribute called redirect in action tag. It should be part of forward tag.
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!