Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

STRUTS: Links within ActionErrors

Status
Not open for further replies.

Ngok

Programmer
Nov 15, 2004
4
CA
I am trying to display an html link that is inside an ActionErrors message.

Example:

In the Resources.properties I have something like this:
error.dynamic.generic = {0}

{0} will be replaced by a text + a html link. It will be like this for example:

"message link" which message is a text and link a href.

See this concret example:
"There is no message matching the specified criteria. Please clic <a href="/home.do">here</a>."


How can I code it inside an ActionsError? How would be "message"?

actionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.dynamic.generic", message));


Thanks
 
Message should just be a string. It will go into the {0} element.

You can also send an object of strings

Object[] costargs = {
string1,
string 2,
integer1,
integer2
};

That would fill in {0}-{3}
 
Is it possible that I could insert this href <A href="/Home.do">click here!!!</A> in the string that is going to be displayed?

What can I do if there is no way to put the href code in the resource propertie

For example, if I don't want to have the property like this
error.dynamic.generic = <A href="{0}">click here!!!</A>
but if I have only have this solution
error.dynamic.generic = {0}
with {0} = <A href="/Home.do">click here!!!</A>

How should I fill in the string variable? (using the href)


By the way, thanks for your answer. I used for another case.
 
Sure just create a string with your href, I am not sure what the problem you are encountering is

String href = "<A href=\"/Home.do\">click here!!!</A>";
 
I'm a bit stupid

I did "&lt;A href=&quot;/Home.do&quot;&gt;Click Here&lt;/A&gt;"
instead of
"<A href=\"/Home.do\">click here!!!</A>";

Thanks

I wanted to have the link, not the text like <a href="/home.do">here</a>." I had before
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top