Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Errors

 
Prashant Medhekar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pass in a single value containing the header names.
 
Prashant Medhekar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean to say i should write


 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David!!!. It worked.
but is there any way to pass array and substitute the values at runtime
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're already passing an array at runtime--what's different about passing a string?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic