I'd also love to see an answer for this. Having same scenario.
Here is the scenario I have:
Code:
<!-- Maps request URIs to controllers -->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<value>
/myurl.htm=myURLController
</value>
</property>
</bean>
The myURLController is a @Controller which loads a xhtml view that has a JSF form on it
Code:
WebContent
/WEB-INF/my/path/myPage.xhtml
Code:
@Controller
public class MyController {
@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleGet(HttpServletRequest request, ModelMap model) throws Exception {
// Do some stuff here
ModelAndView modelAndView = new ModelAndView(new InternalResourceView("/WEB-INF/my/path/myPage.xhtml"), model);
return modelAndView;
}
}
The xhtml file looks something like this...
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
template="../../template/template_withoutmenu.xhtml">
<ui:define name="content">
<!-- Some static content and standard HTML Tags here.... -->
<h:form id="rform">
<!-- Some input fields here -->
<h:commandButton id="go" type="submit" action="doIt" title="Go" />
<h:commandButton id="cancelPassword" action="cancel" title="Cancel" />
</h:form>
</ui:define>
</ui:composition>
So all this works fine and the xhtml page loads. Now the problem is that JSF form adds in its own action that apparently cannot be overridden so the action is always /my/path/myPage.xhtml (in HTML view source)
So I read up that I can use JSF navigation.. I added the following to faces-config.xml
Code:
<navigation-rule>
<navigation-case>
<from-outcome>doIt</from-outcome>
<to-view-id>/doItPage.htm</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>cancel</from-outcome>
<to-view-id>/cancelPage.htm</to-view-id>
</navigation-case>
</navigation-rule>
But this does not seem to do anything... any ideas?
I also realize I'm missing the <from-view-id>xxxxxxx</from-view-id> tag.. but what would that be? Would it be the htm url or the xhtml url???