利用ActionErrors的add方法从资源文件中读出message。对按钮A做判断,按钮B不做判断,按钮C只要提交就可以了。
例如:
<input type='button' onClick='location.href='/your.do?msg=A'" value="按钮A"/>
<input type='button' onClick='location.href='/your.do?msg=B'" value="按钮B"/>
<html:errors property="msg"/>
<input type='submit' value="按钮C"/>在ActionForm中:String msg = request.getParameter("msg");
ActionErrors errors = new ActionErrors();
if(msg.equals("A")){
   errors.add("msg",new ActionError("err.msg"));
}在资源文件中:
err.msg=<input type="text" name="yourname"/>你看这样行不?

解决方案 »

  1.   

    方法是这样:
    jsp中:
    <html>
    <script language="javascript">
    function add_fun() {
      document.form1.action.value="add";
      document.form1.submit();
    }
    function del_fun() {
      document.form1.action.value="del";
      document.form1.submit();
    }
    function ok_fun() {
      document.form1.action.value="ok";
      document.form1.submit();
    }
    <script>
    <body>
    <form name="form1">
    <input type="button" name="button1" value="add" onclick="add_fun();">
    <input type="button" name="button2" value="del" onclick="del_fun();">
    <input type="button" name="button3" value="ok" onclick="ok_fun();">
    <input type="hidden" name="action" value="">
    <%=HelperBean.getTextValue()%>
    </form>
    </body>
    </html>
    在.java中
    写一个helperbean类(略)
    在写一个event类
        request(action)(具体的自己写)
        if(action.equals("add")){
          strText = getHelperbean()
          strText += "<input type='text' name='text1' value=''>";
          setHelperbean(自己写)
        }
        elseif(action.equals("del")){
          删除一个
        }else{
          提交后的处理
        }
    只是个思路
      

  2.   

    谢谢诸位大人的关注但是这个问题是需要在struts框架下的而且,关键是 增加的 输入框 要可以提交!!
      

  3.   

    不管是什么方法的,都可以使用js来实现。使用按钮来控制html的部分内容不显示,就可以实现了