Two Laptop Bag*
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
Author

addActionError in struts2

gyanendra ojha
Greenhorn

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
Greenhorn

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>
</s:iterator>
</span>
</div>
</s:if>
Adi Chandra Wijaya
Greenhorn

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>
</@s.iterator>
</div>

Thanks gyanendra ojha and Jeremy Conner.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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
 
Similar Threads
custom validator error message
struts 2 + how to redirect Page after Login validation
Struts 2: Custom display of error messages
how remove dot from error message
j_security_check - Invalid username or password message