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 variable
  • c:set variables not in xml scope, unlike x:parse variables
  • userroleselector jsp variable

to test role-id properly, try instead:

[@role-id='test'] 

to test jsp variable, try instead:

[@role-id=$sessionscope:userroleselector] 

references


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -