+1 ;-) In general I'd say that any time you're thinking of having
different modes of operations for a tag, you're probably better off just
making another tag.

-- 
Tim Moore / Blackboard Inc. / Software Engineer
1899 L Street, NW / 5th Floor / Washington, DC 20036
Phone 202-463-4860 ext. 258 / Fax 202-463-4863


> -----Original Message-----
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, May 02, 2002 11:52 AM
> To: Struts Developers List
> Subject: Re: increased JavaScript support in the link tag.
> 
> 
> Interesting idea.  But I'd really like to get 1.1 out the 
> door before adding lots of new functionaltiy ...
> 
> One of the things I learned, in watching the development of 
> JSTL, is that tags with lots and lots of optional attributes, 
> and different operating modes, can be really hard to 
> understand -- and that describes quite a number of Struts 
> tags today.  Given that, we might want to call this one 
> <html:javascript> or <html:action> or something, even though 
> deep down it really does generate a hyperlink.  Doing it as a 
> separate tag also means you could focus on just the 
> attributes you need for this purpose (i.e. no need to have 
> the attributes to build up a URL).
> 
> Craig
> 
> 
> On Thu, 2 May 2002, Arron Bates wrote:
> 
> > Date: Thu, 02 May 2002 16:46:18 +1000
> > From: Arron Bates <[EMAIL PROTECTED]>
> > Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> > To: Struts Developers List <[EMAIL PROTECTED]>
> > Subject: Re: increased JavaScript support in the link tag.
> >
> > After some deep thought...
> > (any HHGTTG fans out there? :)
> >
> > It all sounds quite ok as to what it is you're trying to do. I do 
> > think that an efficient routing of the link interaction through 
> > JavaScript is a good thing. It is a very "viewy" thing 
> people want to 
> > do.
> >
> > Looking at it from the end developer's point of view, I'd 
> be after the 
> > following  with various parameters... (what of the 
> following is true?)
> > a) function only. Just call the function, no argument, no url.
> > b) page, function. Function with URL as the only argument.
> > c) page, function, functionName, functionProperty. As you describe.
> > c) function, functionName, functionProperty. As you 
> describe, but no url.
> >
> > And in all cases, the urlIndex to be optional, and default 
> to 0 (the 
> > first arg). Is this how it's all working?... With it working like 
> > above, I'll have no problems taking it on to commit it 
> (naturally with 
> > the absence of -1's. I don't think that this is anything paradigm 
> > changing, but that's the process).
> >
> > Internally, it will need a little house keeping. The "if"'s without 
> > the "{" block, and if you can call the Request utils.lookup, rather 
> > than the duplication in the EcmaUtils.
> >
> > I'll also need to do some testing on it. Any unit tests?... 
> A simple 
> > one page webapp that I can run tests against, regression 
> tests etc?... 
> > or do I have to make one?... Not too much of a drama either way.
> >
> >
> > Arron.
> >
> >
> > Phase Web and Multimedia wrote:
> >
> > >The tag "is" a Link Tag. I by no means want to create a 
> new tag. If 
> > >you read my explanation I state that. The additional 
> attributes are 
> > >neccessary though. The reason being is that the 
> functionality is not 
> > >in the current Link tag to accomplish this. It has unique 
> > >requirements that present the need for an expanded set of 
> Attributes 
> > >on the Link tag. The idea is to be able to "include" the 
> action url 
> > >into the javascript function call at a specified an index 
> point along 
> > >with other parameters one might need to send to the javascript 
> > >function. The other goal is to be able to prepare these parameters 
> > >and place them into a bean.
> > >
> > >For example:
> > >
> > >If you have a popup window and you want to customize the 
> size of the 
> > >pop up. You might prepare some size parameters for the 
> popup window 
> > >that you want to be dynamic. With the tag I spun it allows 
> for this 
> > >to happen. You can prepare the parameters yo want to pass to the 
> > >javascript function in the Action class and place it into 
> a request 
> > >bean (or whatever scope) and draw those prepared 
> parameters from the 
> > >bean into the Link tag which then (of
> > >course) would call the javascript function.
> > >
> > >I am not sure what you are getting at, though. Did you read the 
> > >documentation that I wrote. It states that the attributes 
> are added 
> > >functionality to the Link Tag. :-)
> > >
> > >I think I have already done what you are saying. Please, 
> correct me 
> > >if I am misunderstanding you. I am using the base functionality of 
> > >the Link Tag. I developed a whole new tag because I didn't have a 
> > >choice. The intent was always to incorporate the 
> functionality into 
> > >the Link tag. Maybe to avoid confusion I need to go ahead and 
> > >download the nightly and do a patch submission. rather than a code 
> > >submission than can be placed back into the core struts Link tag.
> > >
> > >Brandon Goodin
> > >Phase Web and Multimedia
> > >P (406) 862-2245
> > >F (406) 862-0354
> > >[EMAIL PROTECTED]
> > >http://www.phase.ws
> > >
> > >
> > >-----Original Message-----
> > >From: Arron Bates [mailto:[EMAIL PROTECTED]]
> > >Sent: Wednesday, May 01, 2002 10:45 PM
> > >To: Struts Users Mailing List
> > >Subject: Re: Check this out!
> > >
> > >
> > >Anyone would think that trying to get an opinion on 
> something is an 
> > >uphill battle. :)
> > >
> > >Instead of creating an entirely new tag, can you take a look at 
> > >adapting the current one?... Reason I say this, is that there's 
> > >already a tag there, and this tag will need another name besides 
> > >"link". "scriptlink" or something. An extra tag for people 
> to learn.
> > >Because the logic is already there to do the mapping, and the
> > >querystring appending etc etc, I think it would be easier 
> to simply add
> > >an extra parameter called "script" or something that when 
> set to the
> > >name of a JS function, that when present, will wrap the 
> resulting URL in
> > >the java script function. This means that *all* current 
> links could turn
> > >into JavaScript routed links by adding one parameter, and 
> inversely go
> > >back by removing it. Which I think would be quite sweet.
> > >
> > >Otherwise, it may turn out to be just a tag with an esoteric use.
> > >
> > >Your thoughts?...
> > >
> > >Arron.
> > >
> > >
> > >Phase Web and Multimedia wrote:
> > >
> > >>Hey all,
> > >>
> > >>I submitted an enhancement to struts. Read the following 
> and if it 
> > >>sounds worth having in struts give me a vote on the 
> developer's list 
> > >>or make some noise for some of the gurus to see.
> > >>
> > >>The code is at the following url in zip format:
> > >>
> > >>Here is the info on the tag: 
> http://www.phase.ws/linktag/taglib.zip
> > >>
> > >>I don't know if a similar solution has been provided, 
> but, I tweaked 
> > >>the Link Tag to support the writing of 
> > >>'javascript:[function_name]([param1,param2,param3...])' 
> to the href 
> > >>attribute of the final output. Here is a summarization of it's
> > >>functionality:
> > >>
> > >>I added the following attributes:
> > >>
> > >>function - This is the name of the javascript function 
> that will be 
> > >>called;
> > >>
> > >>functionName - This is the name of the bean that will provide 
> > >>parameter values from one of it's properties.
> > >>
> > >>functionProperty - This is a property of a bean that will either 
> > >>provide a String or an ArrayList to populate the 
> parameters of the 
> > >>function
> > >>
> > >>urlIndex - This allows you to include the url generated by 
> > >>href,forward or page to be included at a specific place in the 
> > >>function's parameters.
> > >>
> > >>There is another class that I wrote that does the actual 
> processing 
> > >>and preparation of the url. I named it EcmaUtil.  I modeled the 
> > >>computeURL and computerParam methods of the RequestUtils 
> class when 
> > >>I built the methods
> > >>
> > >for
> > >
> > >>the EcmaUtil.
> > >>
> > >>The LinkTag class that I wrote extends the BaseHandlerTag 
> under the 
> > >>org.apache.struts.taglib.html package of struts jar.
> > >>
> > >>I know the code needs a bit of reworking to fit back in to the 
> > >>struts framework. I stripped out the MessageReources for the most 
> > >>part and removed some exception handling that will need to be 
> > >>included again.
> > >>
> > >>Anyways, if nobody has done this in the nightly or if it 
> sounds like 
> > >>it might be of use. Let me know and I will post the 
> code,the tld and 
> > >>an
> > >>
> > >example
> > >
> > >>of it's usage.
> > >>
> > >>EXAMPLE OF USAGE:
> > >>
> > >>This tag works exactly like the struts html tag with expanded 
> > >>feature outlined above:
> > >>
> > >><pwshtml:link forward="listings/detail/popup" function="popUpWin" 
> > >>urlIndex="1" paramId="image" paramName="image"> <img 
> > >>src="image.jpg"> some text</pwshtml:link>
> > >>
> > >>This code will produce the follwing html
> > >><a
> > 
> >>href="javascript:popUpWin('/do/listings/detail/popup?image=NWMT20333
> > >>6.jpg')
> > >>
> > >"
> > >
> > >>><img src="image.jpg"></a>
> > >>>
> > >>Of course some of the elements are arbitrary to the 
> values in your 
> > >>beans. But you should be able to traverse the code and 
> get the idea.
> > >>
> > >>Thanks in advance.
> > >>Brandon Goodin
> > >>Phase Web and Multimedia
> > >>P(406)862-2245
> > >>F(406)862-0354
> > >>http://www.phase.ws
> > >>[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to