tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul P Akolkar <akol...@us.ibm.com>
Subject Re: join and arrays
Date Thu, 26 May 2005 13:54:22 GMT
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] <Tom.Kralidis@ec.gc.ca> 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="kw"><x: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: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message