struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maurice Nicholson <maurice.nichol...@opodo.com>
Subject RE: Probable bug with nested:root and tiles context
Date Thu, 02 Sep 2004 15:02:43 GMT
Hi Jimmy,

It's a bug in my opinion. We use Struts 1.1, but it could be fixed in newer
versions (?).

A workaround is to just re-nest the same root context (using the special "/"
syntax), so the root context isn't deleted until you've finished with the
form, ie:

<nested:form action="whatever">
  <nested:nest property="/">

     <tiles:insert .../>
     <tiles:insert .../>

  </nested:nest>
</nested:form>

in your main layout tile. Then sub-tiles that use nested tags can never
reach the top-level nesting, and therefore, the context isn't deleted
prematurely.

HTH,
Maurice


-----Original Message-----
From: VAN BROECK Jimmy [mailto:Jimmy.VANBROECK@post.be]
Sent: 02 September 2004 14:37
To: user@struts.apache.org
Subject: Probable bug with nested:root and tiles context


Hi,
 
I think i discovered a bug in the nested:root tag when used in combination
with tiles or even dynamic includes of jsp pages.
 
Let's considere the following scenario :
 
You have a main tile where your nested:form tag is defined and there you
include you tiles through tiles:input
 
<nested:form action="action">
 
<tiles:input value="tile1"/>
 
<tiles:input value="tiles2"/>
 
</nested:form>
 
In the tiles you want to refere to the actionForm bean of your nested:form.
This can be done easily just through <nested:root> without specifying a
name.
 
tile1:
<nested:root>
<nested:nest property="view">
 
</nested:nest>
</nested:root>
 
Tile2: the same thing as tile1:
<nested:root> <!--failure: bean not found in context -->
<nested:nest property="anotherView">
 
</nested:nest>
</nested:root>
 
 
The problem here is, that in the doEndTag, there is only checked if previous
nesting is null and then to delete the nestedreference from the request.
 
 public int doEndTag() throws JspException {
    /* reset the reference */
    HttpServletRequest request =
(HttpServletRequest)pageContext.getRequest();
 
    if (originalNesting == null) {
      NestedPropertyHelper.deleteReference(request);
    } else {
      NestedPropertyHelper.setName(request, originalNestingName);
      NestedPropertyHelper.setProperty(request, "nestOne");
    }
    this.name = originalName;
 
    return (EVAL_PAGE);
}
 
I think the first bug is that the end of a root tag should not check the
originalNesting==null, but the originalNestingName==null, because the
property would always be null?? (You're on the root right??).
 
The second bug or remark, would be that if you didn't specify a bean Name,
you absolutely don't want the nestedReference being deleted, because you are
depending on another reference, declared above this root tag.
 
 
 
Please post your opinions, and if enough people think this is a bug, i will
make a bugzilla report of this.
 
Greetings
jimmy
 

Jimmy Van Broeck 

email:  <mailto:jimmy.van.broeck@e> jimmy.van.broeck@syntegra.com 
Consultant 
BT 

CITS 
DE POST - LA POSTE 
ICT-Development 
WTC II - Kantoor 307 
email: jimmy.vanbroeck@post.be 

 


STRICTLY PERSONAL AND CONFIDENTIAL
This message may contain confidential and proprietary material for the sole
use of the intended recipient. Any review or distribution by others is
strictly prohibited. If you are not the intended recipient please contact
the sender and delete all copies.

Ce Message est uniquement destiné aux destinataires indiqués et peut
contenir des informations confidentielles. Si vous n'êtes pas le
destinataire, vous ne devez pas révéler le contenu de ce message ou en
prendre copie. Si vous avez reçu ce message par erreur, veuillez en informer
l'expéditeur, ou La Poste immédiatement, avant de le supprimer.

Dit bericht is enkel bestemd voor de aangeduide ontvangers en kan
vertrouwelijke informatie bevatten. Als u niet de ontvanger bent, dan mag u
de inhoud van dit bericht niet bekendmaken noch kopiëren. Als u dit bericht
per vergissing heeft ontvangen, gelieve er de afzender of De Post
onmiddellijk van op de hoogte te brengen en het bericht vervolgens te
verwijderen.

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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


Mime
View raw message