Jeanne Boyarsky wrote:What are you expecting this line to do?
I might be wrong, but I thought the EL expression got evaluated before the tag.
I'm trying to print out Struts radio buttons.
I'd recommend taking some time and reading this article to better understand how JSPs operate and the their lifecycle.
To sum it up, you can't use a tag to emit other tags.
Bear Bibeault wrote:To sum it up, you can't use a tag to emit other tags.
Okay, that means I need to do some re-thinking about how I'm doing things here. What I'm trying to do is design a JSP with a poll question in it. If the user hasn't voted, he should see the question and have a chance to vote. If he has, I want to show him the results of the poll so far. I want the Struts Action class (which I haven't written yet, and is not germane to the JSP board anyway) to process the vote and send back a cookie indicating that the user has voted. What I want the tag to do is see if the cookie exists and tell the JSP.
Here's the musical question: is it possible for the JSP to read a boolean variable from the tag? If the boolean variable is true, the user gets the poll results. If it's false, the user gets the Struts form, which would be encoded in the JSP itself. I know enough about JSTL to know how to use variables local to the JSP, but I'm not sure if the JSP can take a variable from a tag. Maybe I missed it in the link that Bear put up, but I didn't see anything about how to accomplish that, i. e., what syntax I would be using. I'm presuming I'm going to need a c:if statement here. If I'm wrong, please set me straight.
Bear Bibeault wrote:Not exactly sure what you are asking, but if you are asking if a tag can set a scoped variable that the JSP can test for, then yes.
Yes, that sounds like what I'm asking. I've Googled and figured out how to use c:set to declare a variable in the JSP, but the one thing I don't understand is this. How do I associate a variable in my JSP with a variable in my tag? In other words, how do I let the JSP know that the variable set in the tag is the variable I want the JSP to test for?