• 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

Dynamically Setting and Displaying Messages

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

I've run into a bit of a snag while trying to display messages to my users. On one page of my web application, I'm using a logic:iterate tag to iterate over a collection of objects and display the data in those objects to the user. This is working fine.

What I want to do is validate the user's input into this list of elements and, if there's a problem, display an error message back to the user near the element in question (as opposed to at the top of the page).

My validation procedure simply loops through all of the elements in the collection and checks each one for validity. I can use a simple counter to keep track of which element I'm on. So, for example, I have a line of code that looks similar to this (messages is of type ActionMessages):



So, for the first element in the collection, the ActionMessage should be set with the String "element[0]". The second will be set with element[1], and so on. This appears to be functioning properly - I've run my debugger through this and it seems correct.

Then, in my JSP page, I have a snippet that looks like this:



This should, in theory display the message for the first element in the collection for every element in the collection, which is obviously not what I'm after. Is there a way to set the messages.property attribute to be a real-time expression? If so, how do I do that? I want it to look something like this:



That, however, is not valid. Anyone know how to accomplish what I'm after?

Thanks,
Corey
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you try using a JSP expression?

 
reply
    Bookmark Topic Watch Topic
  • New Topic