This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes using logic:eual or logic present Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "using logic:eual or logic present" Watch "using logic:eual or logic present" New topic
Author

using logic:eual or logic present

ranjan panda
Greenhorn

Joined: Oct 03, 2005
Posts: 8
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

Joined: May 24, 2003
Posts: 425
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

Joined: Oct 03, 2005
Posts: 8
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.
 
jQuery in Action, 2nd edition
 
subject: using logic:eual or logic present