Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why isn't redirct working?  RSS feed

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • 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
 
Andres Quinones
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Anu Sri
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

use

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!