"5-5" code mall implement agricultural product data submitted to the Mysql database

Can not access Youtube?
1. Click on build your own ss and open bbr fast Internet tutorials to easily access Youtube 1080p high-definition video.
2. Click on this section b station video tutorials address to watch.

We have previously acquired through reverse engineering to the Product entity class, so when we submit the form data, we need the value of the tag name and attribute-value pair.

1
2
3
4
5
6
7
8
9
private Integer id;
private Short categoryId;
private String name;
private String image;
private Long maketPrice;
private Long price;
private Byte status;
private String description;
private String productNumber;

For some values ​​need to get through js, we can use the input tag hidden attribute to receive data:

1
2
3
<input type="hidden" name="categoryId"  />
<input type="hidden" name="image" />
<input type="hidden" name="description" />

For access to classified id:

1
2
3
4
5
6
7
8
9
10
11
12
$("#addProductForm").find("select[name='cid2']").combobox({
onChange: function() {
var value=$("#cc2").val();

IF (value == 0 ) {
$ ( Big Box   "5-5" code mall implement agricultural product data submitted to the Mysql database S = "String"> "# addProductForm" ) .find ( "the INPUT [name = 'categoryId'] " ) .val ($ ( " #addProductForm " ) .find ( " INPUT [name = 'CIDl'] " ) .val ());
} the else {
$ ( " #addProductForm " ) .find ( " INPUT [name = 'categoryId'] " ) .val (value);
}

}
});

For image acquisition path:

1
2
3
4
success: function (data) {
$("#img").attr("src", "http://65.49.227.129:8888/" + $(data).find("body").text());
$("#addProductForm").find("input[name='image']").val($(data).find("body").text());
}

For the acquisition of goods Description:

1
UE.getEditor('editor').getContent()

Form submission form:

1
2
3
4
5
.post $ ( "/ product_save" , $ ( "#addProductForm" ) .serialize (), function ( Data ) { IF (data.status == 200 is ) {               $ .messager.alert ( 'prompt' , 'new product success'! );           } });




Controller:

1
2
3
4
5
6
(value = "product_save",method = RequestMethod.POST)
@ResponseBody
public ResponseJsonResult (Product product){
ResponseJsonResult responseJsonResult = productService.saveProduct(product);
return responseJsonResult;
}

SSM video tutorial directory

Guess you like

Origin www.cnblogs.com/wangziqiang123/p/11712117.html