BeanMessage Tag proposal

2001-03-16 Thread Johan Compagner

Hi,

When setting the args (arg0,arg1,arg2,arg3,arg4)
you must do this:
bean:message key="foo.foo.foo" arg0="foo1" arg1="foo2"/

But i think it is very rare that you know exactly at design time of the jsp
what value there must be. Because if you do then why not set it directly in
the message it self?

So it is almost any time a runtime expression.
But then i must do things like this:

bean:define id="argstring1" value="totalautotheft"/
bean:define id="argstring2" value="autotheft"/
bean:define id="insurance" name="carinsurance" scope="session"
type="nl.topicus.thema.DynamicForm"/
bean:message key="prompt.advise.wacasco" arg0="%=
insurance.getProperty(argstring1).toString() %" arg1="%=
insurance.getProperty(argstring2).toString() %"/


I must define
bean:define id="argstring1" value="totalautotheft"/
because i can't do this:
bean:message arg0="%= insurance.getProperty("totalautotheft").toString()
%"

I find this a bug of the Tomcat parser if you ask me. Because if he sees
that it is a reqexpr (%=)
then it should first find the % before looking at the closing "!!

Because if these problems i wanted to find a solution
Why is is not possible that i get the Object[] from a name/property???
Then the BeanTag is also not limmited to only 5 args

My example for the above one:

app:message key="prompt.advise.wacasco" (arg)name="insurance"
(arg)property="wacascoObjects"/

and the insurance.getWacascoObjects() does return the Object[] for that
string:
object[0] = insurance.getProperty("totalautotheft");
object[1] = insurance.getProperty("autotheft");
return object;

Johan Compagner














Re: BeanMessage Tag proposal

2001-03-16 Thread Michael Westbay

Compagner-san wrote:

 When setting the args (arg0,arg1,arg2,arg3,arg4)
 you must do this:
 bean:message key="foo.foo.foo" arg0="foo1" arg1="foo2"/

 [...snip...]

 bean:message key="prompt.advise.wacasco" arg0="%=
 insurance.getProperty(argstring1).toString() %" arg1="%=
 insurance.getProperty(argstring2).toString() %"/
 
 
 I must define
   bean:define id="argstring1" value="totalautotheft"/
 because i can't do this:
   bean:message arg0="%= insurance.getProperty("totalautotheft").toString()
 %"

This is exactly the problem that Pellow-san addressed with his sub-tag extentions in 
his message dated Wed, 14 Mar 2001 11:40:40 +1100, titled "Re: BaseFieldTag."

Yes, you will need to create your own BaseAttributeTags, but this is a very powerful 
method to do exactly what you want to do.

Take the above example.  It can be rewritten:

  bean:message key="prompt.advise.wacasco"
bean:arg index="0"bean:write name="insurance"
  property="totalautotheft"//bean:arg
bean:arg index="1"bean:write name="insurance"
  property="whatever"//bean:arg
  /bean:message

The bean tag will have to implement an interface that sets arg(s), the work will have 
to be moved from doBeginTag to doEndTag, and a ArgTag will have to be created in the 
light of Pellow-san's Name tag.  The changes necessary are all pretty simple.  I'm now 
working on creating all of my custom tags in that fassion.

Note:  The bean tag does not currently work like this.  This would be a way to extend 
it to cater to your needs.  We're all developers on the -dev list, right?

Hope this helps.

--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:   http://www.seaple.icc.ne.jp/~westbay
Commentary: http://www.japanesebaseball.com/



RE: Iterate -- Logic Tag

2001-03-16 Thread Michael Hackett

raghu tadi [EMAIL PROTECTED] wrote:
 How do i get the Position value of a particular element in say a
 Vector when i use the iterate tag.Sample snippet would be like,
 pre
 Vector v has some String elements..
 for(int i =0 ; i  v.size(); i++)
 {
out.println(v.elementAt(i));
 }
 /pre
 Question is: How do i get the i-th element from Vector V when i use
 the Iterate Tag..

As Jean-Noel said, if you really want to get a particular element, you
don't want to use iterate. But if what you are actually looking for is
how to get the index of the current element inside an iterate block, I
think you need to manage that separately. It's not ideal, but here's
what I do to produce a table with alternately shaded rows:

   % int rowNumber = 0; %
   logic:iterate id="ddItem" name="dropdownItems"
 % if( ( ++rowNumber % 2 ) == 1 ) { %
 tr class="listViewOdd"
 % } else { %
 tr class="listViewEven"
 % } %
   td.../td
   td.../td
   td.../td
 /tr
   /logic:iterate

It would be nice if interate also made an index available, but you can
do something like that as a work-around for now (unless someone has a
better suggestion).

--
Michael Hackett
Developer, Pictorius Inc.




RE: Iterate -- Logic Tag

2001-03-16 Thread Andre_Beskrowni



while it's true that java iterators and enumerators don't provide an index when
you loop through them, how many times have you found yourself using a local
count variable that you increment inside the loop?  i've encountered it plenty.
i don't think it's an uncommon scenario.

recently, i've ended up using a solution similar to Michael's to keep a counter,
but this doesn't seem ideal to me.  if people are really adamant about keeping
the iterate tag as it is, maybe the alternative would to construct an
indexedIterate tag or something like that.  on the other hand, from looking at
the source code for the iterate tag, there's already a lengthCount attribute
that stores the number of iterations.  why not just expose that?

ab

  From:  [EMAIL PROTECTED]
 Date:   03/16/2001 10:55 AM

raghu tadi [EMAIL PROTECTED] wrote:
 How do i get the Position value of a particular element in say a
 Vector when i use the iterate tag.Sample snippet would be like,
 pre
 Vector v has some String elements..
 for(int i =0 ; i  v.size(); i++)
 {
out.println(v.elementAt(i));
 }
 /pre
 Question is: How do i get the i-th element from Vector V when i use
 the Iterate Tag..

As Jean-Noel said, if you really want to get a particular element, you
don't want to use iterate. But if what you are actually looking for is
how to get the index of the current element inside an iterate block, I
think you need to manage that separately. It's not ideal, but here's
what I do to produce a table with alternately shaded rows:

   % int rowNumber = 0; %
   logic:iterate id="ddItem" name="dropdownItems"
 % if( ( ++rowNumber % 2 ) == 1 ) { %
 tr class="listViewOdd"
 % } else { %
 tr class="listViewEven"
 % } %
   td.../td
   td.../td
   td.../td
 /tr
   /logic:iterate

It would be nice if interate also made an index available, but you can
do something like that as a work-around for now (unless someone has a
better suggestion).

--
Michael Hackett
Developer, Pictorius Inc.








Re: Iterate -- Logic Tag

2001-03-16 Thread Martin Cooper

Do you really want the position, or do you just want the element at that 
position? The sample snippet and subsequent question indicate that you want 
the latter. If that's the case, your snippet would translate to:

logic:iterate id="myCollectionElement" name="list"
 bean:write name="myCollectionElement"/br
/logic:iterate

Hope this helps.

--
Martin Cooper


At 06:45 AM 3/16/01, raghu tadi wrote:
logic:iterate id="myCollectionElement" name="list"
  Do something with myCollectionElement
/logic:iterate

How do i get the Position value of a particular element in say a Vector 
when i use the iterate tag.Sample snippet would be like,
pre
Vector v has some String elements..
for(int i =0 ; i  v.size(); i++)
{
   out.println(v.elementAt(i));
}
/pre
Question is: How do i get the i-th element from Vector V when i use the 
Iterate Tag..

Please Respond.
Thanks,
Raghu..
_
Get your FREE download of MSN Explorer at http://explorer.msn.com





Tired of Cable TV raising there rates!!!

2001-03-16 Thread b4h443

Tired of Cable TV raising their rates!!!
   Get Satellite TV
   YES ---YOU CAN WATCH DIFFERENT CHANNELS ON MULTIPLE TV'S
   YES ---YOU CAN GET LOCAL STATIONS
   Order Dish Network System with a one year plan, get FREE two receivers
   and the 18" Dish with FREE basic professional installation.

   Why Bother? For $40.99 Get both receivers and the Top 100 Stations!
   With only one receiver and the Dish $35.99  Local Channels add $5.00

   You will be charged a one time $49.99 fee when you order which includes
   your  first months service for FREE.
   THAT S IT!
   FLIP TO SATELLITE... ITS DIGITAL.. ITS GREAT...
   YOU'LL LOVE IT.
   Ready? Order by phone 1-888-235-5285 or e-mail us [EMAIL PROTECTED]

   REQUIREMENT- 1. One year service commitment.
   2. Major credit Card
   3. Southwest exposure to the sky.

   to be remove from future mailings e-mail us with the word "remove" in the  subject 
lineat --- [EMAIL PROTECTED]

 












Tired of Cable TV raising their rates!!!
   Get Satellite TV
   YES ---YOU CAN WATCH DIFFERENT CHANNELS ON MULTIPLE TV'S
   YES ---YOU CAN GET LOCAL STATIONS
   Order Dish Network System with a one year plan, get FREE two receivers
   and the 18" Dish with FREE basic professional installation.

   Why Bother? For $40.99 Get both receivers and the Top 100 Stations!