You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pete Black <pe...@metering.co.nz> on 2001/01/31 21:38:51 UTC

RE: logic:greaterEqual tag (also logic:iterate with Arrays thread )

Does anybody know whether this will be the preferred method of accessing
bean methods using logic tags in Struts?

It seems a little confusing that you have to know the names of the bean you
are using when you use logic:xxx tags, but not with html:xxx tags.

If it counts for anything, my vote would be to keep the default case in all
the tags consistent - when there is no name parameter defined, the property
tag refers to the bean bound to the current action in struts-config.xml. It
makes things clean and magical like they should be.

Is the current behaviour set in stone for version 1?

Thanks

-Pete





> -----Original Message-----
> From:	Ted Husted [SMTP:news.ted@husted.com]
> Sent:	Thursday, February 01, 2001 3:04 AM
> To:	Struts List
> Subject:	RE: logic:greaterEqual tag
> 
> > I don't have to specify, for example, <html:text id="myBean"
> property="myText">, i can just say <html:text property="myText">..
> shouldn't the logic tags follow this model by default?
> 
> I think here the logic tags are following the general bean-tag model by
> default. 
> 
> In the case of the HTML tag there is an implicit, default
> name="[formbean]" parameter to the <html:form> tags, which is then made
> the default name parameter to the tags nested within the form. Of
> course, you can override this in either case by supplying another name
> parameter. 
> 
> I'm actually surprised that you were able to use the greaterEqual tag
> without a name parameter. I hadn't realized the logic tags were
> consulting the action mappings now.
> 
> *********** REPLY SEPARATOR  ***********
> 
> On 1/31/2001 at 3:41 PM Pete Black wrote:
> 
> That fixed my problem, but worries me a little.
> 
> Shouldn't this be implicit - i.e. whatever FormBean is associated with
> the
> Action in struts-config.xml is the default 'id' attribute?
> 
> This is how the html:text tags etc. work.
> 
> I don't have to specify, for example, <html:text id="myBean"
> property="myText">, i can just say <html:text property="myText">..
> shouldn't
> the logic tags follow this model by default?
> 
> -Pete
> 
> > -----Original Message-----
> > From:	JamesW@cardsetc.com [SMTP:JamesW@cardsetc.com]
> > Sent:	Wednesday, January 31, 2001 3:37 PM
> > To:	struts-user@jakarta.apache.org
> > Subject:	Re: logic:greaterEqual tag
> > 
> > 
> > Pete,
> > 
> > You need to also specify the 'id' attribute, supplying the name of
> the
> > bean
> > (within some scope) that the value of the 'property' attribute is a
> > property of!
> > 
> > Regards,
> > James W.
> > 
> >
> ------------------------------------------------------------------------
> --
> > This e-mail is from Cards Etc Pty Ltd (ACN: 069 533 302). It may
> contain
> > privileged and confidential information. It is intended for the named
> > recipient(s) only. If you are not an intended recipient, please
> notify us
> > immediately by reply e-mail or by phone on +61 2 9212 7773 & delete
> this
> > e-mail from your system.
> >
> ------------------------------------------------------------------------
> --
> >
> 
> 
> 
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel 716 425-0252; Fax 716 223-2506.
> -- http://www.husted.com/about/struts/
> 

Re: logic:greaterEqual tag (also logic:iterate with Arrays thread)

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Pete Black wrote:

> Does anybody know whether this will be the preferred method of accessing
> bean methods using logic tags in Struts?
>
> It seems a little confusing that you have to know the names of the bean you
> are using when you use logic:xxx tags, but not with html:xxx tags.
>
> If it counts for anything, my vote would be to keep the default case in all
> the tags consistent - when there is no name parameter defined, the property
> tag refers to the bean bound to the current action in struts-config.xml. It
> makes things clean and magical like they should be.
>
> Is the current behaviour set in stone for version 1?
>

Consider a case where the Struts example application uses a conditional tag
outside the scope of an <html:form> tag -- the check for which type of
transaction is being performed at the top of "registration.jsp" in several
places, including when creating the <title> element:

    <logic:equal name="registrationForm" property="action"
            scope="request" value="Create">
        <title><bean:message key="registration.title.create"/></title>
    </logic:equal>

If the name attribute were not entered here, I don't see how the tag could know
what bean you are referring to.

It would be feasible to make an assumption that, if you're inside a form, then
you must be talking about the form bean -- although that risks confusion as
well because the tag would behave quite differently depending on where it was
placed.

>
> Thanks
>
> -Pete
>

Craig McClanahan