Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/373.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
Java 从JSP表单发送值以更新数据库_Java_Spring_Jsp_Spring Mvc_Dao - Fatal编程技术网

Java 从JSP表单发送值以更新数据库

Java 从JSP表单发送值以更新数据库,java,spring,jsp,spring-mvc,dao,Java,Spring,Jsp,Spring Mvc,Dao,我是一个初学者,我被困在我的项目的一部分。事实上,我无法从JSP页面获取IdPatient来更新我的数据库。目标是从表单中获取id并使用它设置列值 提前谢谢 我的控制器: @RequestMapping("/AddPatient.go") public ModelAndView AddPatient( HttpServletRequest pRequest, @RequestParam(value = "pIdPatient", required = fals

我是一个初学者,我被困在我的项目的一部分。事实上,我无法从JSP页面获取IdPatient来更新我的数据库。目标是从表单中获取id并使用它设置列值

提前谢谢

我的控制器:

@RequestMapping("/AddPatient.go")
  public ModelAndView AddPatient(
        HttpServletRequest pRequest,
        @RequestParam(value = "pIdPatient", required = false) String pIdPatient) {
    LOGGER.info("start");


    TicketAttenteBO ticket = searchIdPatient(pRequest, pIdPatient);
    ticket.setIdPatient("pIdPatient");  


    dao.updateTicket(ticket);

    pRequest.setAttribute("messageInfo", 
            "patient added" );      

    ModelAndView mv = new ModelAndView("welcome");

    return mv;

}


private TicketAttenteBO rechercherQueueParIdPatient(HttpServletRequest pRequest,String pIdPatient) {
    ************* I don’t know what to write here…

    return ticket;
}
我的Dao实现:

public ResultatBO updateTicket(TicketAttenteBO pInput) {
    ResultatBO result = new ResultatBO();
    result.setCodeRetour("OK");
    initConnexion();



        String template = "update queueclassic set statut='NON ADMIS' where idpatient='{1}';";
        String sql = template
                .replace("{1}", pInput.getIdPatient());

        connexion.executeThisUpdateQuery(sql);


    return result;
}
我的jsp:


扫描:

在控制器中,
ticket.setIdPatient(“pIdPatient”)
在这里,您将字符串“pIdPatient”设置为ticket,而不是其值。
我想应该是
ticket.setIdPatient(pidppatient)

取决于“rechercher”在您的语言中的含义。
<div>
   Scan : <input name="pIdPatient" />   
</div>



<input type="submit" value="Insert"/>