Search code examples
javajspstruts2strutsweblogic

Redirect to Mobile pages in Struts


I have an existing web app which uses Struts for the forward-action...

I am trying to create a mobile version (mainly the UI design will be different) of this existing web app.

Now this app is using Struts 2 for the forward-action thing..

My question is can I extend this Struts XML to redirect based on desktop/mobile.. e.g. Let's say I have desktop.jsp and mobile.jsp...Now I detect where the user is coming from at a server level and have that info in the session..Can I update my stuts-config XML such that the only thing I need to change would be the "forward" JSP URL based on where the user is coming from? I am looking at no change to the Action...only the forward URL for the JSP.

Please note that this question is not about "how to detect", but more about what approach to take once we have detected the browser and have that info from the server..

Thank you.


Solution

  • Better option is always to add a Filter here . and rest how to detect you know it.

    Track all the request check for the header to find out if its coming from mobile ? and serve request according to it.