0

I am populating a list of string from jsp to an html <textarea>. e.g.

out.println("<textarea name='word_suggest' rows='10' id='word_suggest'>"); while(it.hasNext()){ out.println(it.next()); } out.println("</textarea>");

I want the user to edit the textarea and read back the values to jsp (e.g. create another list of strings) so that I can work around with the new list. Can I do this without using the <form> and <post> action e.g work around within the same page?

charilaos13
  • 543
  • 2
  • 7
  • 19
  • What do you want to do with the list? You could just code this client-side with javascript, or issue an Ajax request to the server if you need to perform server-side operations with the list. – Xavi López Mar 25 '13 at 09:54
  • I need to pass the words in the – charilaos13 Mar 25 '13 at 10:06
  • Then, issue an Ajax request. Look into [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest) if you're going to do this with pure js, or [`jQuery.ajax()`](http://api.jquery.com/jQuery.ajax/) if you're going to use jQuery. – Xavi López Mar 25 '13 at 10:18
  • Is it possible to give me an example with jQuery on how the syntax goes. I am reading the jQuery.ajax(); but I am more an example guy that needs a kick-start :) – charilaos13 Mar 25 '13 at 10:29
  • See [jQuery AJAX POST example](http://stackoverflow.com/q/5004233/851811). – Xavi López Mar 25 '13 at 10:35
  • The example is nice but it uses a form and a POST. How can I manage the html tags e.g. the textarea within the same jsp and not have to send a post request to another jsp? – charilaos13 Mar 25 '13 at 10:46

0 Answers0