-
1. Re: jsf navigation from one outcome to diff viewId
sivaprasad9394 Oct 5, 2010 11:37 PM (in response to elenaveretilo)while returning from bean check if mobile means return like "mobileclientadmin" and suppose if it is desktop means return like "desktopclentadmin".
public String urMethodName()//add ur method name as per ur wish
{
String action = null;
Boolean isMobileBrowser = (Boolean) session.getAttribute("isMobileBrowser");
if (isMobileBrowser == null) {
Enumeration e = req.getHeaders("user-agent");
while(e.hasMoreElements()) {
String str = e.nextElement().toString().toLowerCase();
if (str.indexOf("mobile") != -1) {
isMobileBrowser = new Boolean(true);
System.out.println("MOBILE BROWSER");
action="mobileclientadmin";
} else {
isMobileBrowser = new Boolean(false);
System.out.println("STANDARD BROWSER");
action="desktopclentadmin";
}
session.setAttribute("isMobileBrowser", isMobileBrowser);
}
return action;
}
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>mobileclientadmin</from-outcome>
// if mobile
<to-view-id>/html/mobile/clientadmin.jsf</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>desktopclentadmin</from-outcome>
// if desktop
<to-view-id>/html/clientadmin.jsf</to-view-id>
</navigation-case>
</navigation-rule>
public String urMethodName()//add ur method name as per ur wish{String action = null;Boolean isMobileBrowser = (Boolean) session.getAttribute("isMobileBrowser");if (isMobileBrowser == null) {Enumeration e = req.getHeaders("user-agent");while(e.hasMoreElements()) {String str = e.nextElement().toString().toLowerCase();if (str.indexOf("mobile") != -1) {isMobileBrowser = new Boolean(true);System.out.println("MOBILE BROWSER");action="mobileclientadmin";} else {isMobileBrowser = new Boolean(false);System.out.println("STANDARD BROWSER");action="desktopclentadmin";}session.setAttribute("isMobileBrowser", isMobileBrowser);}return action;}