SoFunction
Updated on 2025-03-01

Questions about script manipulation text fields

Use jsp+servlert. After the content entered in the text box reaches the rightmost, the text content will automatically return to the line.
When I deposit it into the database and display it, I want to get content that is exactly in line with the input form, but I have no way to get it.
That is, I can only find hard pressed content but cannot recognize the content that automatically returns after the content is full.
I'm wondering now if there is a way to get a line-by-line reading from a text field, similar to reading a text file's readline
Which expert can help me, please give me some advice
Line breaks in the text field cannot be displayed in the database, but they do exist
After reading the data, the format displayed in the text field is the original format and will not change.
If you want to display it directly on the web page, you need ("\n","<br>").replace(" ","& nbsp;")
But in this way, the text field will not be displayed automatically

To display the text field intact, in addition to the above steps, you have to use the div to put data, set the div width and the text field to be consistent, and then set the div automatic line wrapping attribute, and then set the

[Ctrl+A Select all Note:Introducing external Js requires refreshing the page before execution]

Thank you very much for changing it should be fine
I have another question to bother you, that is, when there are full and half-widths in the text field.
For example: dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
At this time, his effect in the text field is
ddddddddddddddddddddddddddddddddddd on time
dddddddddddddddd
Normally, it should be:
ddddddddddddPlace on timedddddddddddd
dddd
I wonder if there is a way to avoid this problem? Does the text field have such an attribute to control it will not wrap the line like in Method 2