This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Struts Errors

 
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
 
Author
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
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
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
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?
 
    Bookmark Topic Watch Topic
  • New Topic