Win a copy of Rust Web Development this week in the Other Languages 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Why isn't redirct working?

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to set up a redirct in my faces-config.xml file but it's not redirecting and I can't figure out why. I have these files ..

/myapp/jsp/AddApplication.jsp
/myapp/WEB-INF/classes/com/comcast/npsconfig/jsf/controllers/AddApplicationPage.class

and within AddApplication.jsp I have

<h:form id="appEditForm" target="_top">
...
</h:form>

Here are the relevant definitions in my faces-config.xml file:

<managed-bean>
<managed-bean-name>AddApplicationPage</managed-bean-name>
<managed-bean-class>com.comcast.npsconfig.jsf.controllers.AddApplicationPage</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<display-name>jsp/AddApplication</display-name>
<from-view-id>/jsp/AddApplication.jsf</from-view-id>
<navigation-case>
<from-action>#{AddApplicationPage.saveApplication}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/jsp/main.jsf#addApp</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>


Any ideas why I'm not being redirected to "main.jsf"? I've confirmed that the bean is outputting a "success" message. - Dave
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dane I think that the problem is that the file /jsp/main.jsf doesn't exist what you need to reference is /jsp/main.jsp, also /jsp/AddApplication.jsf should be /jsp/AddApplication.jsp if your pages are jsp otherwise there should be your real file extension and not the mapping. For what are you using #addApp??
[ July 24, 2008: Message edited by: Andres Quinones ]
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for this. All this JSF/JSP extension stuff is definitely confusing. I tried this new navigation rule, but it still doesn't redirect:

<navigation-rule>
<display-name>jsp/AddApplication</display-name>
<from-view-id>jsp/AddApplication.jsp</from-view-id>
<navigation-case>
<from-action>#{AddApplicationPage.saveApplication}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/jsp/main.jsp#addApp</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>

Any other insights are much appreciated, - Dave
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

use

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. That worked in as far as I'm redirected to my main page now. But I have yet another question. I'm trying to pass a parameter to main.jsp ...

<navigation-rule>
<display-name>jsp/AddApplication</display-name>
<from-view-id>/jsp/AddApplication.jsp</from-view-id>
<navigation-case>
<from-action>#{AddApplicationPage.saveApplication}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/jsp/main.jsp?i=1</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>


But it seems that the "?i=1" portion of the URL is getting dropped. Any way to preserve that?

- Dave
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic