You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Galbreath, Mark" <Ga...@tessco.com> on 2002/08/20 20:14:38 UTC

RE: separating status messages and error messages-Getting the des ign right.

yep

-----Original Message-----
From: Bartley, Chris P [mailto:cbartl03@sprintspectrum.com]
Sent: Tuesday, August 20, 2002 2:13 PM
To: 'Struts Users Mailing List'
Subject: RE: separating status messages and error messages-Getting the
des ign right.


Why use the ternary operator at all?  A simple "if(ae == null)" should
suffice, no?

chris

> -----Original Message-----
> From: Galbreath, Mark [mailto:Galbreath@tessco.com]
> Sent: Tuesday, August 20, 2002 12:54 PM
> To: 'Struts Users Mailing List'
> Subject: RE: separating status messages and error messages-Getting the
> des ign right.
> 
> 
> Simply for code readability - we have HTML people who would 
> be confused
> running into a trinary operator.  Good refactoring, though!
> 
> Mark
> 
> -----Original Message-----
> From: micael [mailto:caraunltd@harbornet.com]
> Sent: Tuesday, August 20, 2002 1:49 PM
> 
> I don't understand the need for the
> 
> boolean err = false;
> if(ae!= null) { err = true; }
> 
> in the code below.  Why not use merely:
> 
> <%
> ActionErrors ae = 
> (ActionErrors)request.getAttribute(Action.ERROR_KEY);
> %>
> 
> 
> Then, wherever you want something to occur on the page:
> 
> <%
> if(ae == null ? true : false) {
> %>
>      [whatever]
> <%
> }
> %>
> 
> I am only asking in case there is something that is useful in 
> your code, 
> Mark, that I am missing.  The difference is not huge, obviously.
> 
> At 10:09 AM 8/20/2002 -0400, you wrote:
> >Here's how I do it:
> >
> ><%
> >ActionErrors ae = ( ActionErrors) request.getAttribute( 
> Action.ERROR_KEY);
> >boolean err = false;
> >if( ae != null) { err = true;   }
> >%>
> >
> >You can also test for specific errors or for action messages.  Then,
> >wherever you want anything to occur on the page:
> >
> ><% if( err) { %>
> >   [whatever]
> ><% } %>
> >
> >Mark
> >
> >-----Original Message-----
> >From: Galbraith, Paul [mailto:Paul.Galbraith@T4G.com]
> >Sent: Tuesday, August 20, 2002 8:38 AM
> >
> >Amol,
> >
> >I'm very new to Struts myself...just learning my way around, 
> really, so I'd
> >love to hear someone else's opinion on this.  The way I'd 
> approach this is
> >to use the <logic:notPresent/> tag in the JSP to show your 
> status message
> >only if there isn't an error object.  E.g.:
> >
> ><logic:notPresent name="<%= 
> org.apache.struts.action.Action.ERROR_KEY %>">
> >User added, any other suckers?
> ></logic:notPresent>
> >
> >Paul
> >
> >
> >-----Original Message-----
> >From: amolk [mailto:amolk@mailjol.com]
> >Sent: August 20, 2002 1:58 AM
> >To: struts-user@jakarta.apache.org
> >Subject: separating status messages and error messages-Getting the
> >design right.
> >
> >
> >Hi all,
> >I have just shifted from servlets to jsp + struts. I am 
> still new to both.
> >I have to create some jsp pages corresponding to some user actions.
> >For example, the application administrator can click on add 
> user link (
> from
> >left band menu which is in a separete frame ) and will be 
> presented with a
> >form which he can fill can click on add to add the user. On 
> submit, the
> >corresponding action class's perform is invoked and the same 
> page has to be
> >shown back to the user, this time, with a status message 
> saying "user added
> >successfully. Add another?" If the operation fails, an 
> appropriate message
> >is displayed using the <html:errors/>
> >My problem is the following:
> >Where do i handle these status messages? Each page is viewed 
> by the user in
> >two different scenarios. 1. When the user wishes to perform 
> some task. This
> >time, there is no status, error message to be shown. Just 
> the jsp page,
> >directly.
> >2. After the user fill out the form and submits it. The same 
> form reappears
> >with the appropriate status or error message.
> >Should i be mixing status and error messages? In that case, 
> how do i handle
> >different headers and footers for the two?
> >Or should i be using some custom tags?
> >Hve been trying out custom tags but since am still new to 
> all this, ( jsp
> as
> >well as struts. have been using only servlets till now!!! ) 
> am not able to
> >take design design decisions based on custom libraries, and stuff.
> >I would go for a design where maximum html code is present 
> in the jsp file
> >itself so that my page designers can freely modify/manage it.
> >Any suggestions? I am not using tiles or anything else. Too 
> many new things
> >to handle @ a time, specially since i am new to jsp itself!!
> >
> >
> >thnx in advance,
> >amol
> >
> >
> >--
> >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>
> 
> --
> 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>