Re: My last annoying question of the day, promise.:-)

2002-03-19 Thread Shawn Bayern

On Mon, 18 Mar 2002, John Baker wrote:

 That's a real minus point for JSTL.

In defense of the way JSTL currently works, this isn't really its job.  
The design standard for components is JavaBeans, which outlines what's a
property and what's not.

-- 
Shawn Bayern
Author, JSP Standard Tag Library  http://www.jstlbook.com
(coming this summer from Manning Publications)


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




Re: My last annoying question of the day, promise.:-)

2002-03-19 Thread John Baker

On Tuesday 19 Mar 2002 14H:11 pm, you wrote:
 On Mon, 18 Mar 2002, John Baker wrote:
  That's a real minus point for JSTL.

 In defense of the way JSTL currently works, this isn't really its job.
 The design standard for components is JavaBeans, which outlines what's a
 property and what's not.

Yes, I see there is the need for simple coding practises, but it makes design 
of good beans/servlets harder. For example, when I'm designing Java beans, I 
declare all my attributes as static, so I have:

public static final String COST = cost;

public double getCost();
public void setCost(double d);

So if I ever have to change the method name, my JSP pages won't break ;-)

When I was reading the spec, I got the impression this was possible: (section 
6.1.5)

c-rt:out value=%= SomeClass.COST %/ 

So I'm assuming that the c-rt tld will evaluate SomeClass.COST as the 
variable COST in the class SomeClass. But that doesn't seem to work either 
:-)

Cheers


John

-- 
John Baker, BSc CS.
Java Developer, TEAM/Slb. http://www.teamenergy.com
Views expressed in this mail are my own.

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




Re: My last annoying question of the day, promise.:-)

2002-03-19 Thread Shawn Bayern

On Tue, 19 Mar 2002, John Baker wrote:

 When I was reading the spec, I got the impression this was possible: (section 
 6.1.5)
 
 c-rt:out value=%= SomeClass.COST %/ 
 
 So I'm assuming that the c-rt tld will evaluate SomeClass.COST as the
 variable COST in the class SomeClass. But that doesn't seem to work
 either :-)

%= SomeClass.COST % is an rtexprvalue; it means the same thing it means
in Java:  the public static variable COST in SomeClass.  But this
isn't an JSTL expression or even something that JSTL knows how to
evaluate; this is just a traditional rtexprvalue.

The two aren't intended to work the same.  If they were, we wouldn't have
needed an expression language!  :-)

-- 
Shawn Bayern
Author, JSP Standard Tag Library  
http://www.jstlbook.com (coming this summer from Manning Publications)


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




Re: My last annoying question of the day, promise.:-)

2002-03-19 Thread John Baker

On Tuesday 19 Mar 2002 14H:29 pm, you wrote:
 On Tue, 19 Mar 2002, John Baker wrote:
  When I was reading the spec, I got the impression this was possible:
  (section 6.1.5)
 
  c-rt:out value=%= SomeClass.COST %/
 
  So I'm assuming that the c-rt tld will evaluate SomeClass.COST as the
  variable COST in the class SomeClass. But that doesn't seem to work
  either :-)

 %= SomeClass.COST % is an rtexprvalue; it means the same thing it means
 in Java:  the public static variable COST in SomeClass.  But this
 isn't an JSTL expression or even something that JSTL knows how to
 evaluate; this is just a traditional rtexprvalue.

 The two aren't intended to work the same.  If they were, we wouldn't have
 needed an expression language!  :-)

Ah ha, so that's how I can achieve what I want using JSTL? :-) Well, in a 
round-a-bout kind of way. :-) 

I only today realised what -rt actually means, ie you can use %= 
moo.doSomething() % and that will actually get evaluated. I think :-)

Ok, one more before I shut up.

I'm trying to write this in JSTL:

if (request.getParameter(moo).equals(cows))

and so far I've got:

c:if test=${request.parameter.moo == 'cows'}

but it doesn't work ;-) I'm also assuming the test method uses the java 
.equals for == and not the Java ==, otherwise moo would never == moo, two 
object references and all. 


John

-- 
John Baker, BSc CS.
Java Developer, TEAM/Slb. http://www.teamenergy.com
Views expressed in this mail are my own.

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




Re: My last annoying question of the day, promise.:-)

2002-03-19 Thread Shawn Bayern

On Tue, 19 Mar 2002, John Baker wrote:

 Ok, one more before I shut up.
 
 I'm trying to write this in JSTL:
 
 if (request.getParameter(moo).equals(cows))
 
 and so far I've got:
 
 c:if test=${request.parameter.moo == 'cows'}
 
 but it doesn't work ;-) 

Yes, because request.parameter means the request-scoped variable named
'parameter'.  To retrieve a parameter, use 'param.moo'.

Again, there isn't a one-to-one isomorphism between JSTL expressions and
rtexprvalues.

-- 
Shawn Bayern
Author, JSP Standard Tag Library  http://www.jstlbook.com
(coming this summer from Manning Publications)


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




Re: My last annoying question of the day, promise.:-)

2002-03-19 Thread Shawn Bayern

On Tue, 19 Mar 2002, John Baker wrote:

 Bah. So how can this be done in JSTL? It's a real shame because that
 would be very nice. I'm trying to avoid writing Java ;-) Does this
 mean I have to use the -rt stuff and do:
 
 c-rt:if test=${ $=request.getParameter(moo).equals(cows) % }

No.  Like I said, you can use an expression starting with 'param':

  ${param.moo == 'cows'}

I don't mind answering all your questions, but you might want to take an
hour and read through the entire JSTL draft spec!  I think it'll answer a
lot of your questions.   :-)

-- 
Shawn Bayern
Author, JSP Standard Tag Library  http://www.jstlbook.com
(coming this summer from Manning Publications)


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




Re: My last annoying question of the day, promise.:-)

2002-03-19 Thread John Baker

On Tuesday 19 Mar 2002 14H:47 pm, you wrote:
 No.  Like I said, you can use an expression starting with 'param':

   ${param.moo == 'cows'}

Ah ha! That's what I was missing! I didn't realise param.moo is actually 
request.getParameter(moo). And I can't see anywhere obvious in the spec 
that tells me that (flicking through ;-).

 I don't mind answering all your questions, but you might want to take an
 hour and read through the entire JSTL draft spec!  I think it'll answer a
 lot of your questions.   :-)

Yea, sorry, I am reading it, but it's a spec and not a book, hence it's 
missing vital bits. It's been in my face now for two days.

I promise I'll buy your book when it comes out ;-)


John

-- 
John Baker, BSc CS.
Java Developer, TEAM/Slb. http://www.teamenergy.com
Views expressed in this mail are my own.

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




Re: My last annoying question of the day, promise.:-)

2002-03-19 Thread John Baker

On Tuesday 19 Mar 2002 14H:47 pm, you wrote:
 I don't mind answering all your questions, but you might want to take an
 hour and read through the entire JSTL draft spec!  I think it'll answer a
 lot of your questions.   :-)

For example :-)

Section 6. Iterators.

The first example given:

c:forEach var=customer items=${customers}

What the spec fails to tell me is where customers came from. Is it a request 
attribute? A session attribute? Does it mean I can do this:

%
Vector customers = someObject.getAVector();
%

But I suspect it doesn't, as I've had to resort to adding 
request.setAttribute(customers, customers) after this, and turning 
${customers} into ${request.customers} 

And I bet that's a sick solution.

:-)


-- 
John Baker, BSc CS.
Java Developer, TEAM/Slb. http://www.teamenergy.com
Views expressed in this mail are my own.

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




Re: My last annoying question of the day, promise.:-)

2002-03-19 Thread Shawn Bayern

On Tue, 19 Mar 2002, John Baker wrote:

 What the spec fails to tell me is where customers came from. Is it a request 
 attribute? A session attribute? Does it mean I can do this:

Your questions all seem to concern the expression language.  You should
read Appendix A for information on how it works.

-- 
Shawn Bayern
Author, JSP Standard Tag Library  http://www.jstlbook.com
(coming this summer from Manning Publications)


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




My last annoying question of the day, promise.:-)

2002-03-18 Thread John Baker

I'm busy digesting the jstl spec now (found an error in it, it says you can 
do c:url= and it should be c:url value=... :-), however I'm wondering 
if I can put an array of objects into a request and use c:if test= to test 
one. Ie:

Blob[] blobs = new Blob[100];
// fill blobs
request.setAttribute(blobs, blobs);

now can I do:

c:if test=${request.blobs[2].whatever ?

Cheers!


John

-- 
John Baker, BSc CS.
Java Developer, TEAM/Slb. http://www.teamenergy.com
Views expressed in this mail are my own.

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




Re: My last annoying question of the day, promise.:-)

2002-03-18 Thread Shawn Bayern

On Mon, 18 Mar 2002, John Baker wrote:

 I'm busy digesting the jstl spec now (found an error in it, it says you can 
 do c:url= and it should be c:url value=... :-), however I'm wondering 
 if I can put an array of objects into a request and use c:if test= to test 
 one. Ie:
 
 Blob[] blobs = new Blob[100];
 // fill blobs
 request.setAttribute(blobs, blobs);
 
 now can I do:
 
 c:if test=${request.blobs[2].whatever ?
 
 Cheers!

Yes, this should work.

--
Shawn Bayern
Author, JSP Standard Tag Library  http://www.jstlbook.com
(coming this summer from Manning Publications)


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




Re: My last annoying question of the day, promise.:-)

2002-03-18 Thread John Baker

On Monday 18 Mar 2002 18H:01 pm, you wrote:

 The error message was: Unable to find a value for 0 in object of class
 java.lang.String using operator []

Argh...

Spot the difference between:

c:set var=blobs value=whatever.someMethodThatReturnsList/

and

c:set var=blobs value=${whatever.someMethodThatReturnsList}/

I'll have a better day tomorrow, I hope ;-)

-- 
John Baker, BSc CS.
Java Developer, TEAM/Slb. http://www.teamenergy.com
Views expressed in this mail are my own.

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




Re: My last annoying question of the day, promise.:-)

2002-03-18 Thread John Baker

On Monday 18 Mar 2002 18H:07 pm, you wrote:

   Current time in milliseconds:
   c:out value=${page.dates[1].time}/

 This prints out output like:

   Current time in milliseconds: 1016474790054

 Hope you can use this as a basis to determine what's wrong with your
 page.  Best,

Yeah, sorry, I was just being dumb. I'm only on day three of the crash course 
in JSTL. I'm actually very impressed, the stuff I have got working is much 
nicer without all the:

%
// blah blah
%

Is this possible though?

public class Moo {
public static final String X = Hello;
public static final int Y = 10;
}

c:param name=${Moo.X} value=something/

Evidence would suggest not, as this also doesn't work:

c:if test=${someInteger == Moo.Y

never seems to evalute to true when someInteger is 10, but replacing Moo.Y 
with '10' works fine :-)



John

-- 
John Baker, BSc CS.
Java Developer, TEAM/Slb. http://www.teamenergy.com
Views expressed in this mail are my own.

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




RE: My last annoying question of the day, promise.:-)

2002-03-18 Thread Eric . Lewis

Just don't...  ;-)

Good Java style dictates that you keep everything as private as possible,
certainly class variables and then use methods to get and set them, like
getY and setY.

Nicely enough, if you implement getY, you can directly use it in
c:if test=${Moo.Y == someInteger}

So, just define all the getter methods you need, and off you go!

-Original Message-
From: John Baker [mailto:[EMAIL PROTECTED]]
Sent: Montag, 18. März 2002 19:31
To: Tag Libraries Users List
Subject: Re: My last annoying question of the day, promise.:-)


On Monday 18 Mar 2002 18H:07 pm, you wrote:

   Current time in milliseconds:
   c:out value=${page.dates[1].time}/

 This prints out output like:

   Current time in milliseconds: 1016474790054

 Hope you can use this as a basis to determine what's wrong with your
 page.  Best,

Yeah, sorry, I was just being dumb. I'm only on day three of the crash
course 
in JSTL. I'm actually very impressed, the stuff I have got working is much 
nicer without all the:

%
// blah blah
%

Is this possible though?

public class Moo {
public static final String X = Hello;
public static final int Y = 10;
}

c:param name=${Moo.X} value=something/

Evidence would suggest not, as this also doesn't work:

c:if test=${someInteger == Moo.Y

never seems to evalute to true when someInteger is 10, but replacing Moo.Y 
with '10' works fine :-)



John

-- 
John Baker, BSc CS.
Java Developer, TEAM/Slb. http://www.teamenergy.com
Views expressed in this mail are my own.

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


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