• 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

How can I optimize this for JSF?

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm trying to move my stuff into JSF. Being new, I figure there are a couple of optimizations I can make. How would I convert the below to JSF tags?

<% if (request.getAttribute("loginError") != null){%>
<span style="color:#FF0000">
<%= request.getAttribute("error") %>
</span>
<%}%>

Thanks, - Dave
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<h:panelGroup rendered="#{requestScope.loginError != null}">
<h:outputText value="#{requestScope.error}" style="color:#FF0000;"/>
</h:panelGroup>

I think this could work for you.


Originally posted by Dave Alvarado:
Hi,

I'm trying to move my stuff into JSF. Being new, I figure there are a couple of optimizations I can make. How would I convert the below to JSF tags?

<% if (request.getAttribute("loginError") != null){%>
<span style="color:#FF0000">
<%= request.getAttribute("error") %>
</span>
<%}%>

Thanks, - Dave

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or a more JSF-like way to do it would be to bind your loginError and error values into a backing bean in the faces-config and then use <h:messages /> and generate a message depending on whether or not loginError is null:
 
Those are the largest trousers in the world! Especially when next to this ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic