NutzCN Logo
问答 表单传递数据 input name 相同的如何传递
发布于 2332天前 作者 qq_5a88e4e5 1619 次浏览 复制 上一个帖子 下一个帖子
标签:

<input type="text" name="stock_name"  class="col-sm-5 form-input" validate="required"/>
<input type="text" name="stock_name"  class="col-sm-5 form-input" validate="required"/>
<input type="text" name="stock_name"  class="col-sm-5 form-input" validate="required"/>
7 回复

还有这种操作……

用String[]接收

方法该如何去写


<script> $(document).ready(function () { var num=document.getElementsByTagName("input").length; $("#AddMoreTextBox").click(function (e) { num++; $("#add").append('<div>' + '<input type="text" name="model_type" placeholder="模型类型" class= "form-input" validate="required"/>' + '<input type="text" name="model_value" placeholder="模型值" class=" form-input" validate="required"/>' + '<input type="text" name="model_desc" placeholder="描述" class="form-input" validate="required"/>' + '<a href="#" class="removeclass"><input type=\'button\' value=\'删除\'></a></div>'); }); $("body").on("click",".removeclass", function(e) { //user click on remove text if (num > 1) { $(this).parent('div').remove(); //remove text box num--; //decrement textbox } }) }); </script> <div class="page-header"> <h1> 产品模型 <small> <i class="ace-icon fa fa-angle-double-right"></i> <span class="form-head">新增</span> </small> </h1> </div><!-- /.page-header --> <div class="row"> <div class="col-xs-12"> <!-- PAGE CONTENT BEGINS --> <form class="form-horizontal" role="form" method="post" action="${base}/product/model/add"> 模型详情列表:<a href="#" id="AddMoreTextBox" >添加输入框</a> <div class="form-group"> <label class="col-sm-3 control-label no-padding-right">模型名称</label> <div class="col-sm-9"> <input type="text" name="model_name_one" placeholder="模型名称" class="col-sm-5 form-input" validate="required"/> </div> </div> <div class="form-group" id="add" > </div> <div class="clearfix form-actions"> <div class="col-md-offset-3 col-md-9"> <button class="btn btn-white btn-info form-submit" type="button"> <i class="ace-icon fa fa-check bigger-110"></i> 提交 </button> &nbsp; &nbsp; &nbsp; <button class="btn btn-white" type="reset"> <i class="ace-icon fa fa-undo bigger-110"></i> 重置 </button> </div> </div> </form> </div> </div>
@At
	@POST
	@RequiresPermissions("product.model.add")
	@Desc("产品模型.添加")
	@Ok(HtmlViewMaker.VIEW_JSON)
	public Object add(@Param("..") List<ProductModel> productmodel,@Param("model_name_one")String model_name) throws AlertException {
		System.out.println(Json.toJson(productmodel));
		System.out.println(model_name);
		//dao.insert(productmodel);
		return Result.ok();
	}

文档有,要么前缀表单,要么走json

前缀表单如何去写

添加回复
请先登陆
回到顶部