You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Patrick Beagan <Pa...@crd.com> on 2004/11/10 19:38:48 UTC
newbie question - can't get message to display
I want to display a message on a jsp as a result of a user logging on.
I do a saveMessages() in my Action class then forward to my jsp.
Nothing is displayed. Can anyone see what I am doing wrong?
Thanks, Patrick
In my Action class:
ActionMessage msg = new
ActionMessage("status.welcome", username);
ActionMessages msgs = new ActionMessages();
msgs.add("status", msg);
saveMessages(request, msgs);
In the resulting jsp:
<html:messages property="status" id="m"></html:messages>
Struts-config :
<!-- Process a user logon -->
<action path="/SubmitLogon"
type="net.pwb.web.actions.LogonAction"
input="/WEB-INF/forms/logon.jsp"
name="LogonForm"
scope="session">
<forward name="failure" path="/Logon.do" redirect="true"/>
<forward name="success" path="/welcome.jsp" />
RE: newbie question - can't get message to display
Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Where is your bean:write statement in the html:messages JSP tag?
**** But the real reason is your redirect="true". You save the
messages to the request scope but the redirect="true" forces
the client to invoke a NEW request (losing all the old messages)
to get to the /Logon.do action.
Try changing it to redirect="false" and specifying the JSP instead
of an action (or the controller will reprocess everything when it
tried to internally go to /Logon.do and could result in the errors
talked about in the last few days on this list).
Regards,
David
-----Original Message-----
From: Patrick Beagan [mailto:PatrickBeagan@crd.com]
Sent: Wednesday, November 10, 2004 1:39 PM
To: user@struts.apache.org
Subject: newbie question - can't get message to display
I want to display a message on a jsp as a result of a user logging on.
I do a saveMessages() in my Action class then forward to my jsp.
Nothing is displayed. Can anyone see what I am doing wrong?
Thanks, Patrick
In my Action class:
ActionMessage msg = new
ActionMessage("status.welcome", username);
ActionMessages msgs = new ActionMessages();
msgs.add("status", msg);
saveMessages(request, msgs);
In the resulting jsp:
<html:messages property="status" id="m"></html:messages>
Struts-config :
<!-- Process a user logon -->
<action path="/SubmitLogon"
type="net.pwb.web.actions.LogonAction"
input="/WEB-INF/forms/logon.jsp"
name="LogonForm"
scope="session">
<forward name="failure" path="/Logon.do" redirect="true"/>
<forward name="success" path="/welcome.jsp" />
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org