jstl and Atom feeds

2005-05-26 Thread Digby

Hi all,

I'm probably being daft here, but I'm having a problem using jstl xpath 
with a simple Atom feed.


Here's my code:

c:import var=feed url=http://darthside.blogspot.com/atom.xml/
x:parse var=doc doc=${feed} /
x:out select=$doc/feed/link/title/text()/
x:forEach select=$doc/feed/entry
 hello
/x:forEach
hr/
x:out select=$doc/

The final x:out shows the whole document, so it seems to be parsing 
okay, but I can't get any of the contents out using xpath.


Please put me out of my misery!

TIA

Digby


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



jstl and splitting carriage returns

2005-05-26 Thread Digby

Hi again,

Anyone know if it's possible to do an fn:split on carriage returns (\n). 
I just get invalid expression error messages with:


c:forEach items='${fn:split(feed, \n)}' var=row
c:out value=${row}/
/c:forEach

TIA


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



RE: jstl and splitting carriage returns

2005-05-26 Thread Ohring, Peter
I had the same problem last week. For whatever reason (The JSP policy on
whitespace) I couldn't set a variable to \n but I could create one
using the following hack:

c:set var=temp value=one
two/
c:set var=newline value=${fn:substring(temp,4,5)}/

(Note that on my windows computer temp=one\r\ntwo so that the 5th
character is the newline character)

Then you should be able to split the string using this new variable,
e.g.

c:forEach items='${fn:split(feed, newline)}' var=row
c:out value=${row}/
/c:forEach

Peter

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Digby
Sent: Thursday, May 26, 2005 5:24 AM
To: taglibs-user@jakarta.apache.org
Subject: jstl and splitting carriage returns

Hi again,

Anyone know if it's possible to do an fn:split on carriage returns (\n).

I just get invalid expression error messages with:

 c:forEach items='${fn:split(feed, \n)}' var=row
 c:out value=${row}/
 /c:forEach

TIA


-
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: jstl and splitting carriage returns

2005-05-26 Thread Digby

Cool. Will give it a try. Thx.

Ohring, Peter wrote:

I had the same problem last week. For whatever reason (The JSP policy on
whitespace) I couldn't set a variable to \n but I could create one
using the following hack:

c:set var=temp value=one
two/
c:set var=newline value=${fn:substring(temp,4,5)}/

(Note that on my windows computer temp=one\r\ntwo so that the 5th
character is the newline character)

Then you should be able to split the string using this new variable,
e.g.

c:forEach items='${fn:split(feed, newline)}' var=row
c:out value=${row}/
/c:forEach

Peter

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Digby
Sent: Thursday, May 26, 2005 5:24 AM
To: taglibs-user@jakarta.apache.org
Subject: jstl and splitting carriage returns

Hi again,

Anyone know if it's possible to do an fn:split on carriage returns (\n).

I just get invalid expression error messages with:

 c:forEach items='${fn:split(feed, \n)}' var=row
 c:out value=${row}/
 /c:forEach

TIA


-
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: Jstl function

2005-05-26 Thread ::SammyRulez::
make a tld with a tag like this

function
  nameceil/name
  function-classjava.lang.Math/function-class
  function-signaturedouble ceil( double)/function-signature
/function

and in your jsp (assuming you have mapped the tld as /functions)

%@ taglib uri=/functions prefix=f % 
...
${f:ceil(your_number_var)}


 


On 5/26/05, Dominguez Valle Carolina [EMAIL PROTECTED] wrote:
 Hi, Is there a way to call the Math function ceil with the EL on a JSP??
 
 regards.
 
 Carolina
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
::SammyRulez::
http://sammyprojectz.blogspot.com

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



join and arrays

2005-05-26 Thread Kralidis,Tom [Burlington]

Hi,

I have a JSP which parses an XML document and inserts records into a DB.

For multiple XML elements, I do the following:

sql:transaction dataSource=${ds_devgeodb}
 sql:update
  insert into service_endpoints (keywords) values
 ('x:forEach
select=$doc/WMT_MS_Capabilities/Service/KeywordList/Keyword
var=kwx:out select=text()/,/x:forEach')
 /sql:update
/sql:transaction

Which works okay, except that the values in the DB end up as:

keyword1,keyword2,keyword3,

..whereas I would prefer

keyword1,keyword2,keyword3

(i.e. without the trailing comma)

I checked the fn:join() function, which looks like it would do the
trick, but how does one set an array in JSTL?

Any advice would be appreciated.

Thanks

..Tom

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



Re: join and arrays

2005-05-26 Thread Rahul P Akolkar
Lookup the varStatus attribute of x:forEach, it will allow you to query 
for boundary cases (first/last) amongst other things and you can use that 
to decide when the trailing delimiter is not needed (for the last 
iteration of the forEach).

-Rahul

On 5/26/05, Kralidis,Tom [Burlington] [EMAIL PROTECTED] wrote:
 
 Hi,
 
 I have a JSP which parses an XML document and inserts records into a DB.
 
 For multiple XML elements, I do the following:
 
 sql:transaction dataSource=${ds_devgeodb}
  sql:update
  insert into service_endpoints (keywords) values
  ('x:forEach
 select=$doc/WMT_MS_Capabilities/Service/KeywordList/Keyword
 var=kwx:out select=text()/,/x:forEach')
  /sql:update
 /sql:transaction
 
 Which works okay, except that the values in the DB end up as:
 
 keyword1,keyword2,keyword3,
 
 ..whereas I would prefer
 
 keyword1,keyword2,keyword3
 
 (i.e. without the trailing comma)
 
 I checked the fn:join() function, which looks like it would do the
 trick, but how does one set an array in JSTL?
 
 Any advice would be appreciated.
 
 Thanks
 
 ..Tom
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


counter in forEach tag?

2005-05-26 Thread Scott Purcell
Hello,
I have this scenario come up occasionally, and have to opt to JSP expressions 
on the page for a work-around.

 c:choose
  c:when test=${assetCollection == null}
 nothing
  /c:when
  c:otherwise
c:forEach var=asset items=${assetCollection}


BODY


  c:out value=${asset.assetId} /
/c:forEach
  /c:otherwise
/c:choose


In the forEach section, I am going to create a rows in a table which will be 
different colors for each row. How can I put in a counter that I can then 
change the row color for? Basically, I would like to know what asset I am on in 
the body.

Thanks,
Scott


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



RE: counter in forEach tag?

2005-05-26 Thread Karl Coleman
You can use the varStatus property of the forEach tag.

c:forEach var=asset items=${assetCollection} varStatus=status

And then you can get the current count of the iteration.

${status.count}

Karl

-Original Message-
From: Scott Purcell [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 26, 2005 12:58 PM
To: taglibs-user@jakarta.apache.org
Subject: counter in forEach tag?


Hello,
I have this scenario come up occasionally, and have to opt to JSP expressions 
on the page for a work-around.

 c:choose
  c:when test=${assetCollection == null}
 nothing
  /c:when
  c:otherwise
c:forEach var=asset items=${assetCollection}


BODY


  c:out value=${asset.assetId} /
/c:forEach
  /c:otherwise
/c:choose


In the forEach section, I am going to create a rows in a table which will be 
different colors for each row. How can I put in a counter that I can then 
change the row color for? Basically, I would like to know what asset I am on in 
the body.

Thanks,
Scott


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


The information contained in this transmission contains confidential  
information that is legally privileged. This information is intended only for 
the use of the individual or entity named above. The authorized recipient of 
this information is prohibited from disclosing this information to any other 
party unless required to do so by law or regulation and is required to destroy 
the information after its stated need has been fulfilled.
If you are not the intended recipient, you are hereby notified that any 
disclosure, copying, distribution, or action taken in reliance on the contents 
of these documents is strictly prohibited. If you have received this 
information in error, please notify the sender immediately by return email or 
phone at 800-223-9941 and arrange for the return or destruction of these 
documents.


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



Re: counter in forEach tag?

2005-05-26 Thread Rahul P Akolkar
varStatus is good here too, it can give you the count of the current 
iteration. With that, for example, you can do a modulo 2 operation for 
alternating bgcolors or style classes.

-Rahul


Scott Purcell [EMAIL PROTECTED] wrote on 05/26/2005 12:58:20 PM:

 Hello,
 I have this scenario come up occasionally, and have to opt to JSP 
 expressions on the page for a work-around.
 
  c:choose
   c:when test=${assetCollection == null}
  nothing
   /c:when
   c:otherwise
 c:forEach var=asset items=${assetCollection}
 
 
 BODY
 
 
   c:out value=${asset.assetId} /
 /c:forEach
   /c:otherwise
 /c:choose
 
 
 In the forEach section, I am going to create a rows in a table which
 will be different colors for each row. How can I put in a counter 
 that I can then change the row color for? Basically, I would like to
 know what asset I am on in the body.
 
 Thanks,
 Scott
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]