Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

addActionError in struts2

 
gyanendra ojha
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic