Spring eats tags </textarea>

In my web application (my first one with Java, Spring, OR Roo) I create a form that has nothing to do with any JPA objects, it's just a form. I really don't want to use JSTL to create my forms here, because at the moment there is no data support for them. I use tiles to build pages, so the guts of this form come from a view, but there is nothing JSPish about it; it is just a form.

Inside this form, I have a text area that I wrote:

<textarea id="whatever" name="whatever"></textarea> 

When it comes to the screen, the </textarea> tag has disappeared. Different browsers deal with this in different ways, up to and including swallowing the rest of the HTML body inside the text area field.

So, I tried to put some content inside this text box. Spaces and line breaks do not change their behavior, but it seems that any non-spatial character does. If i go

 <textarea>.</textarea> 

... he respects my textarea tag. But then, of course, my text area is displayed on the screen with a dot in it, which is not what I want.

Is this a known issue? Am I doing something wrong?

EDIT: @bozho: Here is a stray piece of my jsp:

 <div id="notes" class="detailPanel"> <div class="panelLabel">Notes</div> <table > <thead><tr><th>Date</th><th>By</th><th>Note</th></tr></thead> <tbody id="notesBody"></tbody> </table> <textarea id="newNote" rows="5" cols="80" >.</textarea> <button id="addNewNote" onClick="saveNote();">Add New Note</button> </div> 

Absolutely nothing unusual happens here (I fill tbody with lines on the client, why is it empty). Without a dot in the third or last line, the closing textarea tag does not appear in the resulting HTML.

EDIT2 (Solution):

This URL became googlable after listening to some keywords from people answering here: http://www.jroller.com/komu/entry/textareas_with_jspx

It turns out that when analyzing jspx pages, empty tags are collapsed into a single self-closing tag that breaks the text areas. The solution is to put the empty jsp: text in the middle:

 <textarea><jsp:text /></textarea> 

(which is STABLE stupid, but there it is.)

+6
source share
1 answer

Are you using jspx files correctly? In general, jspx removes something (or in your case it shortens it: check this: I expect it to add a slash to the previous open tag, so it becomes: <textarea id="whatever" name="whatever"/> ), where he believes that this is not necessary. What exactly depends on the implementation.

So put the <jsp:text> tag in the text area tag so that it doesn't close

 <jsp:text> <textarea id="whatever" name="whatever"></textarea> </jsp:text> 

Strike>

 <textarea id="whatever" name="whatever"><jsp:text /></textarea> 

for a more complex example, consider this answer: websphere 7 (and Spring Roo), incompatible with javax.el.ELException

+6
source

Source: https://habr.com/ru/post/899697/


All Articles