GeeCON Prague 2014*
The moose likes Struts and the fly likes How to get errors in doStart() tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to get errors in doStart() tag " Watch "How to get errors in doStart() tag " New topic
Author

How to get errors in doStart() tag

avi paul
Greenhorn

Joined: Apr 20, 2009
Posts: 2
I have overloded TextTag so that it can show a alert.gif beside the text box whoes validation fails , but even though errors are present the RequestUtils.getActionErrors() is not fetching the code is below ,can anybody tell me what is wrong. the System.out.println("errors"+errors.size()+errors.i sEmpty()); is printing 0.

I am trying to display as shown in the attachment
public int doStartTag() throws JspException {
int returnValue = super.doStartTag();
ActionErrors errors = RequestUtils.getActionErrors(pageContext,
this.property);

System.out.println("errors"+errors.size()+errors.i sEmpty());
if ((errors != null) && (!errors.isEmpty())) {
String imageSrc = RequestUtils.message(pageContext, getBundle(),
getLocale(), this.errorImageKey);
if (imageSrc != null) {
StringBuffer imageResults = new StringBuffer();
imageResults.append("<img src=\"");
imageResults.append(imageSrc);
imageResults.append("\"");
// Print the image to the output writer
ResponseUtils.write(pageContext, imageResults.toString());
}
}
return returnValue;
}


[Thumbnail for required.jpg]

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why not just extend/modify the theme you're using? Much easier.
avi paul
Greenhorn

Joined: Apr 20, 2009
Posts: 2
David Newton wrote:Why not just extend/modify the theme you're using? Much easier.

can you please be more elaborate on it , what dose it mean when you said "theme"
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://struts.apache.org/2.x/docs/themes-and-templates.html
 
Don't get me started about those stupid light bulbs.
 
subject: How to get errors in doStart() tag