wood burning stoves
The moose likes Struts and the fly likes addActionError in struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "addActionError in struts2" Watch "addActionError in struts2" New topic

addActionError in struts2

gyanendra ojha

Joined: May 16, 2007
Posts: 11
hi all,
i am using addActionError("invalid user or paasowrd")in a action
class to display error message on a jsp page with <s:actionerror/>
on jsp page.
the message displays on jsp page on error starting with a DOT (.)
like ----> .invalid user or paasowrd
is it any way to remove this DOT (.) before the error message
(invalid user or paasowrd).

please, anyone tell me how this can be done?
Thanks in advance.
Jeremy Conner

Joined: Aug 07, 2008
Posts: 1
If you don't mind bypassing <s:actionerror/>, you can manually iterate through the errors and format them any way you like:

<s:if test="hasActionErrors()">
<div id="errorDiv" style="padding-left: 10px; margin-bottom: 5px">
<span class="error">
<s:iterator value="actionErrors">
<span class="errorMessage"><s roperty escape="false" /></span>
Adi Chandra Wijaya

Joined: Nov 18, 2009
Posts: 1
Yes Jeremy, this works

with more simple lines as below :

<div class="ErrorText">
<@s.iterator value="actionErrors">
<span><@s.property escape="false" /></span>

Thanks gyanendra ojha and Jeremy Conner.
Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

You should Use Code Tags when you post a source code. This makes the code look good, easy to read and there won't be any emoticons in your code . You can edit your message using button and then add code tags to it...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link: http://aspose.com/file-tools
subject: addActionError in struts2
jQuery in Action, 3rd edition