You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Michael Delamere <ho...@michael-delamere.de> on 2002/11/13 11:41:22 UTC

Trying the developer list...

Hi,

I´ve tried answering the following question via the user-list twice and
I have not yet received the solution that I am looking for.  I´ve been
on this for quite some time now and cannot get it to work!

Basically, I want to pass ActionMessages to my JSP using the methods and
classes provided by struts.

Here is the code in my Action:

ActionMessages messages = new ActionMessages();
ActionMessage newMessage = new
ActionMessage("from.my.resourcebundle.text");
messages.add("key.I.pass.to.jsp", newMessage);
saveMessages(request, messages);

// I also tried saving it directly
//request.setAttribute(Action.MESSAGE_KEY, messages);


Now in my JSP I would have the following:

<html:messages id="message" message="true">
    <bean:write name="message"/> <!-- Can I set the property I want?
i.e. property="key.I.pass.to.jsp" -->
</html:messages>

Whenever I put this code into my JSP however, I get the error:

java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:386)
at
org.apache.jasper.runtime.PageContextImpl.setAttribute(PageContextImpl.j
ava:229) at
org.apache.struts.taglib.html.MessagesTag.doStartTag(MessagesTag.java:25
3)

Any help on this matter would be very much appreciated because I really
need to get this working!

Regards,


Michael


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Trying the developer list...

Posted by Michael Delamere <ho...@michael-delamere.de>.
Hi,

thanks for your reply.  I just wanted to add that I haven’t actually
tried adding the property attribute to the bean:write tag yet, so the
problem still remains...

Regards,

Michael


-----Original Message-----
From: Hal Deadman [mailto:hal.deadman@Tallan.com] 
Sent: Mittwoch, 13. November 2002 17:40
To: 'Struts Developers List'
Subject: RE: Trying the developer list...

No you can't do that with bean:write. If you want a specific property,
specify the property in the html:messages tag and only messages with
that
key will be itereated over.

> -----Original Message-----
> From: Michael Delamere [mailto:home@michael-delamere.de]
> Sent: Wednesday, November 13, 2002 5:41 AM
> To: struts-dev@jakarta.apache.org
> Subject: Trying the developer list...
>
>
> Hi,
>
> I´ve tried answering the following question via the user-list
> twice and
> I have not yet received the solution that I am looking for.  I´ve been
> on this for quite some time now and cannot get it to work!
>
> Basically, I want to pass ActionMessages to my JSP using the
> methods and
> classes provided by struts.
>
> Here is the code in my Action:
>
> ActionMessages messages = new ActionMessages();
> ActionMessage newMessage = new
> ActionMessage("from.my.resourcebundle.text");
> messages.add("key.I.pass.to.jsp", newMessage);
> saveMessages(request, messages);
>
> // I also tried saving it directly
> //request.setAttribute(Action.MESSAGE_KEY, messages);
>
>
> Now in my JSP I would have the following:
>
> <html:messages id="message" message="true">
>     <bean:write name="message"/> <!-- Can I set the property I want?
> i.e. property="key.I.pass.to.jsp" -->
> </html:messages>
>
> Whenever I put this code into my JSP however, I get the error:
>
> java.lang.NullPointerException
> at java.util.Hashtable.put(Hashtable.java:386)
> at
> org.apache.jasper.runtime.PageContextImpl.setAttribute(PageCon
> textImpl.j
> ava:229) at
> org.apache.struts.taglib.html.MessagesTag.doStartTag(MessagesT
> ag.java:25
> 3)
>
> Any help on this matter would be very much appreciated
> because I really
> need to get this working!
>
> Regards,
>
>
> Michael
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Trying the developer list...

Posted by Hal Deadman <ha...@Tallan.com>.
No you can't do that with bean:write. If you want a specific property,
specify the property in the html:messages tag and only messages with that
key will be itereated over.

> -----Original Message-----
> From: Michael Delamere [mailto:home@michael-delamere.de]
> Sent: Wednesday, November 13, 2002 5:41 AM
> To: struts-dev@jakarta.apache.org
> Subject: Trying the developer list...
>
>
> Hi,
>
> I´ve tried answering the following question via the user-list
> twice and
> I have not yet received the solution that I am looking for.  I´ve been
> on this for quite some time now and cannot get it to work!
>
> Basically, I want to pass ActionMessages to my JSP using the
> methods and
> classes provided by struts.
>
> Here is the code in my Action:
>
> ActionMessages messages = new ActionMessages();
> ActionMessage newMessage = new
> ActionMessage("from.my.resourcebundle.text");
> messages.add("key.I.pass.to.jsp", newMessage);
> saveMessages(request, messages);
>
> // I also tried saving it directly
> //request.setAttribute(Action.MESSAGE_KEY, messages);
>
>
> Now in my JSP I would have the following:
>
> <html:messages id="message" message="true">
>     <bean:write name="message"/> <!-- Can I set the property I want?
> i.e. property="key.I.pass.to.jsp" -->
> </html:messages>
>
> Whenever I put this code into my JSP however, I get the error:
>
> java.lang.NullPointerException
> at java.util.Hashtable.put(Hashtable.java:386)
> at
> org.apache.jasper.runtime.PageContextImpl.setAttribute(PageCon
> textImpl.j
> ava:229) at
> org.apache.struts.taglib.html.MessagesTag.doStartTag(MessagesT
> ag.java:25
> 3)
>
> Any help on this matter would be very much appreciated
> because I really
> need to get this working!
>
> Regards,
>
>
> Michael
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>