aspose file tools*
The moose likes JSP and the fly likes display certain content to certain mobile devices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "display certain content to certain mobile devices" Watch "display certain content to certain mobile devices" New topic
Author

display certain content to certain mobile devices

Rebecca Ireland
Greenhorn

Joined: Jul 02, 2012
Posts: 2
Hi,

I am trying to display certain content to certain mobile devices, specifically displaying alternative content to iphone's as they cant play flash.

I am currently using the detectmobilebrowsers.com JSP code, to redirect my site from the full version to the mobile site, the code is as follows:



I was wondering if I could use this code somehow to target the different user-agents. I have had two attempts, but they havnt worked.

The first attempt:



The second attempt:



Can someone help me with the correct way to go about this?

Thanks in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61226
    
  66

Welcome to the Ranch.
Rebecca Ireland wrote:Can someone help me with the correct way to go about this?

Step 1: Scriptlets have been discredited for 10 years now. Read this JspFaq entry. You should not be putting Java code in a JSP in 2012.
Step 2: This isn't something you should be doing in a JSP to begin with. Either refactor the logic out into the page controller servlet, or put it in a filter. A JSP is not the place to be making this sort of decision.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rebecca Ireland
Greenhorn

Joined: Jul 02, 2012
Posts: 2
Bear Bibeault wrote:Welcome to the Ranch.
Rebecca Ireland wrote:Can someone help me with the correct way to go about this?

Step 1: Scriptlets have been discredited for 10 years now. Read this JspFaq entry. You should not be putting Java code in a JSP in 2012.
Step 2: This isn't something you should be doing in a JSP to begin with. Either refactor the logic out into the page controller servlet, or put it in a filter. A JSP is not the place to be making this sort of decision.


Hi Bear Bibeault,

Well the problem is I am not a Java developer, Im a front-end developer (mainly html, css, javascript), so I understand some jsp & jstl but am not fluent.

So I have little knowledge in how else to go about this otherwise.

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61226
    
  66

Is there no one on your team responsible for the Java code? Decisions on what to display should not be made in the component that's creating the display. That's putting the cart way ahead of the horse.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: display certain content to certain mobile devices