How to use jsf "navigation-rule" for direct non .jsf pages ("to-view-id" is not .jsf)
I want to direct "from-outcome" to some BIRT report file (with .rptdesign extension) but it append extension as .jsf. My navigation rule is,
<!-- home.xhtml page -->
<navigation-rule>
<from-view-id>/home.xhtml</from-view-id>
<!-- navigate to group report -->
<navigation-case>
<from-outcome>GROUP_REPORT</from-outcome>
<to-view-id>frameset?__report=report/new_report_group.rptdesign&__overwrite=true&</to-view-id>
<redirect>
<view-param>
<name>Job Location</name>
<value>#{homeController.jobLocation}</value>
</view-param>
</redirect>
</navigation-case>
</navigation-rule>
Then I got result URL as, http://192.168.3.111:8080/imc-report-system-1.0/frameset开发者_JAVA百科?__report=report%2Fnew_report_group.jsf&Job%20Location=abc but it should be as, http://192.168.3.111:8080/imc-report-system-1.0/frameset?__report=report%2Fnew_report_group.rptdesign&Job%20Location=abc Thanks.
You can't navigate to a non-JSF-view by a JSF navigation case.
Redirect yourself using ExternalContext#redirect()
.
public void submit() {
// ...
String url = "frameset"
+ "?__report=report%2Fnew_report_group.rptdesign"
+ "&__overwrite=true"
+ "&Job%20Location=" + jobLocation;
FacesContext.getCurrentInstance().getExternalContext().redirect(url);
}
精彩评论