Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getParameterValues and TextArea inputs

 
jhon masco
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a schedule with a textarea, I send this schedule to a sql database (all fine), after I can see the registers retrieving these from the database (a html list or table). All this process work fine but... now I want to edit the textarea value in my html table or list, therefore I changed

by

The System.out is only because I wanted to see what are happenning.
When I execute the query this retrieve the values fine in the textarea elements the first time but when I press the Submit button I want update the database with the new textarea values.
The problem is : when I generate the list again the textarea values are wrong or displaced, is to say, when I check the system.out in the tomcat the values from the textareas are very down for example:
nothing
...
.
..
..nothing
here the values

This seem that the getParameterValues request every row of the textareas as a simple variable.
I am using something as:

Ok, I hope you understand my problem. I can not to post all the code because is too long for to post in a forum!

Excume for my bad english.

Muchas Gracias
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java in your JSP? out.println()?

Your JSP knowledge needs some updating! At this stage you should be doing all your work in the controller and using the JSP only for display and using the JSTL and EL (rather than Java scriptlets).

All that extra gunk on your page is what is causing the extraneous whitespace to appear.

You might find this article helpful regarding how whitespace is handled in a JSP.
 
jhon masco
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Si SeƱor, I need and want update me! but I will do that when I finish this project (I am too advanced in it). Also I am using MVC but I am generating html pages with servlets and using Scriplets in my few JSP pages, all that is wrong in this times!
I will update my knowledges I promise
Thanks for the link I will read all this tomorrow because now is time for sleep here.

Muchas Gracias
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sleep well.
 
kunal porwal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

To get value from text area you will need to use multipart html form.
Then Struts have the ability to read multipart form.

[Edit: non-English text removed]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kunal porwal wrote:To get value from text area you will need to use multipart html form.

That is completely incorrect!

A multi-part form is only necessary for file uploads.
 
jhon masco
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

All that extra gunk on your page is what is causing the extraneous whitespace to appear.

You might find this article helpful regarding how whitespace is handled in a JSP.


Hi Bear, I read the article and analyzed it. Now I see with other eyes the JSP pages I will take more care in how to show the information in the near future and to use these more.
You have a very good methodology for to tell complicated things. Congratulations for that

I had resolved the problem, only I change the out.println by out.write in the part affected

I forget that println is with line-feed, I suppose out.print will work fine also. The "\r\n" is not my case because I am generating the servlet manually.
Now I am having a small problem with getParameterValues function and my algoritm. Before I will explain how is my data table showed:
| value1 | value2 | TextArea | CheckBox |
Then when I check any checkbox and press submit it call other servlet and read the parameters :

The problem is that getParameterValues readthe checkbox checked (that is fine) but read all the textareas input (empty or not). Therefore I have 2 arrays diferents length.
| values | textarea1 | checkbox1 |
| values | textarea2 | checkbox2 |
| values | textarea3 | checkbox3 |

If check the checkboxes 1 and 3 and change the text in the textareas 1 and 3 respectively then when I execute the update it textareas values appear in the wrong place, is to say, textarea3 value will appear in textarea2.
I trying to relation both elements (checkbox and textarea). I can not to use the value property in the textarea for obvious reasons, also I can not to use the ID because getParameterValues not use it, then What I can to do?

Muchas Gracis for All.




 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic