my dog learned polymorphism*
The moose likes JSP and the fly likes Bug Interpreting HTML Tag in Java Bean using c:forEach Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Bug Interpreting HTML Tag in Java Bean using c:forEach" Watch "Bug Interpreting HTML Tag in Java Bean using c:forEach" New topic
Author

Bug Interpreting HTML Tag in Java Bean using c:forEach

Khosrow Moossavi
Greenhorn

Joined: Aug 08, 2005
Posts: 26
CategoryModel.java


CategoryAction.java


category.jsp


The thing is everything ok, and the array of bean is generated correctly and with forEach item i can iterate through the array, and show them. But the ${item.subcategoryDescr} is written exactly as the code above on the screen. The <A> Tag is not interpreted into the Html, in order to show the result. the page is like this:



which should be like :


I put some html tag in bean object, and try to show them on the page, which it worked correctly. but for the Array Object, and forEach tag, it's not work correctly?

Could you see where I was doing something wrong?
[ November 28, 2008: Message edited by: Khosrow Moossavi ]

SCJP and SCWCD are going to be installed here.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Refer to the JSTL Specification for the behavior of <cut>. You should easily see what is happening and how to prevent it.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Khosrow Moossavi
Greenhorn

Joined: Aug 08, 2005
Posts: 26
Thanks a lot Mr. Sheriff!
I really didn't expect that would be the source of my problem.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

That's the default behavior of <cut> in order to help prevent cross-site scripting security issues.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bug Interpreting HTML Tag in Java Bean using c:forEach
 
Similar Threads
How to display arraylist value in jsp, using JSTL tags?
unable to display bean property using ArrayList
Beans and c:forEach
Display using DataTable
How to use for loop inside of dropdownlist at jsp?