• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I use a <c:out ...> tag in my <input ...> tag?  RSS feed

 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using JSTL 1.2 and am trying to incorporate a <c:out ...> tag in my JSP page. What I want to do is use the member value from my backing bean as the value to be displayed for a form input element, and I want any HTML/XML special characters escaped.

In searching for examples (including in the JSTL spec), I can't find any that do what I'm trying to do, and I'm wondering if I'm misunderstanding the usage of the tag.

By the way, I added a simple <c:forEach ...> block to my JSP page, just to make sure that the JSTL stuff is set up correctly, and got the output I was expecting (it just output 10 numbers with <br> line breaks).

My JSP page includes the following useBean line My original (working) input tag looks like this:
Note that the getMemberNameEncoded() method is a special accessor method I created on the Bean to escape any HTML/XML special characters (this additional method is what I'm trying to avoid).

Now, I would like to use the <c:out> tag to get the value from the bean rather than using the JSP Expression. I see the format for the <c:out> tag is supposed to look like this: but I can't see how to get this into the above input element.

Can someone please show me the correct syntax for doing this?

Thanks,
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Bear. That is intuitive, and I would have sworn I tried it

It is working now.

Best Regards,
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!