• Post Reply Bookmark Topic Watch Topic
  • New Topic

replacement tag for s:fragment in jsf 2.0  RSS feed

 
kishi kiran
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am using Seam 2.x and JSF 2.0, i am looking the replacement tag for <s:fragment>

example:

<s:fragment rendered = "#{((identity.loggedIn) and identity.hasRole('abc'))}> // render returns true/ false
<h:commandLink id = "dashBoard" value = "#{messages['menu.dashboard.header']}"
view = "/view/dashboard/dashBoard.seam" propagation = "begin">
</h:commandLink>
</s:fragment>

here fragment does whether the like should be enable or disable based on the condition.

Now i am removing seam in my application , I am looking for similar tag in jsf which will gives true/ false the.

Thanks
kiran.
 
Tim Holloway
Bartender
Posts: 18777
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, since you only have that one element in your example, I'd simply remove the s:fragment tag and move the "rendered" attribute to the commandLink tag.

For larger areas, the "h:panelGrid" is a good substitute for div-like areas. For non-rectangular areas, probably one of the facelets ui tags.

I would recommend simplifying your EL expression, however. Complex EL are a real pain to debug compared to simple properties backed by intelligence in a backing bean. Plus, you're putting logic in something that is supposed to be a template, which means that you're losing Separation of Concerns.

Besides, realistically, an "identity.hasRole" would usually only be able to return true if the user was logged in. Otherwise how would the user's role be known?
 
kishi kiran
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Tim

its working!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!