Its server condition. Basically, the will get the HTML text from the DB and a small snippet of each record will be displayed to the user in the JSP without any HTML formatting so that the text doesn't messup the layout or take more space than it should it. I did initially do the stripping on serverside using regex but it became a problem because of the different types of data that can be retrieved from the DB I had to introduce 4 different Maps (mapping resultset to new object) and its taking up around 100+ lines of code. So instead I have decided to stick to just one object map and do the stripping in the JSP instead.
So you have an HTML fragment of text from which you want to strip HTML tags? That's something you'll have to do with something other than JSTL.
Personally, I'd make the changes earlier such that HTML isn't stored in the DB in the first place. But if that's not possible I'd certainly make sure to cleanse the stringprior to forwarding it to the JSP.
I've moved this to a general Java forum with an appropriate change in title as this is not JSP-specific.
Joined: Sep 07, 2008
Well, if I use this method I can remove around 60 or so lines of code. I know how to remove html from strings, I just wanted to know if its possible in JSPs usings JSTL.
I suppose using the string manipulation functions of the JSTL fn function you might be able to figure out a way do it, but ti'd be messy and cumbersome and something not at all suited to doing in a JSP page. Cleanse the string perior to sending to the JSP in the first place.