You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Richard <ri...@gmail.com> on 2004/10/06 11:53:07 UTC
ActionMessages Help
Hello Guys ,
Im using DynaActionForms and I cant figure out how to display the
messages I have created on the Action back to the jsp.
Thanks in Advance
Here are my codes....
SubmitAction.java
===============
ActionMessages errors = new ActionMessages();
ActionMessage error = new ActionMessage( "license.notagree " ) ;
errors.add( "iagree" , error ) ;
if (!errors.isEmpty()) {
this.saveErrors(request, errors);
return (mapping.getInputForward());
}
license.jsp
=======
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"></meta>
</head>
<html:errors/>
<body class="composite">
<jsp:include page="banner.jsp" />
.
.
.
.
<div class="section">
<html:form action="/submit-license.fss" focus="iagree" >
<html:checkbox property="iagree"/> I Agree.
<html:submit property="Submit" value="Submit"/>
</html:form>
</div>
</html>
struts-config
=========
<action
path="/submit-license"
type="com.freesoftswitch.actions.SubmitLicenseAction"
name="LicenseForm"
scope="request"
input="/license.fss">
<forward name="failure" path="/serverpages/temp_google.jsp" />
<forward name="success" path="/serverpages/temp_google.jsp" />
</action>
MessageResources.properties
======================
license.notagree=You must agree !!!!
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: ActionMessages Help
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Either use the <html:errors> or <html:messages> tag
http://struts.apache.org/userGuide/struts-html.html#errors
http://struts.apache.org/userGuide/struts-html.html#messages
Niall
----- Original Message -----
From: "Richard" <ri...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, October 06, 2004 10:53 AM
Subject: ActionMessages Help
> Hello Guys ,
>
> Im using DynaActionForms and I cant figure out how to display the
> messages I have created on the Action back to the jsp.
>
> Thanks in Advance
>
> Here are my codes....
>
> SubmitAction.java
> ===============
> ActionMessages errors = new ActionMessages();
> ActionMessage error = new ActionMessage( "license.notagree " ) ;
> errors.add( "iagree" , error ) ;
>
> if (!errors.isEmpty()) {
> this.saveErrors(request, errors);
> return (mapping.getInputForward());
> }
>
>
> license.jsp
> =======
> <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1"></meta>
> </head>
> <html:errors/>
> <body class="composite">
> <jsp:include page="banner.jsp" />
> .
> .
> .
> .
> <div class="section">
> <html:form action="/submit-license.fss"
focus="iagree" >
> <html:checkbox property="iagree"/> I Agree.
> <html:submit property="Submit" value="Submit"/>
> </html:form>
> </div>
> </html>
>
>
> struts-config
> =========
> <action
> path="/submit-license"
> type="com.freesoftswitch.actions.SubmitLicenseAction"
> name="LicenseForm"
> scope="request"
> input="/license.fss">
> <forward name="failure" path="/serverpages/temp_google.jsp"
/>
> <forward name="success" path="/serverpages/temp_google.jsp"
/>
> </action>
>
> MessageResources.properties
> ======================
> license.notagree=You must agree !!!!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org