Have changed the LinkTag to allow users to specify the indexId.

After doing some more investigation, don't think your first suggestion, Oleg,
would ever come up.  If the user specifies the paramName, Id and property in a
link in a particular row in the table ie in your example:

> <html:link forward="news" paramName="sell" parampProperty="when"
> paramId="whenSell" includeIndex="yes"></html:index>

I believe the user will expect to simply see the sell.when value for that
iteration, which is what the current tag will do!  Thus the includeIndex (or
index=true), if this is their intention, is not necessary at all.

So...suggest that the only usage required will be:

<logic:iterate id="parameter" name="ParametersForm" property="parameterList">
   ...
   <html:link href="x" paramId="value" paramName="parameter"
paramProperty="value" indexed="true" indexId="recordNo">a</html:link>
   ...
</logic:iterate>

which would produce (for the first iteration) the following link:

<a href="x?recordNo=0&value=Mac">a</a>

One question for you all - do we want to default the indexId to something (eg
"index=") or do I throw an exception if index="true" is specified without
indexId?

Should then be ready to submit code...

Cheers,

Dave





"Martin Cooper" <[EMAIL PROTECTED]> on
07/10/2001 12:28:40 AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  Re: Re[2]: Indexed tags - proposal to add changes



+1 for 'indexed="true"'

+1 for 'indexId'

--
Martin Cooper


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Oleg V Alexeev" <[EMAIL PROTECTED]>
Sent: Monday, July 09, 2001 9:35 AM
Subject: Re: Re[2]: Indexed tags - proposal to add changes


>
>
> Hi.  Does anyone have any comments on this?  Personally I would opt for
leaving
> includeIndex="yes" as indexed="true" to match other syntax.
>
> But, do we want to provide both types of indexed links?
>
> Cheers,
>
> Dave
>
>
>
>
>
> Oleg V Alexeev <[EMAIL PROTECTED]> on 07/07/2001
02:03:25 AM
>
> Please respond to [EMAIL PROTECTED];
Please
>       respond to Oleg V Alexeev <[EMAIL PROTECTED]>
>
> To:   [EMAIL PROTECTED]
> cc:    (bcc: David Hay/Lex/Lexmark)
> Subject:  Re[2]: Indexed tags - proposal to add changes
>
>
>
> Hello dhay,
>
> Link tag must build name of some parameter on base of index value or
> use it as separate parameter (I agree with you... 8) )
>
> <html:link forward="news" paramName="sell" parampProperty="when"
> paramId="whenSell" includeIndex="yes"></html:index>
>
> with result as - http://.../news.do?whenSell=today[30]
>
> Or
>
> <html:link forward="news" name="bean" property="linkMap"
> includeIndex="yes" indexId="myIndex"></html:link>
>
> with result as - http://.../news.do?id=2&myIndex=30
>
> Friday, July 06, 2001, 10:10:33 PM, you wrote:
>
>
>
> dlc> Oleg,
>
> dlc> Hi.  Agree that the link tag is different, but think that it is due
to its
> dlc> nature!  Unlike the other tags, adding index as a query param seems
to me
> the
> dlc> only reasonable way to provide access to the index in the link.  Not
sure
> how
> dlc> else to do it (if you try and use name, obviously you change the link
into
> an
> dlc> anchor!).
>
> dlc> If you (or anyone else) has any suggestions to handle it in a better
way
> would
> dlc> like to hear them - maybe I missed something!
>
> dlc> Cheers,
>
> dlc> Dave
>
>
>
>
>
> dlc> Oleg V Alexeev <[EMAIL PROTECTED]> on 07/06/2001
> 01:47:47 PM
>
> dlc> Please respond to
[EMAIL PROTECTED];
> Please
> dlc>       respond to Oleg V Alexeev
<[EMAIL PROTECTED]>
>
> dlc> To:   [EMAIL PROTECTED]
> dlc> cc:    (bcc: David Hay/Lex/Lexmark)
> dlc> Subject:  Re: Indexed tags - proposal to add changes
>
>
>
> dlc> Hello dhay,
>
> dlc> I think it useful addition with minimal changes of existing code -
> dlc> good solution. But there is one problem for my mind - html:link with
> dlc> index=x. All another tag proposals are simple and transparent.
>
> dlc> Friday, July 06, 2001, 9:31:21 PM, you wrote:
>
>
>
> dlc>> Hi everyone.
>
> dlc>> I have been posting to the user list for some time now regarding
creating
> dlc>> indexed names within an iterate tag.   From feedback from that list,
this
> dlc> seems
> dlc>> to be an important addition to the current tags.
>
> dlc>> While looking to write my own additional tags which would do this
(eg
> dlc>> html:indexedText etc), I discovered that this functionality could
easily
> be
> dlc>> added to the current tags, now that the getIndex() method is
available, by
> dlc>> creating an extra parameter 'indexed' which when set to true would
create
> dlc> the
> dlc>> indexed names.  The necessary additions to current code were small
and
> dlc> quite
> dlc>> clean, as follows:
>
> dlc>> - added 'indexed' as a parameter in BaseHandlerTag, with appropriate
> dlc>> setter/getter
> dlc>> - added if statement which checks for 'indexed=true', and if so,
appends
> dlc> "[x]"
> dlc>> to the name, before appending property eg myProperty[x].value.
> dlc>>   This was added to BaseFieldTag (to cover tags which extend this)
and
> dlc>> CheckBoxTag, & SelectTag
> dlc>>  as follows:
> dlc>>    //if "indexed=true" parameter, create indexed name for this tag
eg
> dlc>> name="myCollection[x].myproperty"
> dlc>>    if ("true".equals(indexed))
> dlc>>    {
> dlc>>       // look for outer iterate tag
> dlc>>       IterateTag iterateTag = (IterateTag)
findAncestorWithClass(this,
> dlc>> IterateTag.class);
> dlc>>       if (iterateTag == null)
> dlc>>       {
> dlc>>          // this tag should only be nested in iteratetag, if it's
not,
> dlc> don't do
> dlc>> anything
> dlc>>          return EVAL_PAGE;
> dlc>>       }
>
> dlc>>       results.append(getName());
> dlc>>       results.append("[");
> dlc>>       results.append(iterateTag.getIndex());
> dlc>>       results.append("].");
> dlc>>    }
>
> dlc>> - Slight variations were added to SubmitTag and ButtonTag to simply
add
> dlc> index to
> dlc>> it's name ie mySubmit[x].
> dlc>> - linkTag was somewhat different due to its nature.  I added if
statement
> dlc> to add
> dlc>> "index=x" as a parameter to the link's querystring  ie
myAction.do?index=1
> dlc> or
> dlc>> myAction.do?param1=37&index=1, as follows:
> dlc>>         //if "indexed=true", add "index=x" parameter to query string
> dlc>>         if ("true".equals(indexed))
> dlc>>         {
> dlc>>            // look for outer iterate tag
> dlc>>            IterateTag iterateTag = (IterateTag)
> findAncestorWithClass(this,
> dlc>> IterateTag.class);
> dlc>>            if (iterateTag == null)
> dlc>>            {
> dlc>>                // this tag should only be nested in iteratetag, if
it's
> dlc> not,
> dlc>> don't do anything
> dlc>>               System.out.println("couldn't find enclosing iterate
tag");
> dlc>>               return EVAL_PAGE;
> dlc>>            }
>
> dlc>>            //calculate index, and add as a parameter
> dlc>>            if (params == null)
> dlc>>            {
> dlc>>                params = new HashMap();             //create new
HashMap if
> dlc> no
> dlc>> other params
> dlc>>            }
> dlc>>            params.put("index", "" + iterateTag.getIndex());
> dlc>>         }
> dlc>> - minimal changes to struts-html.tld to add 'indexed' as param.
>
> dlc>> All of this code has been available at Ted's site for a while, and I
would
> dlc> like
> dlc>> to suggest it is added to the Struts source.  Numerous people are
already
> dlc> using
> dlc>> it, and I believe many more would if it was part of the build.
>
> dlc>> Would appreciate your feedback, and not sure what happens next (just
> joined
> dlc> this
> dlc>> list)!
>
> dlc>> Cheers,
>
> dlc>> Dave
>
> dlc>> PS  code attached(See attached file: struts indexed files.ZIP)
>
>
>
>
>
>
> dlc> --
> dlc> Best regards,
> dlc>  Oleg                            mailto:[EMAIL PROTECTED]
>
>
>
>
>
>
>
>
>
>
> --
> Best regards,
>  Oleg                            mailto:[EMAIL PROTECTED]
>
>
>
>
>
>
>
>
>








Reply via email to