Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using logic:eual or logic present

 
ranjan panda
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a form bean which contains a arraylist and two field such as; firstName and lastName. Now if the user enter anything wrong in the jsp then i am adding that fiild name in to the arraylist inside the validate method.
ArrayList list = new ArrayList();
if (FastUtil.isEmpty(firstName)) {
errors.add("firstName", new ActionMessage("30001"));
fastForm.getInvalidFields();
list.add("firstName");
}
Now the requirement is inside the jsp i want to check whether that arraylist contains any specific field name or not which i am thinkig will be possible through logic:equal or logic:iterate. So that if I found any fiild name inside the arrraylist then i will change the CSS method name for highlighting the field.
Here i have to check
<input type="text" class="textfield" name="firstName" width=20
value="<bean:write property="firstName" name="dbSearchHomeForm"/>"></TD>

Please suggest how to check the arraylist and then chage the css method name accordingly.

Thanks.
Ranjan
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not very clear about the first part of the question about using ArrayList but why you do want to error messages in ArrayList and not in ActionErrors or ActionMessages? If you store your messages/errors in in the struts framework it will be lot easier as you have "messagePresent" struts logic tag which you can use to find out if the particular form element has error message or not and then change the style of the element approriately.

Search for logic: messagePresent on the web.
 
ranjan panda
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Purushothaman ,
Thank you for your reply. I objective is get the name of those field in the jsp for which the use has sumbitted invalid data and then change the CSS class method to highlight that. And for accessing those field names I want to use ArrayList which i have defined in the form bean.I am using ActionMessage to handle errors and there is absolutely no issues with thtat.
So can you help me ahead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic