Reputation: 911
I have a custom tag like this <user:current-location msg="!{#locationName}"/>
which works fine, but I want to assign it to a variable so I can pass the current location value to a servlet using a form.
I have tried setting the variable using <c:set var = 'location_id' scope = 'session' value = '<user:current-location msg="!{#locationName}">'/>
but when I do <c:out value = '${location_id}'/>
, instead of printing out the name of the current location on the page, it just prints out <user:current-location msg="!{#locationName}">
How can I get it to access what’s actually assigned to the variable?
If I can get that working, I would then like to do something like this in my form to be passed to the servlet in the post request <input type="radio" name="locationName" value="${location_id}" checked="checked">
I cannot use the old scriptlet syntax as this is deprecated.
Upvotes: 0
Views: 583
Reputation: 743
Try like this :
<c:set var = "location_id" scope ="session">
<user:current-location msg="!{#locationName}"/>
</c:set>
Upvotes: 1