Solved

Reading jslt variable from java

Posted on 2004-08-23
4
329 Views
Last Modified: 2008-02-01
Hello

I need read a x jstl variable from java. I have the next code:

<x:forEach var="unit" select="$document/wap/menu/principal/*" >
   <:set var="var1" select="./@href"   /><br/>
    The value of var1 is <%=pageContext.getAttribute("var1").toString()%> from java <br/>
</x:forEach>

but i don´t read de var1 value.
I can't use the <x:out select="./@value" /> because I need the var1 value in java code.

the xml is :

<wap>
<menu>
   <principal>
      <miActividad href="/servlet/ServletEntrada" position="1"/>
      <buscarActividad href="/servlet/ServletEntrada" position="2"/>
   </principal>
</menu>
</wap>

Thanks
0
Comment
Question by:candidootero
  • 2
4 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 11878552
Does this help?

<x:forEach var="unit" select="$document/wap/menu/principal/*" >
   <x:set var="var1" scope="request" select="./@href" /><br/>
    The value of var1 is <%= request.getAttribute( "var1" ).toString() %> from java <br/>
</x:forEach>

0
 
LVL 4

Accepted Solution

by:
Mr_It earned 500 total points
ID: 11879791
Try to use the string function in the select attribute of the <x:set>-tag

<x:set var="var1" select="string(./@href)"  /><br/>

Maybe you have to use the category var you specify in the <x:forEach>-tag:

<x:set var="var1" select="string($category/@href)"  /><br/>

Greetz
0
 

Author Comment

by:candidootero
ID: 11880002
Thanks Greetz,

the string function works fine.
0
 
LVL 4

Expert Comment

by:Mr_It
ID: 11880292
My pleasure :)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
rebasing and merging used in SCM 1 72
java cyclic graphs 15 210
TreeSet comparator example 7 95
java operators 3 116
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question