By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,653 Members | 1,483 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,653 IT Pros & Developers. It's quick & easy.

fetching database values into a textarea with jsp page

P: 52
hi
i have a problem about to fetch the value into the textarea with jsp page which contains characters and symbols also

there is one textarea tag field on my jsp form and i want to retrieve value for that textarea tag field from mysql database.
same if i use <input type...> tag then all is well done but is problems with only textarea tag.
what to do for retrieve the value ..?
plz help me.
with regard
Mar 1 '12 #1

✓ answered by r035198x

You put the value between the text area tag

Expand|Select|Wrap|Line Numbers
  1. <textarea name='textAreaName' id='textAreaId'>
  2. <c:out value="${variableWithTheValue}"/>
  3.  
  4. </textarea>

Share this Question
Share on Google+
9 Replies


10K+
P: 13,264
You put the value between the text area tag

Expand|Select|Wrap|Line Numbers
  1. <textarea name='textAreaName' id='textAreaId'>
  2. <c:out value="${variableWithTheValue}"/>
  3.  
  4. </textarea>
Mar 1 '12 #2

P: 52
hi ro35198x thankx for ur quick response.
actually i am beginner in java with jsp so i need to create one profile editing form where some input, textarea, and some dropdown fields are there and want to retrieve value from mysql database for that fields.
now plz can u give me one demo example then i think i will be get right way to code .
plz r035198x
with regard
Mar 1 '12 #3

10K+
P: 13,264

P: 52
i am using mysql database for this .
then how to do that ?
Mar 1 '12 #5

10K+
P: 13,264
You write a data access layer that connects to the database to give you back the results.
The easiest way is to use JPA/Hibernate because then you don't have to write any SQL and your code should work on any database.
If JPA is not an option then write write your own data access layer using JDBC which returns DTOs that you use in your JSPs' backing beans.
Mar 1 '12 #6

P: 52
sir i am beginner all these things which u r suggest me i can't understand there is any easy way ?
or if possible then plz send me one demo example which is use to retrieve database value from mysql with jsp form.
or like edit profile code.
plz.
Mar 1 '12 #7

10K+
P: 13,264
You need to spend time reading about all these things that you need to use before writing the application then.
Here is a useful blog for JSF: http://balusc.blogspot.com/2008/10/e...d-sorting.html
Mar 1 '12 #8

P: 52
ya u r right r035198x.
and r035198x i use ur suggested syntax for value retrieve and it's work perfectly ,
thank you very much .
plz suggest me what to do best practice for jsp programmer i like to work in it.
and finally i retrieve the values so i am very happy.
again thanks but one more problem is there what about dropdown box how to retrieve values on form from mysql....?
best regard
Mar 1 '12 #9

10K+
P: 13,264
Generally you should prefer developing web applications with JSF/Facelets these days according to the EE6 spec.

You display select options using a <c:foreach tag that loops through a collection of objects. In the loop you create the select options and display them, something like

Expand|Select|Wrap|Line Numbers
  1. <select name="selectName"> 
  2.    <c:forEach var="listItem" items="${list}" >
  3.      <option value="${listItem.id}"> 
  4.           <c:out value="${listItem.name}" />
  5.      </option>
  6.    </c:forEach>
  7. </select>  
Mar 1 '12 #10

Post your reply

Sign in to post your reply or Sign up for a free account.