• Post Reply Bookmark Topic Watch Topic
  • New Topic

easy use of css to show errors when using jsp:getProperty?  RSS feed

 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say you're using jsp:getProperty to auto-fill in form text inputs. What if you wanted to either change the label text's color or the background color of the input itself when you were returning the form to the user because of an error? I can think of ways to do this using scriptlets to check and see if the field we're about to add to the HTML was one of the incorrect ones and then change the CSS style accordingly, but it seems like those scriptlets could get messy. As an example, say I have this:




I suppose I could check before that HTML and see if the property was bad and, depending on that, output the appropriate class, but I'm wondering if anyone is using a more elegant solution...

Thanks for any tips!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way: define custom tags for your input elements that can take of all that for you behind the scenes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!