jsp - jstl xml variables for select attribute -
i'm using jstl xml specified values xml
here i'm using "userroleselector" variable select node. variable set as,
<c:set var="userroleselector" value="role-id='test'" scope='session'/>
the tag use variable follows,
<x:if select="$parsedrolexml//roles/role[$userroleselector]/features/feature[text()='viewevents']"> //html code </x:if>
the node not selected according role-id provided. works if use right hand side variable.
what issue here?
there few problems here:
- the xpath predicate syntax
[$userroleselector]
not doing comparison - the xpath predicate syntax searching index, not attribute value
userroleselector
not xpath variablec:set
variables not in xml scope, unlikex:parse
variablesuserroleselector
jsp variable
to test role-id properly, try instead:
[@role-id='test']
to test jsp variable, try instead:
[@role-id=$sessionscope:userroleselector]
references
Comments
Post a Comment