Micle Micle - 5 months ago 23
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 ?


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