Mobile User Interface for EAR
I have a Java EE ear project (ejb module + war). In the war I use JSF + prim开发者_开发百科efaces. Now I need to add a mobile user interface (using primefaces mobile). I have to create a new war, right? If that's so, I guess the 2 wars will have different URLs. Is there a way I can redirect a cellphone trying to access the URL with web interface to the URL with the mobile interface?
Thanks! Damian
PrimeFaces is just a taglib isn't it, with the components backing it in the JAR. So you should be able to use the same WAR and same FacesServlet irrespective of whether you are serving mobile pages or desktop pages i.e. PrimeFaces mobile and PrimeFaces should be able to co-exist in the same WAR AFAIK.
You can redirect to your mobile site based on the "User-Agent" http header. There are loads of examples about this on the Internet and some pre-existing code. So detect this and issue the redirect to your mobile site as neccessary e.g. mysite/mobile.
精彩评论