Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic