wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts Errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Errors" Watch "Struts Errors" New topic
Author

Struts Errors

Prashant Medhekar
Greenhorn

Joined: Nov 17, 2009
Posts: 4
Hello Everyone,

I am using struts1.1

I have a String []headers={"value1","value2","value3"};
i am passing this array to ActionMessage as shown below:

errors.add("invalid partyHeaders", new ActionMessage("errors.ExcelParty.invalidHeaders",header))

Now in ApplicationResources.properties i have mapped the key to the below message"

errors.ExcelParty.invalidHeaders=InCorrect Column names' {0}' .

i want to display all the values in the array on message displayed on jsp
code in jsp:
<logic:messagesPresent>
<tr>
<td colspan="2">
<h4><font color="Red" >
<html:messages id="error">
<li><%=error %></li>
</html:messages>
</font></h4>
</td>
</tr>
</logic:messagesPresent>

if i write {0} only first value of array is displayed.

Can anyone suggest me a solution

Thanks
Prashant
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Pass in a single value containing the header names.
Prashant Medhekar
Greenhorn

Joined: Nov 17, 2009
Posts: 4
You mean to say i should write


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, I mean if your message is defined to show a single value, pass in a single value--like a string created by joining the header names separated by a comma or something.
Prashant Medhekar
Greenhorn

Joined: Nov 17, 2009
Posts: 4
Thanks David!!!. It worked.
but is there any way to pass array and substitute the values at runtime
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're already passing an array at runtime--what's different about passing a string?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Errors