• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Questions regard webpage logic construction & GET behaviour.

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody: I'm newbie with using JSF. I've two questions basically, by now:

First: How do I address logic with JSF at the web page? It means, making conditional decisions while rendering the output (if 'a satisties condition' render some, else render another one; i.e. Struts logic tags).

Second: How do I address a GET behavior?... as I understand, JSF does intensive using of POST behaviour, but I need basically to assemble my view depending on what variables are sent by the user (the classic '?secName=section1&var1=val1&var2=val2'), by putting there some components and no others depending on what the values of variables are, all in the same view (I looked book examples where authors does five+more pages for to present the same kind of data, what I consider simply annoying, as it converts into a static view what inherently needs to be dynamic) .

I would love to have two concrete examples about this. Thanks in advance .
 
Bartender
Posts: 1845
10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A conditional decision to render a component or not is done commonly with the "rendered" attribute.
If the expression for rendered evaluates to true, the component gets rendered. If not, it doesn't.
You can do it on a container object like a panelGroup to include/exclude sections of the page.

With regards to the second, I would create a bean to store those parameters in. The binding would go to that bean, and then you could render your view based on those bean properties.
However passing parameters around manually is not something that JSF does as far as I can tell. Paradigms that work well in other frameworks may not necessarily apply to JSF - and trying to force JSF to work that way is often detrimental.
In other words, don't try and force a square peg into a round hole.
 
Hugo Alberto Bedolla
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stefan Evans wrote:A conditional decision to render a component or not is done commonly with the "rendered" attribute.
If the expression for rendered evaluates to true, the component gets rendered. If not, it doesn't.
You can do it on a container object like a panelGroup to include/exclude sections of the page.

With regards to the second, I would create a bean to store those parameters in. The binding would go to that bean, and then you could render your view based on those bean properties.
However passing parameters around manually is not something that JSF does as far as I can tell. Paradigms that work well in other frameworks may not necessarily apply to JSF - and trying to force JSF to work that way is often detrimental.
In other words, don't try and force a square peg into a round hole.



Hi Stefan... regarding the first question I think your answer solves the issue for me :). Regard the second question I was a little confused yet but looking around I found I can attach any <f:param> tags to any <h:outputLink> tag which seems to be straightforward for to obtain that kind of behaviour, it by catching the parameters with a backing bean as you rightly wrote, while spreading to all any other components calls to boolean javabean methods that evaluates the rendering and what info to put into.

I found your answer very useful as it oriented my vision about the JSF approach. Thanks so much again for your feedback.



 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Hugo. Believe Stefan when he says that JSF does things differently. JSF usually passes stuff around in backing beans, not in parameters. For one thing, JSF is very big into postback operations, and - as many have discovered to their sorrow and frustration - the URL isn't necessarily a direct reflection of the View resource being rendered
 
No, tomorrow we rule the world! With this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic