jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glenn Nielsen <gl...@voyager.apg.more.net>
Subject Re: [Fwd: Re: <session:setattribute>]
Date Sat, 09 Dec 2000 01:34:03 GMT
Mike Cannon-Brookes wrote:
> 
> <<snipped>>
> 
> > > Surely this is artificially limiting the usefulness of this tag?
> > >
> > > How about adding an optional value attribute:
> > >
> > > <session:setattribute name="foo" value="<%= bar %>" />
> > >
> > > This way you could set objects as well as just Strings?
> > >
> >
> > Yes, this is limiting.  Here is my reasoning behind the design.
> >
> > I see JSP tags as something web publishers will use in web publishing
> > tools.  Not programmers.  You may have noticed that none of the tags
> > I have written allow an attribute to be set using a runtime expression
> > value <rtexprvalue>.  This is a design choice I made.  Allowing
> > <rtexprvalue>
> > requires that the page author enter a scriptlet of java code.  This
> > starts taking the tag set out of the realm where it can easily be used
> > by web publishers using web publishing tools.
> 
> This seems fairly silly to me, when it's a trivial change to allow _both_
> web publishers and programmers (two fields which are rapidly converging I
> might add) to use your tags.
> 
> For instance I have a content management system which has trivial tags like
> :
> 
> <symphony:story sid="4" />
> 

According to the JSP 1.1 spec, 5.4.7, Life-Cycle Considerations, the way
you use the above tag, it is closed immediately, meaning its life is over,
and a servlet container, like Orion Server, could recycle the tag object.  
Unless that tag had already saved the "story" data as an attribute in some scope,
the "story" data has already been marked to be GC'd before you use the 
session:setattribute tag.

Why not just add a "scope" attribute to your symphony:story tag,
then the story tag itself can save the currentstory in whatever scope
the user wants.

> which reduces all complexity of finding a story EJB etc etc. I don't think
> it's too hard to teach a web developer to put that story into a session or
> request value.
> 
> <symphony:story sid="4" />
> <session:setattribute name="currentstory" value="<%= story %>" />
> 
> Any 'web publisher' can be taught to do this, it requires no more complex
> understanding of the fundamentals than your solution.
> 
> It seems to me that sometimes people in the "we should use no scriptlets in
> JSP" artificially complicate things and force others to share the same view
> ;)
> 
> Why not add the option, and let people be responsible enough to decide how
> to use the tags?
> 

Since you are ok with web publishers writing little scriptlets, it would
be just as easy for them to do.

<% session.setAttribute("currentstory",story); %>

and completely bypass the overhead of using the session tag at all.

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

Mime
View raw message