Solved

Reading jslt variable from java

Posted on 2004-08-23
4
334 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

860 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