RE: How to print an int with a c:out tag?

2005-08-03 Thread Marius Botha
Thanks guys,

I tried that and got a new error (below). I will probably just go the
scriptlet route for now as maybe I have an old or incorrect JAR somewhere.
Can any one tell me where the TagLib for FN is?

What I did:
1. Changed web-app ... as per example.
2. Included FN taglib in my web.xml file as I do with the other ones I use:
  taglib
taglib-uri/tags/fn/taglib-uri

taglib-locationhttp://java.sun.com/jsp/jstl/functions/taglib-location
  /taglib
  taglib
taglib-uri/tags/jstl-core/taglib-uri
taglib-location/WEB-INF/c.tld/taglib-location
  /taglib

Then I get File http://java.sun.com/jsp/jstl/functions; not found,
OR,
If I don't import the taglib in my web.xml file and just try to use it, I
get:
The attribute prefix fn does not correspond to any imported tag library

Thanks again for you patience, you've been a great help and I've learned
quite a bit.

Thanks,

Marius

-Original Message-
From: Christian Taylor [mailto:[EMAIL PROTECTED]
Sent: 02 August 2005 07:59
To: Tag Libraries Users List
Subject: Re: How to print an int with a c:out tag?


My next guess was going to be one thing mentioned on the page Murray
links to below. Regardless of whether you are using Tomcat 5, JSTL 1.1
and JSP 2.0... if your web.xml doesn't say it's a servlet 2.4 app it
will revert to Servlet 2.3/JSP 1.2 (and trying to use JSTL 1.1 with JSP
1.2 probably introduces many other problems...). As the page says, make
sure your webapp element starts like this:

web-app xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4

Otherwise the container will assume the servlet 2.3 spec and EL will not
be allowed outside of JSTL (1.0) tags. The fn:length() function I
originally mentioned is part of JSTL 1.1 anyway so it sounds like you
just need to make sure everything is configured for the current specs
and you should be good. Hope that will fix it up for you.

 -Christian

Murray Steele wrote:

 Perhaps this page might provide the solution?

 http://www.oreillynet.com/cs/user/view/cs_msg/32931

 Wrong taglib uri's or wrong webapp specification in your web.xml.

 Muz


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



Re: How to print an int with a c:out tag?

2005-08-03 Thread Murray Steele
As far as I can tell the taglib-location for the fn taglib should  
probably be: /WEB-INF/fn.tld


If fn.tld isn't in the WEB-INF of your webapp you should probably do a  
search on your filesystem for the file and copy it into your WEB-INF.   
It should be present *somewhere* on your system, most likely in the  
place you originally obtained c.tld (and the other JSTL tld files)  
from.


The taglib-uri in your web.xml and the uri in your %@ taglib %  
statements have to match up and can be an ything you want (it's just a  
unique specifier), I think sun just recommend using their  
http://java.sun.com/jsp/jstl/functions urls, so that someone coming to  
your jsps later can look at your %@ taglib % statements and  
immediately realise Ah, he's using the jstl functions rather than  
some fn.tld that you have written yourself.  (I might have this wrong  
tho' I'm still mainly a jsp 1.2 person)


Muz

On 3 Aug 2005, at 10:52, Marius Botha wrote:

2. Included FN taglib in my web.xml file as I do with the other ones I  
use:

  taglib
taglib-uri/tags/fn/taglib-uri

taglib-locationhttp://java.sun.com/jsp/jstl/functions/taglib- 
location

  /taglib
  taglib
taglib-uri/tags/jstl-core/taglib-uri
taglib-location/WEB-INF/c.tld/taglib-location
  /taglib



--
Murray Steele
Senior Developer

Peoples Archive
w: http://www.peoplesarchive.com
t: 0207 323 0323
d: 0207 631 9147

This email has been scanned by Postini.
For more information please visit http://www.postini.com


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



RE: How to print an int with a c:out tag?

2005-08-03 Thread Christian Taylor
I've never actually included my JSTL taglibs this way. I have just put
jstl.jar and standard.jar in WEB-INF/lib. The TLD files are contained in
standard.jar and should be automatically recognized by the container
(Tomcat or otherwise). All I have to do then is include this line in any
JSP:

[EMAIL PROTECTED] uri=http://java.sun.com/jsp/jstl/core; prefix=c%

(modify for the sql, fmt, xml and function taglibs of course)

I wonder if trying to put your own entry in web.xml and use separate TLD
files is causing problems?

 -Christian

-Original Message-
From: Marius Botha [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 03, 2005 6:52 AM
To: 'Tag Libraries Users List'
Subject: RE: How to print an int with a c:out tag?

Thanks guys,

I tried that and got a new error (below). I will probably just go the
scriptlet route for now as maybe I have an old or incorrect JAR
somewhere.
Can any one tell me where the TagLib for FN is?

What I did:
1. Changed web-app ... as per example.
2. Included FN taglib in my web.xml file as I do with the other ones I
use:
  taglib
taglib-uri/tags/fn/taglib-uri

taglib-locationhttp://java.sun.com/jsp/jstl/functions/taglib-location

  /taglib
  taglib
taglib-uri/tags/jstl-core/taglib-uri
taglib-location/WEB-INF/c.tld/taglib-location
  /taglib

Then I get File http://java.sun.com/jsp/jstl/functions; not found,
OR, If I don't import the taglib in my web.xml file and just try to use
it, I
get:
The attribute prefix fn does not correspond to any imported tag
library

Thanks again for you patience, you've been a great help and I've learned
quite a bit.

Thanks,

Marius

-Original Message-
From: Christian Taylor [mailto:[EMAIL PROTECTED]
Sent: 02 August 2005 07:59
To: Tag Libraries Users List
Subject: Re: How to print an int with a c:out tag?


My next guess was going to be one thing mentioned on the page Murray
links to below. Regardless of whether you are using Tomcat 5, JSTL 1.1
and JSP 2.0... if your web.xml doesn't say it's a servlet 2.4 app it
will revert to Servlet 2.3/JSP 1.2 (and trying to use JSTL 1.1 with JSP
1.2 probably introduces many other problems...). As the page says, make
sure your webapp element starts like this:

web-app xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4

Otherwise the container will assume the servlet 2.3 spec and EL will not
be allowed outside of JSTL (1.0) tags. The fn:length() function I
originally mentioned is part of JSTL 1.1 anyway so it sounds like you
just need to make sure everything is configured for the current specs
and you should be good. Hope that will fix it up for you.

 -Christian

Murray Steele wrote:

 Perhaps this page might provide the solution?

 http://www.oreillynet.com/cs/user/view/cs_msg/32931

 Wrong taglib uri's or wrong webapp specification in your web.xml.

 Muz


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


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



Re: How to print an int with a c:out tag?

2005-08-02 Thread Christian Taylor
Hi Marius,

Check out the fn:length() function, this is what you are looking for.
size() is a method and you cannot call methods directly from JSTL (only
getters and setters), but the fn taglib provides a function for length
of Collections and strings. See the JSTL 1.1 documentation for more
information, but basically fn:length() is what you are looking for:

c:out value=${fn:length(myList)}/

Hope this helps.

 -Christian

Marius Botha wrote:

Hi there,

Just a basic question. I am trying to print out the size() of a List, like
the tag below.

c:out value=${myList.size}/

But I am getting the following error: An error occurred while evaluating
custom action attribute value with value ${myList.size}: The .
operator was supplied with an index value of type java.lang.String to be
applied to a List or array, but that value cannot be converted to an
integer. (null)

Can the c:out tag not print int's or is it that I am calling size() which
does not have a getter/setter method? Please help.

Thanks,

Marius

  



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



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



RE: How to print an int with a c:out tag?

2005-08-02 Thread Marius Botha
Thanks, I'll try that.

Cheers,

Marius

-Original Message-
From: Christian Taylor [mailto:[EMAIL PROTECTED]
Sent: 02 August 2005 01:08
To: Tag Libraries Users List
Subject: Re: How to print an int with a c:out tag?


Hi Marius,

Check out the fn:length() function, this is what you are looking for.
size() is a method and you cannot call methods directly from JSTL (only
getters and setters), but the fn taglib provides a function for length
of Collections and strings. See the JSTL 1.1 documentation for more
information, but basically fn:length() is what you are looking for:

c:out value=${fn:length(myList)}/

Hope this helps.

 -Christian

Marius Botha wrote:

Hi there,

Just a basic question. I am trying to print out the size() of a List, like
the tag below.

c:out value=${myList.size}/

But I am getting the following error: An error occurred while evaluating
custom action attribute value with value ${myList.size}: The .
operator was supplied with an index value of type java.lang.String to be
applied to a List or array, but that value cannot be converted to an
integer. (null)

Can the c:out tag not print int's or is it that I am calling size() which
does not have a getter/setter method? Please help.

Thanks,

Marius





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



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


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



RE: How to print an int with a c:out tag?

2005-08-02 Thread Marius Botha
My requirement is really a bit different. I have an expression, which
returns a List, the size of which I would like to display. I.e. I have
${myController.activitiesForResource}, which returns a list.

If I try c:out
value=${fn:length(${myController.activitiesForResource})}/ I get an error
saying EL expressions are not supported. Any ideas?

Thanks,

Marius

-Original Message-
From: Christian Taylor [mailto:[EMAIL PROTECTED]
Sent: 02 August 2005 01:08
To: Tag Libraries Users List
Subject: Re: How to print an int with a c:out tag?


Hi Marius,

Check out the fn:length() function, this is what you are looking for.
size() is a method and you cannot call methods directly from JSTL (only
getters and setters), but the fn taglib provides a function for length
of Collections and strings. See the JSTL 1.1 documentation for more
information, but basically fn:length() is what you are looking for:

c:out value=${fn:length(myList)}/

Hope this helps.

 -Christian

Marius Botha wrote:

Hi there,

Just a basic question. I am trying to print out the size() of a List, like
the tag below.

c:out value=${myList.size}/

But I am getting the following error: An error occurred while evaluating
custom action attribute value with value ${myList.size}: The .
operator was supplied with an index value of type java.lang.String to be
applied to a List or array, but that value cannot be converted to an
integer. (null)

Can the c:out tag not print int's or is it that I am calling size() which
does not have a getter/setter method? Please help.

Thanks,

Marius





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



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


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



Re: How to print an int with a c:out tag?

2005-08-02 Thread Murray Steele
I suspect that you are using either Tomcat 4.1.x and / or Standard 1.0x  
for your JSTL.  EL functions are part of the JSTL 1.1 spec (JSP 2.0)  
and aren't supported on Tomcat 4.1.x or Standard 1.0x (JSP 1.2 and JSTL  
1.0 respectively).  If you want to use the fn:length you need to use  
JSTL 1.1 and hence Standard 1.1 and / or Tomcat 5.x.  (I think those  
versions are correct, someone correct me if I'm wrong).


If you cant change the version of Tomcat / JSTL you use:
1. You could alter your myController.getOpenActivitiesForResource  
method to return a class that extends list to provide a getSize() (and  
hence your original c:out value=${myList.size}/ would work.
2. Find some other Tag lib that lets you output list sizes.   
(unstandard from the sandbox does this)
3. Just use a scriptlet %= ((MyControllerClass)  
pageContext.findAttribute(myController)).getOpenActivitiesForResource( 
).size() %.


Muz

On 2 Aug 2005, at 13:06, Marius Botha wrote:

Ok, I feel like an idiot... I tried it with and without the nested ${}  
as

you guys suggested and am still getting the same EL expressions not
supported error. I am including the c.tld tag library. Should I  
maybe be

using c-rt.tld instead, or what can it be?

Thanks for your effort. Error below.

Marius


org.apache.jasper.JasperException: Validation error messages from
TagLibraryValidator for c38: tag = 'out' / attribute = 'value': An  
error

occurred while parsing custom action attribute value with value
${fn:length(activityCtrl.openActivitiesForResource)}:
org.apache.taglibs.standard.lang.jstl.parser.ParseException: EL  
functions

are not supported.


-Original Message-
From: Christian Taylor [mailto:[EMAIL PROTECTED]
Sent: 02 August 2005 01:38
To: Tag Libraries Users List
Subject: Re: How to print an int with a c:out tag?


You're using too many ${} combinations :)  You only need them once to
signal an expression. Try this:

c:out value=${fn:length(myController.activitiesForResource)}/

You only need to use ${ ... } for the entire expression; it is not
necessary to use this syntax again inside the expression.

 -Christian


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



--
Murray Steele
Senior Developer

Peoples Archive
w: http://www.peoplesarchive.com
t: 0207 323 0323
d: 0207 631 9147

This email has been scanned by Postini.
For more information please visit http://www.postini.com


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



RE: How to print an int with a c:out tag?

2005-08-02 Thread Marius Botha
You know your stuff hey :)

I believe I do use Tomcat 5 (running inside JBoss 3.2) and as a result have
their JSTL (looks like 1.1) and JSP-2.0.jar. Where do I find or can I check
if I have the TLD for the functions library (so I can include it if
missing)? At the moment I am including the TLD's in my WAR project and
specify them in the web.xml file.

Thanks again.

Marius

-Original Message-
From: Murray Steele [mailto:[EMAIL PROTECTED]
Sent: 02 August 2005 02:31
To: Tag Libraries Users List
Subject: Re: How to print an int with a c:out tag?


I suspect that you are using either Tomcat 4.1.x and / or Standard 1.0x
for your JSTL.  EL functions are part of the JSTL 1.1 spec (JSP 2.0)
and aren't supported on Tomcat 4.1.x or Standard 1.0x (JSP 1.2 and JSTL
1.0 respectively).  If you want to use the fn:length you need to use
JSTL 1.1 and hence Standard 1.1 and / or Tomcat 5.x.  (I think those
versions are correct, someone correct me if I'm wrong).

If you cant change the version of Tomcat / JSTL you use:
1. You could alter your myController.getOpenActivitiesForResource
method to return a class that extends list to provide a getSize() (and
hence your original c:out value=${myList.size}/ would work.
2. Find some other Tag lib that lets you output list sizes.
(unstandard from the sandbox does this)
3. Just use a scriptlet %= ((MyControllerClass)
pageContext.findAttribute(myController)).getOpenActivitiesForResource(
).size() %.

Muz


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



Re: How to print an int with a c:out tag?

2005-08-02 Thread Murray Steele

Perhaps this page might provide the solution?

http://www.oreillynet.com/cs/user/view/cs_msg/32931

Wrong taglib uri's or wrong webapp specification in your web.xml.

Muz

On 2 Aug 2005, at 14:32, Marius Botha wrote:


You know your stuff hey :)

I believe I do use Tomcat 5 (running inside JBoss 3.2) and as a result  
have
their JSTL (looks like 1.1) and JSP-2.0.jar. Where do I find or can I  
check

if I have the TLD for the functions library (so I can include it if
missing)? At the moment I am including the TLD's in my WAR project and
specify them in the web.xml file.

Thanks again.

Marius

-Original Message-
From: Murray Steele [mailto:[EMAIL PROTECTED]
Sent: 02 August 2005 02:31
To: Tag Libraries Users List
Subject: Re: How to print an int with a c:out tag?


I suspect that you are using either Tomcat 4.1.x and / or Standard 1.0x
for your JSTL.  EL functions are part of the JSTL 1.1 spec (JSP 2.0)
and aren't supported on Tomcat 4.1.x or Standard 1.0x (JSP 1.2 and JSTL
1.0 respectively).  If you want to use the fn:length you need to use
JSTL 1.1 and hence Standard 1.1 and / or Tomcat 5.x.  (I think those
versions are correct, someone correct me if I'm wrong).

If you cant change the version of Tomcat / JSTL you use:
1. You could alter your myController.getOpenActivitiesForResource
method to return a class that extends list to provide a getSize() (and
hence your original c:out value=${myList.size}/ would work.
2. Find some other Tag lib that lets you output list sizes.
(unstandard from the sandbox does this)
3. Just use a scriptlet %= ((MyControllerClass)
pageContext.findAttribute(myController)).getOpenActivitiesForResource 
(

).size() %.

Muz


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



--
Murray Steele
Senior Developer

Peoples Archive
w: http://www.peoplesarchive.com
t: 0207 323 0323
d: 0207 631 9147

This email has been scanned by Postini.
For more information please visit http://www.postini.com


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



Re: How to print an int with a c:out tag?

2005-08-02 Thread Christian Taylor
My next guess was going to be one thing mentioned on the page Murray
links to below. Regardless of whether you are using Tomcat 5, JSTL 1.1
and JSP 2.0... if your web.xml doesn't say it's a servlet 2.4 app it
will revert to Servlet 2.3/JSP 1.2 (and trying to use JSTL 1.1 with JSP
1.2 probably introduces many other problems...). As the page says, make
sure your webapp element starts like this:

web-app xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4

Otherwise the container will assume the servlet 2.3 spec and EL will not
be allowed outside of JSTL (1.0) tags. The fn:length() function I
originally mentioned is part of JSTL 1.1 anyway so it sounds like you
just need to make sure everything is configured for the current specs
and you should be good. Hope that will fix it up for you.

 -Christian

Murray Steele wrote:

 Perhaps this page might provide the solution?

 http://www.oreillynet.com/cs/user/view/cs_msg/32931

 Wrong taglib uri's or wrong webapp specification in your web.xml.

 Muz

 On 2 Aug 2005, at 14:32, Marius Botha wrote:

  You know your stuff hey :)
 
  I believe I do use Tomcat 5 (running inside JBoss 3.2) and as a result 
  have
  their JSTL (looks like 1.1) and JSP-2.0.jar. Where do I find or can I 
  check
  if I have the TLD for the functions library (so I can include it if
  missing)? At the moment I am including the TLD's in my WAR project and
  specify them in the web.xml file.
 
  Thanks again.
 
  Marius
 
  -Original Message-
  From: Murray Steele [mailto:[EMAIL PROTECTED]
  Sent: 02 August 2005 02:31
  To: Tag Libraries Users List
  Subject: Re: How to print an int with a c:out tag?
 
 
  I suspect that you are using either Tomcat 4.1.x and / or Standard 1.0x
  for your JSTL.  EL functions are part of the JSTL 1.1 spec (JSP 2.0)
  and aren't supported on Tomcat 4.1.x or Standard 1.0x (JSP 1.2 and JSTL
  1.0 respectively).  If you want to use the fn:length you need to use
  JSTL 1.1 and hence Standard 1.1 and / or Tomcat 5.x.  (I think those
  versions are correct, someone correct me if I'm wrong).
 
  If you cant change the version of Tomcat / JSTL you use:
  1. You could alter your myController.getOpenActivitiesForResource
  method to return a class that extends list to provide a getSize() (and
  hence your original c:out value=${myList.size}/ would work.
  2. Find some other Tag lib that lets you output list sizes.
  (unstandard from the sandbox does this)
  3. Just use a scriptlet %= ((MyControllerClass)
  pageContext.findAttribute(myController)).getOpenActivitiesForResource
  (
  ).size() %.
 
  Muz
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 --
 Murray Steele
 Senior Developer

 Peoples Archive
 w: http://www.peoplesarchive.com
 t: 0207 323 0323
 d: 0207 631 9147

 This email has been scanned by Postini.
 For more information please visit http://www.postini.com


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



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