I am still getting the same error. When I create the bean, I am using
Messages message = new Messages();
session.setAttribute("Messages", messages);
and in the jsp code I now have
<logic:iterate id="messagestag" name="Messages" property="messages"
scope="session">
Can you see what I am doing wrong?
Thanks for all the help.
Cheers
Tony
Shri wrote:
> <logic:iterate id="messagestag" name="Messages" property="messages"
> scope="TYPE THE BEAN SCOPE HERE">
>
> (make sure that the bean exists in that scope !!!)
>
> You can keep the bean in a particular scope in your action class.
>
> Shri
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 27 November 2001 2:00 PM
> To: Struts Users Mailing List
> Subject: Re: Problem with Iterating-No getter method for property.......
> Any Ideas?
>
>
> Thank you for the reply. How can I set the scope from inside the java code?
>
> Cheers
>
> Tony
>
>
> Shri wrote:
>
>
>>what is the scope you are using to look up for the bean, try putting one
>>
> and
>
>>you may fix it..
>>
>>Shri
>>
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, 27 November 2001 1:26 PM
>>To: [EMAIL PROTECTED]
>>Subject: Problem with Iterating-No getter method for property....... Any
>>Ideas?
>>
>>
>>Hello Ladies and Gentlemen
>>
>>I am just starting out with Struts and I have a problem when I try and
>>iterating over a Hasmap. I am always getting the error
>>
>>[snip]
>>javax.servlet.ServletException: No getter method for property messages
>>of bean Messages
>>[snip]
>>
>>
>>The jsp code which I am calling looks like this
>>
>>
>>--------------------------jsp code start--------------------------------
>>[snip]
>><logic:iterate id="messagestag" name="Messages" property="messages">
>><tr>
>><td align="left">
>><bean:write name="messagestag" property="messageSubject" filter="true"/>
>></td>
>><td align="center">
>><bean:write name="messagestag" property="messageBody" filter="true"/>
>></td>
>><br>
>></logic:iterate>
>>[snip]
>>--------------------------jsp code stop--------------------------------
>>
>>
>>The messages bean is an instance of a Messages object
>>
>>----------------------------Messages.java start----------------------
>>
>>public final class Messages implements Serializable {
>> private Hashtable messages = new Hashtable() ;
>>
>> public void Messages()
>> {
>> Message tmpMessage = new Message();
>> tmpMessage.setMessageBody("Test body 1");
>> tmpMessage.setMessageSubject("Test Subject 1");
>> messages.put("message1", tmpMessage);
>> tmpMessage.setMessageBody("Test body 2");
>> tmpMessage.setMessageSubject("Test Subject 2");
>> messages.put("message2", tmpMessage);
>> }
>> public Message[] getMessages() {
>>
>> synchronized (messages) {
>> Message results[] = new Message[messages.size()];
>> Enumeration subs = messages.elements();
>> int n = 0;
>> while (subs.hasMoreElements()) {
>> results[n++] = (Message) subs.nextElement();
>> }
>> return (results);
>> }
>>
>> }
>>}
>>----------------------------Messages.java stop----------------------
>>
>>
>>----------------------------Message.java start----------------------
>>public final class Message implements Serializable {
>>
>> private String messageBody = null;
>> private String messageSubject = null;
>>
>> public String getMessageBody() {
>> return (this.messageBody);
>> }
>> public String getMessageSubject() {
>> return (this.messageSubject);
>> }
>>
>> public void setMessageBody(String messageBody) {
>> this.messageBody = messageBody;
>> }
>> public void setMessageSubject(String messageSubject) {
>> this.messageSubject = messageSubject;
>> }
>>}
>>----------------------------Message.java stop----------------------
>>
>>
>>Can someone please tell me what I am doing wrong and how I can fix it so
>>I do not get this error.
>>
>>Cheers
>>
>>Tony
>>
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail:
>><mailto:[EMAIL PROTECTED]>
>>
>>
>>--
>>To unsubscribe, e-mail:
>>
> <mailto:[EMAIL PROTECTED]>
>
>>For additional commands, e-mail:
>>
> <mailto:[EMAIL PROTECTED]>
>
>>
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>