• Post Reply Bookmark Topic Watch Topic
  • New Topic

A simpler way to write this?  RSS feed

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using JSF (MyFaces 1.2 implementation). I am trying to clean up some code. How would I turn this into nice, elegant JSF:

<% if (request.getAttribute("loginError") != null){%>
<FONT COLOR="#FF0000">
<%= request.getAttribute("loginError") %>
</FONT>
<%}%>

? Thanks, - Dave
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like this works, I believe. It may be incorrect in some details, however.



Return the name of a CSS style from mybean's getLoginStatusClass() method - one name for not logged in, another for logged in.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I appreciate your response. How would you adjust your code to deal with the "request.getAttribute" method? Also, how does your code deal with the conditional situation where we only output the message if the particular request attribute is not null?

Thanks, - Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!