//log1.jsp页面 
String replier=request.getParameter("name"); 
if(replier!=null) 
{......} 



<form action="log1.jsp" method="post"> 
<tr><td>大名:<input name="name" type="text" /></td></tr> 
<tr><td><input type="submit" name="submit" value="提交"></td></tr> 
</form> 以上程序是由form表单中获得name参数,然后返回log1.jsp页面(即自身),用内置对象request获得name参数并赋给replier,然后执行其他操作。 
我现在想在replier获得name参数后,将表单中name的数据清空~ 
应该怎么做???

解决方案 »

  1.   

    在form中加入判断标志位
    <input type="hidden" name="isSelf" value="0">
    默认为0,如果需要“返回log1.jsp页面(即自身)”,置为1
    document.getElementsByName("isSelf")[0].value="1";
    然后提交在“返回log1.jsp页面(即自身)”之前,判断request.getParameter("isSelf")是否为1
    1就不提交,0就提交
      

  2.   

    出发一个 事件 javascript
       form.name.value="";
      

  3.   

    其实我意思是,现在我给表单中输入数据一次以后,由于name参数不为空了,所以在每次刷新页面的时候,if(replier!=null) 语句都要被重新执行一次,我就是想令到if(replier!=null) 语句在页面刷新时不再被重新执行,所以就想到清空表单的数据了~!
      

  4.   

    <%
    String replier=request.getParameter("name"); 
    if(replier!=null) 
    {
      out.println("<script language=\"javascript\">document.all(\"name\").value='';</script>")
    %>
    } %>
      

  5.   

      request.removeAttribute("")
      

  6.   

    配置映射文件时候。
    <action name="loginForm" 
    path="/login"
    type="org.springframework.web.struts.DelegatingActionProxy">
    后边在加一个属性scope="request"
    这样每次请求都会清空了。
      

  7.   

    在文本框中添加一个属性 value=“”也可以的
      

  8.   

    配置映射文件时候。 
    <action name="loginForm" 
    path="/login" 
    type="org.springframework.web.struts.DelegatingActionProxy"> 
    后边在加一个属性scope="request" 
    这样每次请求都会清空了。
    支持!