Solved

Reading jslt variable from java

Posted on 2004-08-23
4
336 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Title # Comments Views Activity
gZip compression filter 2 183
using if condition without JSTL 2 115
how to add new optional parameter to JSP 1 55
login form jsp example 2 55
Original post  on Monitis Blog. Web performance monitoring is broken into two camps: passive and active. Passive monitoring is defined as looking at real-world historical performance by monitoring actual log-ins, site hits, clicks, requests for…
Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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