Micle Micle - 1 year ago 59
HTML Question

How to keeping textarea content after a form submition with jsp not duplicate?

I want to keep the textarea content in its filed after a form submition ... I work with jsp I try to do like this here solve to same problem but it not work with me
my code :

<form class="contact-form" id="preview-form" action="textAreaData" method="post">
<textarea id="preview-form-comment" name="preview-form-comment">${fn:escapeXml(param.preview-form-comment)}</textarea>
<input type="submit" name="preview-form=submit" id="preview-form-submit" value="Submit" >

and this is the result :
display number 0 and when I submit the input it Disappears from its filed after a form submition

what wrong ? can help ?

Answer Source

ok , the easy way :

in your servlet define :

String comment = request.getParameter("preview-form-comment") ;

request.setAttribute("anydata", comment);

and in your textarea write :

 <textarea id="preview-form-comment" name="preview-form-comment">${anydata}</textarea>

it run :) good luck

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download