aspose file tools*
The moose likes JSP and the fly likes getParameterValues and TextArea inputs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "getParameterValues and TextArea inputs" Watch "getParameterValues and TextArea inputs" New topic
Author

getParameterValues and TextArea inputs

jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93
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

Joined: Jan 10, 2002
Posts: 61654
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jhon masco
Ranch Hand

Joined: May 13, 2010
Posts: 93


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

Joined: Jan 10, 2002
Posts: 61654
    
  67

Sleep well.
kunal porwal
Greenhorn

Joined: Aug 17, 2010
Posts: 1
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

Joined: Jan 10, 2002
Posts: 61654
    
  67

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

Joined: May 13, 2010
Posts: 93

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.




 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getParameterValues and TextArea inputs