Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将数据插入数据库,从JSP获取输入并使用spring restful服务存储数据,_Spring_Jsp_Spring Mvc - Fatal编程技术网

如何将数据插入数据库,从JSP获取输入并使用spring restful服务存储数据,

如何将数据插入数据库,从JSP获取输入并使用spring restful服务存储数据,,spring,jsp,spring-mvc,Spring,Jsp,Spring Mvc,我的JSP代码是:feedback.JSP 客户反馈 名称

我的JSP代码是:feedback.JSP

客户反馈

名称

@RestController代码:

@RequestMapping(value=“/customer/new”,method=RequestMethod.POST,headers=“Accept=application/json”) 公共响应实体添加客户(@RequestBody feedbackRepo customer,UriComponentsBuilder ucb){

feedback f=新反馈();
customer.setName(f.getName());
customer.setEmailid(f.getEmailid());
this.pmService.saveCustomer(客户);
HttpHeaders=新的HttpHeaders();
headers.setLocation(ucb.path(“/customer/{id}”).buildAndExpand(customer.getIssueid()).toUri());
返回新的ResponseEntity(HttpStatus.CREATED);
}

很抱歉,由于这是我关于stackoverflow的第一篇文章,因此错过了要添加的问题。。我的问题是我能够使用postman在数据库中插入数据,但我想知道如何从前端(即JSP页面)输入数据,并使用Spring RESTful服务将其保存在DB中。提前谢谢,可能的副本
        <tr><th>Name</th><td>
                    <spring:bind path="cust.name">
                    <input name="name" type="text" id="name" class="form-control" value="${pdet.register_fname}&nbsp;${pdet.register_lname}" pattern="[A-Za-z\s]{1,15}"
                            title="Name should contain min of 1 and max of 15 characters!"required/>
                    </spring:bind>
                    </td><td>
                        <p id="demo" cssClass="error" />
                        <springform:errors path="name" cssClass="error" />
                       </td></tr>

            <tr><th>Email</th><td>
                    <spring:bind path="cust.emailid">
                    <input name="emailid" type="email" id="emailid"  class="form-control"   value="${pdet.username}" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$" title="Please enter a valid email address." required size="40"/>
                    </spring:bind>
                    </td><td>
                        <p id="demo" cssClass="error" />
                        <springform:errors path="emailid" cssClass="error" />
                       </td><td style="border:0; color: red; position: fixed;">${msg}</td></tr>

             <tr><th>Mobile Number</th><td>
                    <spring:bind path="cust.mobileno">
                   <input name="mobileno" type="text" id="mobileno" class="form-control"  pattern="[0-9]{6,10}" title="Mobile number of minimum of 6 and maximum of 10 digits" value="${pdet.register_mno} " />

                    </spring:bind>
                    </td><td>
                        <p id="demo" cssClass="error" />
                        <springform:errors path="mobileno" cssClass="error" />
                       </td></tr>




               <tr><th>Description</th><td>
                    <spring:bind path="cust.description">
                    <textarea name="description" rows='3' id='description' class="form-control" title="cust_comment" required></textarea>
                    </spring:bind>
                    </td> </td><td>
                        <p id="demo" cssClass="error" />
                        <springform:errors path="description" cssClass="error" />
                       </td></tr>
    feedback f=new feedback(); 
    customer.setName(f.getName());
    customer.setEmailid(f.getEmailid());

    this.pmService.saveCustomer(customer);
    HttpHeaders headers=new HttpHeaders();
    headers.setLocation(ucb.path("/customer/{id}").buildAndExpand(customer.getIssueid()).toUri());
    return new ResponseEntity<Void>(HttpStatus.CREATED);  
}