Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsf for mobile development  RSS feed

 
Ali Khalfan
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I'm trying to use JSF for mobile view (not an app, just something friendly on the browser)

I'm currently using mojarra 2.2.19 and the standard html and core library. I realize when using something like

the code looks good on desktop, but terrible on mobile

is there a better jsf implementation to use? or how should I approach this ?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Used to be that mobile device screens were about 320x240 pixels and you had to design interfaces specifically for them. These days, we have phones the size of drive-in movie screens and it's less of a concern. Then again, so many websites don't concern themselves with the fact that between them, their traffic-trackers, ad-blocker-blockers, pop-up loud animations, last-minute insertions/refreshes that cause the entire display to bounce around like a ping-pong match etc. etc. etc that the whole site is a torment to use.

There are 2 approaches to making a webapp mobile-friendly and they're basically the same whether using JSF or not. One is to define alternative screens, depending on the display capabilities of the client. You can then select which version of a screen to present using JSF's View Navigation services.

The other is to strategically lay out the page using CSS so that it can adapt to different client displays. Key strategies for doing this are things like using relative positioning rather than absolute metrics (whether in pixels, cm, or inches). Also useful is to use flexible layout controls to allow for "packing". You can see this capability in action in the lowly HTML <TABLE> tag, where, if the table doesn't fit the display horizontally, it will attempt to re-arrange cell contents vertically. You can fine-tune stuff like this using things like CSS min-width and max-width attributes.

JSF is actually very good for stuff like this, although technically, it's not JSF that makes it good. What makes it good is that JSF doesn't attempt to do much control of the appearance of the page, but rather offloads that burden onto CSS. So if you're good with CSS, you can be good with JSF.
 
Uwe Lindenberg
Ranch Hand
Posts: 40
2
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

what about using different renderers?

Maybe I am wrong, but I think this is one reason why they are existing?

Best regards and thank you,

Uwe
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF's plug-in renderer mechanism is designed to be the driver for view templates, so you'd have a set of renderers for HTML, a set for WAP, a set for PDF interactive forms-over-the-Internet or whatever.

You wouldn't use it to do variations on a single display protocol. It would inter-mix fine details about the UI with the general driver for the UI.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!