• 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

Displaying struts errors

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

I have a jsp page that has an action class which talks to a form bean which does the validation for my page and returns ActionErrors object. I want to display the errors in my jsp page all in one location after a few lines of text.

For instance suppose my html were like this:

<%@ include file="../../common/include/ZdUserDetails.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<html:html locale="true">
head>
<title>ZeroDegrees</title>
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8" />
<html:form method="post" action="/register" name="registerForm" type="com.zerodegrees.struts.forms.auth.RegisterFormBean">
<div align="center">
<table cellspacing="0" cellpadding="1" width="776" summary="" bgcolor="#2D81B5" border="0">
<tbody>
<tr>
<td height="59"><img alt="" height="69" src="<%=sitePath%>/cobrand/<%=strCoBrandId%>/images/header.gif" width="774" usemap="#header_map" border="0" /></td>
</tr>
</tbody>
</table>
</div>
<table cellspacing="0" cellpadding="0" width="775" align="center" summary="" border="0">
<tbody>
<tr>
<td bgcolor="#003366"><img alt="" height="1" src="" width="1" /></td>
<td class="clbgwhite" valign="top" bgcolor="#FFFFFF">
<span></span>
<table cellspacing="0" cellpadding="10" width="750" border="0" summary="" align="center">
<tbody>
<tr>
<td width="1003" bgcolor="#ffffff" height="2"><b>xxxxxxxxxxxxxx<br />
<br /> </b> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
br /><br />
Already a member? Click <a href="#">here</a> to login.
</td>
</tr>
</tbody>
</table>

After the above table i want to print all the errors that have been raised in the page. Ideally i am planning on something like:

<logic:messagesPresent>
<iterator> ----- iterate through all the messages and display it
</iterator>
</logic:messagesPresent>

Is this possible. Or am i doing it the hard way?

Thanks
 
charu latha
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok i got that done.

Thanks
 
Run away! Run away! Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic