如何在jsp不重复的情况下保留表单子文件的textarea内容? [英] How to keeping textarea content after a form submition with jsp not duplicate?

查看:291
本文介绍了如何在jsp不重复的情况下保留表单子文件的textarea内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在表单提交后将textarea内容保存在其提交的文件中...我使用jsp工作我尝试这样做这里解决相同的问题,但它不适用于我
我的代码:

 < form class =contact-formid =preview-formaction =textAreaDatamethod =post > 
< textarea id =preview-form-commentname =preview-form-comment> $ {fn:escapeXml(param.preview-form-comment)}< / textarea>
< input type =submitname =preview-form = submitid =preview-form-submitvalue =Submit>
< / form>

这就是结果:
显示数字0,当我提交输入时,它在表单提交后从其提交的文件中消失



有什么错?可以帮忙吗?

解决方案

好吧,简单的方法:

你的servlet定义了:

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

request.setAttribute(anydata,comment);

并在您的textarea中写入:

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

运行:)祝你好运


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"  >
 </form>

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

这篇关于如何在jsp不重复的情况下保留表单子文件的textarea内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆