JSF navigation - servlet parameters

I have an existing JSP based system which uses a 'controller' servlet to process my requests, e.g. 'controller?action=login' to display the login page and pad it out using request attributes.

When I make the login page into a jsf...

1. how do I make the jsf load via the servlet again when the login form fields fail validation after form is submitted. I.e. the login.jsp is called directly and not via 'controller?action=login' and so loses the attributes which it should have?

2. how do I make the jsf navigation 'to-view-id' include a parameter. For example; if login is successful I want to go to 'controller?action=myaccount'? I have the basic framework set up but this only navigates between the JSP pages and not from the 'via controller servlet' view.

In escence, I have;

<navigation-rule>

<from-view-id>/loginPage.jsp</from-view-id>

<navigation-case>

<from-outcome>success</from-outcome>

<to-view-id>/myAccountPage.jsp</to-view-id>

<redirect/>

</navigation-case>

<navigation-case>

<from-outcome>failure</from-outcome>

<to-view-id>/loginPage.jsp</to-view-id>

<redirect/>

</navigation-case>

</navigation-rule>

And I want something like;

<navigation-rule>

<from-view-id>/controller?action=login</from-view-id>

<navigation-case>

<from-outcome>success</from-outcome>

<to-view-id>/controller/action=myaccount</to-view-id>

<redirect/>

</navigation-case>

<navigation-case>

<from-outcome>failure</from-outcome>

<to-view-id>/controller?action=login</to-view-id>

<redirect/>

</navigation-case>

</navigation-rule>

Thanks for the help

[1957 byte] By [longaira] at [2007-11-27 8:45:34]
# 1

As to #1, if you return null from the action in your backing bean, JSF will re-render the existing view.

As to #2, you need to let go of the previous way of doing things a little bit. JSF does essentially provide a controller servlet; as far as which JSP to display, the navigiation-rules are the way to configure it. What you really want is something like:

<navigation-rule>

<from-view-id>/login.jsp</from-view-id>

<navigation-case>

<from-outcome>success</from-outcome>

<to-view-id>/myaccount.jsp</to-view-id>

<redirect/>

</navigation-case>

<navigation-case>

<from-outcome>failure</from-outcome>

<to-view-id>/login.jsp</to-view-id>

<redirect/>

</navigation-case>

</navigation-rule>

This tells the JSF system to render /myaccount.jsp if the backing bean action method returns "success", or render /login.jsp if the backing bean action returns "failure".

RaymondDeCampoa at 2007-7-12 20:46:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...