Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Mariano Ruiz
JSP strip string variables
January 28, 2013 6:22 AM
Answer

Mariano Ruiz

Rank: New Member

Posts: 10

Join Date: November 4, 2010

Recent Posts

When I use the component <aui:input type="textarea" name="observations" /> in a JSP page, if the variable observations have this value (look the line return):

1Hello..
2..World!


This I have in the result HTML code:

1<textarea id="portletXXX_id_observations" name="portletXXX_id_observations">Hello..
2..World!</textarea>


But, if I not use the component, and I put this code in my JSP code:

1<textarea id="<portlet:namespace />observations" name="<portlet:namespace />observations">${observations}</textarea>


I obtains this:

1<textarea id="portletXXX_id_observations" name="portletXXX_id_observations">Hello.. ..World!</textarea>


The break line is striped! I know if I add in the URL the parameter "strip" then the HTML is not striped, but this is for development testing. Also I can put a variable in portal-ext.properties to prevent this, but I don't want do that, only I want prevent the string strip.

Also I try this:

1<textarea id="<portlet:namespace />observations" name="<portlet:namespace />observations"><c:out value="${observations}" /></textarea>


And this:

1<textarea id="<portlet:namespace />observations" name="<portlet:namespace />observations"><%= observations %></textarea>


Nothing worked.
Vilmos Papp
RE: JSP strip string variables
January 28, 2013 6:47 AM
Answer

Vilmos Papp

LIFERAY STAFF

Rank: Liferay Master

Posts: 521

Join Date: October 21, 2010

Recent Posts

Hi,

Try to turn of StripFiler in your portal-ext.properties:

1com.liferay.portal.servlet.filters.strip.StripFilter=false


Regards,
Vilmos
Mariano Ruiz
RE: JSP strip string variables
January 28, 2013 7:16 AM
Answer

Mariano Ruiz

Rank: New Member

Posts: 10

Join Date: November 4, 2010

Recent Posts

Thanks Vilmos, but I say:

... Also I can put a variable in portal-ext.properties to prevent this, but I don't want do that, only I want prevent the string strip.


Only I want prevent this behaviour when I print a string.

Maybe I should look at the source code of the tag aui:input to see how it does ...
Mariano Ruiz
RE: JSP strip string variables
April 3, 2013 9:09 AM
Answer

Mariano Ruiz

Rank: New Member

Posts: 10

Join Date: November 4, 2010

Recent Posts

I found the the solution, sorry for the late of the response.

I found this making introspection and debugging into the StripFilter class, but the solution is very simple: only you need put a blank space after “<textarea” text (“<textarea >”), in this way, StripFilter recognize the content of the tag (ended with </textarea> ) as no strip content.

This is a regression bug, because in previous versions of Liferay this error was reported and fixed, but anyway, we can solve the problem with this “hack”.