struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sloan Seaman" <sl...@sgi.net>
Subject Re: Using the html:message tag
Date Tue, 18 Feb 2003 14:41:53 GMT
Thanks!

Works like a charm!

--
Sloan

----- Original Message -----
From: "Larry Zappeterrini" <Larry.Zappeterrini@SanchezProjects.com>
To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
Sent: Friday, February 14, 2003 3:12 PM
Subject: RE: Using the html:message tag


> html:messages works a bit differently than html:errors in that it does not
> print out the collection containing your messages for you. You must do it
> manually between a begin and end tag. Using your example, you would have
to
> do the following:
>
> <html:messages id="mdxquery" property="success" message="true">
> <%-- print out mdxquery, could also use bean:write --%>
> <c:out value="${mdxquery}" />
> </html:messages>
>
> -----Original Message-----
> From: Sloan Seaman [mailto:sloan@sgi.net]
> Sent: Friday, February 14, 2003 2:57 PM
> To: Struts Users Mailing List
> Subject: Re: Using the html:message tag
>
>
> Guys...
>
> Thanks for the info but it is still not working (I will work on it on
> Monday).
>
> Here is what I understand (becuase I'm feeling like an idiot right now).
>
> The property attribute looks like the right thing because the API docs for
> ActionMessages say the first parameter is for property.
>
> The message tag being set to true I also understand.
>
> The Id tag however... I don't know what to do (it is required). I have no
> Idea what to set it to.
>
> Here is (hopefully for the final time) my entire html and source code:
>
> HTML:
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/tags/struts/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/tags/struts/struts-tiles.tld" prefix="tiles" %>
>
> <html:html locale="true">
> <HEAD>
>  <TITLE>POC - Admin - Query</TITLE>
>  <html:base/>
>
> </HEAD>
> <BODY bgcolor="#FFFFFF">
> <tiles:insert page="/app/global/header/header.jsp"/>
> <P>
>
> <html:errors/>
> <html:messages id="mdxquery" property="success" message="true"/>
>
> Please enter your query:
>
> <html:javascript formName="mdxQuery"/>
>
> <html:form action="/mdxQuery" focus="description"
>  onsubmit="return validateMdxQuery(this);"
> >
> <INPUT TYPE="HIDDEN" name="FAILURE_PAGE" value="/app/admin/query.jsp">
> <INPUT TYPE="HIDDEN" name="SUCCESS_PAGE" value/app/admin/query.jsp">
> <TABLE border="0">
> <TR>
>  <TD align="LEFT" valign="CENTER">Description</TD>
> </TR>
> <TR>
>  <TD align="LEFT" valign="CENTER">
>   <html:text property="description" size="50"/>
>  </TR>
> </TR>
> <TR>
>  <TD align="LEFT" valign="CENTER">Query</TD>
> </TR>
> <TR>
>  <TD align="LEFT" valign="CENTER">
>   <html:textarea property="query" cols="50" rows="5"/>
>  </TR>
> </TR>
> <TR>
>  <TD align="CENTER" valign="CENTER">
>   <html:submit value="Do Query"/>
>  </TR>
> </TR>
> </TABLE>
> </html:form>
>
>
> </BODY>
> </html:html>
>
>
> and here is the java:
> package com.symbol.mobilecommerce.analysis.actions;
>
> import javax.servlet.http.*;
> import org.apache.struts.action.*;
> import org.apache.commons.beanutils.PropertyUtils;
>
> public final class MdxQuery
>  extends Action
> {
>
>     public ActionForward execute(ActionMapping _mapping, ActionForm _form,
>   HttpServletRequest _request,  HttpServletResponse _response)
>   throws Exception
>  {
>   ActionErrors errors = new ActionErrors();
>   ActionMessages messages = new ActionMessages();
>
>   // Validate the request parameters specified by the user
>   String description = (String) PropertyUtils.getSimpleProperty(_form,
> "description");
>   String query = (String) PropertyUtils.getSimpleProperty(_form, "query");
>
>   // Report any errors we have discovered back to the original form
>   if (!errors.isEmpty()) {
>       saveErrors(_request, errors);
>    return new ActionForward(
(String)PropertyUtils.getSimpleProperty(_form,
> "FAILURE_PAGE") );
>
>    //return (_mapping.getInputForward());
>   }
>
>   // Remove the obsolete form bean
>   if (_mapping.getAttribute() != null) {
>             if ("request".equals(_mapping.getScope()))
>                 _request.removeAttribute(_mapping.getAttribute());
>             else
>
> _request.getSession().removeAttribute(_mapping.getAttribute());
>         }
>
>   messages.add("success", new ActionMessage("mdxquery.success"));
>   saveMessages(_request, messages);
>   // Forward control to the specified success URI
>   return new ActionForward( (String)PropertyUtils.getSimpleProperty(_form,
> "SUCCESS_PAGE") );
>     }
> }
>
>
> ----- Original Message -----
> From: "Sri Sankaran" <Sri.Sankaran@sas.com>
> To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> Sent: Friday, February 14, 2003 2:25 PM
> Subject: RE: Using the html:message tag
>
>
> Use the property attribute.
>
> <html:messages
>   property="success"
>    message="true"/>
>
> Also take a look at the html-messages.jsp file that is part of the
> struts-exercise-taglib application that ships with Struts.
>
> Sri
>
> -----Original Message-----
> From: Sloan Seaman [mailto:sloan@sgi.net]
> Sent: Friday, February 14, 2003 2:09 PM
> To: Struts Users Mailing List; jerome.jacobsen@gentootech.com
> Subject: Re: Using the html:message tag
>
>
> Jerome,
>
> I tried it but it didn't work.
>
> Here is what I have in my HTML:
> <html:messages id="success" message="true" />
>
> And here is what is in my action file:
> ActionMessages messages = new ActionMessages(); messages.add("success",
new
> ActionMessage("mdxquery.success"));
> saveMessages(_request, messages);
>
> where mxdquery.success in a value in my ApplicationResources.properties
> file..
>
> I'm not sure about the id attribute.  The API for ActionMessages.add says
> the first string is the property while the docs on the id attribute say it
> is the name scope of the JSP bean(??)...
>
> Idea's?
>
> --
> Sloan
>
>
> ----- Original Message -----
> From: "Jerome Jacobsen" <jerome.jacobsen@gentootech.com>
> To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> Sent: Friday, February 14, 2003 1:47 PM
> Subject: RE: Using the html:message tag
>
>
> > Try this:
> > <html:messages id="success" message="true" />
> >
> > If you omit message="true" then the tag only looks for error messages
> under
> > Action.ERROR_KEY.  With the message="true" it will look for messages
> > under Action.MESSAGE_KEY.
> >
> > > -----Original Message-----
> > > From: Sloan Seaman [mailto:sloan@sgi.net]
> > > Sent: Friday, February 14, 2003 1:26 PM
> > > To: Struts Users Mailing List
> > > Subject: Using the html:message tag
> > >
> > >
> > > I want to display messages in my html when the action completes
> > > successfully (think "Query successfully processed" type messages.)
> > >
> > > I'm guessing I use the <html:messages> tag but it doesn't seem to be
> > > working.
> > >
> > > In my code I have:
> > >   ActionMessages messages = new ActionMessages();
> > >   messages.add("success", new ActionMessage("mdxquery.success"));
> > >   saveMessages(_request, messages);
> > >
> > > And in my html I have:
> > > <html:messages id="success"/>
> > >
> > > What am I doing wrong?
> > >
> > > Thanks!
> > >
> > > --
> > > Sloan
> > >
> > >
> > >
> > > --------------------------------------------------------------------
> > > -
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
***************************************************************************
> This electronic mail transmission contains confidential and/or privileged
> information intended only for the person(s) named.  Any use, distribution,
> copying or disclosure by another person is strictly prohibited.
>
***************************************************************************
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message