Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display certain content to certain mobile devices

 
Rebecca Ireland
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rebecca Ireland
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic