How to create multiple views of the same rack interface?

Basically, I create a site that will be accessible through the mobile and desktop. Therefore, I want to create 2 types.

My action code remains the same. Everything else is the same. Just jsp is changing for both. How can I do this through 1/2 racks?

+4
source share
2 answers

You can also do this by adding a third-party jar "deli.jar" and using your Profile, Workspace, etc. class to determine the type of mobile phone from which the url is requested. In the location, you can make the page viewed by the Mobile user by making it in xhtml, as shown below. <html:html xhtml="true"

But this will only be supported for mobile devices that have a browser with xhtml support.

Hope this helps you.

+4
source

You will need to pass a request parameter or something in the header that will distingush between the two requests. For example: http://yoursite.com/render.action?type=mobile .

Finally, in your action:

 if ("mobile".equals(type)){ return "mobile"; }else { return ActionSupport.SUCCESS; } 

Your racks have a new type of result

  <result name="success">/WEB-INF/jsp/somethign/web.jsp></result> <result name="success">/WEB-INF/jsp/somethign/mobile.jsp></result> 
0
source

All Articles