user962206
user962206

Reputation: 16147

Struts2 Tag retrieve a Single fieldError as text only

How do I retrieve a single fielderror without any formatting?

I want just the plain text message without any formatting in a jsp is that possible?

This can be done in an action but how would I do this inside a jsp?

System.out.println(this.getFieldErrors().get("fileMissing"));

Upvotes: 5

Views: 2916

Answers (3)

Ankur Lathi
Ankur Lathi

Reputation: 7836

You can use <s:fielderror /> in your jsp like this:

<s:fielderror fieldName="fileMissing"/>

Upvotes: 3

KyelJmD
KyelJmD

Reputation: 4732

If you are using JSTL you can do this

<c:out value="${fieldErrors['passwordError']}"/>

and for struts tag, you can do this

<s:property value="fieldErrors['fileMissing']"/>

Upvotes: 4

Quaternion
Quaternion

Reputation: 10458

<s:property value="fieldErrors['fileMissing']"/>

Upvotes: 0

Related Questions