aspose file tools*
The moose likes Struts and the fly likes Struts-JSP: Using for loop to retrieve Message resources that are in an array 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-JSP: Using for loop to retrieve Message resources that are in an array" Watch "Struts-JSP: Using for loop to retrieve Message resources that are in an array" New topic
Author

Struts-JSP: Using for loop to retrieve Message resources that are in an array

George Kandalepas
Greenhorn

Joined: Aug 18, 2004
Posts: 2
Hello, I'm a struts newbie...

I am trying to create a JSP used as an exam page. There are 20 different exams, all with th same format (15 multiple choice questions, a-d)

I am putting the questions in a resource.properties file but I am having a hard time referencing the resource file. The following is a for loop I am trying to use to retrieve the messages but I cannot cacatenate the index to the bean:message:

<% for(int index=0;index<5;index++){ %>
<td><html:radio property="testQuest01" value="a">
<bean:message key="app.quest1.option[+index+]" /></html:radio></td>
<% } %>

ApplicationResources.properties example:

app.quest1.option[0]=a. The length...
app.quest1.option[1]=b. Number of ...
app.quest1.option[2]=c. Minimum of ...
app.quest1.option[3]=d. Maximum ...
app.quest1.option[4]=e. b & c

Does anyone have any suggestions,

I would appreciate any help.

Also if I were to use <c:forEach...> or <logic:iterate> how would the syntax go?

Thank you.

GK

Sorry about that!
[ August 18, 2004: Message edited by: George Kandalepas ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Hi George, let me move this thread to the Web Applications Framework forum which handles questions about Struts.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
George Kandalepas
Greenhorn

Joined: Aug 18, 2004
Posts: 2
Originally posted by George Kandalepas:
Hello, I'm a struts newbie...

I am trying to create a JSP used as an exam page. There are 20 different exams, all with th same format (15 multiple choice questions, a-d)

I am putting the questions in a resource.properties file but I am having a hard time referencing the resource file. The following is a for loop I am trying to use to retrieve the messages but I cannot cacatenate the index to the bean:message:

<% for(int index=0;index<5;index++){ %>
<td><html:radio property="testQuest01" value="a">
<bean:message key="app.quest1.option[+index+]" /></html:radio></td>
<% } %>

ApplicationResources.properties example:

app.quest1.option[0]=a. The length...
app.quest1.option[1]=b. Number of ...
app.quest1.option[2]=c. Minimum of ...
app.quest1.option[3]=d. Maximum ...
app.quest1.option[4]=e. b & c

Does anyone have any suggestions,

I would appreciate any help.

Also if I were to use <c:forEach...> or <logic:iterate> how would the syntax go?

Thank you.

GK

Sorry about that!

[ August 18, 2004: Message edited by: George Kandalepas ]
 
Don't get me started about those stupid light bulbs.
 
subject: Struts-JSP: Using for loop to retrieve Message resources that are in an array