Spring MVC:原始服务器找不到目标资源的当前表示形式

时间:2018-10-23 15:37:17

标签: postgresql hibernate spring-mvc jsp tomcat

我用过:

spring mvc-version:4.3.7 PostgreSQL的:9.5 工具:STS

我想更新我的数据库。但是在表单中输入后,当我单击“提交”按钮时,它会显示:

  

原始服务器找不到目标的当前表示形式   资源或不愿透露存在。

这是我的控制者:

@RequestMapping("/edit/{id}")
    public String editDivision(@PathVariable("id") int id, Model model) {
        model.addAttribute("division", this.divisionService.getdivisionById(id));
        return "editdivision";
    }

    @PostMapping(value="/updatedivision/{id}")
     public String updateEmployee(@PathVariable("id") int id, Model model) {

        Division division = this.divisionService.getdivisionById(id);
        this.divisionService.updatedivision(division);
                return "divisionlist";
    }

> DAO如下:

public void updatedivision(Division p) {
        Session session = this.sessionFactory.getCurrentSession();
        session.update(p);
        logger.info("Division updated successfully, Division Details=" + p);
    }

jsp页面为:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ page session="false" %>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]>      <html class="no-js"><!--> <!--<![endif]-->
<html>
  <head>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">
    <meta charset="utf-8">
    <title>Firm Life</title>
    <!--bootstrap css-->
    <link rel="stylesheet" href="http://localhost:8090/farmvill/resources/css/bootstrap.min.css" />
    <!--font-awesome css-->
    <link rel="stylesheet" href="http://localhost:8090/farmvill/resources/css/font-awesome.min.css" />
    <!--app css-->
    <link rel="stylesheet" href="http://localhost:8090/farmvill/resources/css/app.css" />
    <!--css for this template-->
    <link rel="stylesheet" href="http://localhost:8090/farmvill/resources/css/main.css" />
     <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
  </head>
  <body>

<header class="area">
    <section class="header-section area">
      <article class="container-fluid">
        <div class="header-content">
          <div class="header-logo">
            <h2 class="logo"><a href="#">Firm Life</a></h2>
          </div>
          <!-- End of header-logo -->
        </div>
        <!-- End of header-content -->
      </article>
      <!-- End of container-fluid -->
    </section>
    <!-- End of header -->
  </header>
  <!-- End of header -->

  <main class="area">
    <section class="main-body-content area">
       <div class="replace"></div>

      <!-- End of sidebar menu -->
        <article class="container-fluid">
        <div class="row">
          <div class="col-sm-9 col-sm-offset-3">
            <div class="create-form list-form">
              <h2 class="page-title">Edits of Division</h2>
              <form method="POST" action="updatedivision/${division.id}" modelAtribute="division">
                <div class="sel-group area text-center">

                <!-- End of sel-group -->
                <table class="create-table table table-hover table-bordered">

                  <!-- End of thead -->
                  <tbody>
                        <tr>
                            <td>ID</td>
                            <td>Name</td>
                        </tr>
                        <tr>
                            <td>${division.id }</td>
                            <td><input type="text" id="name" name="name" path="name" value="${division.name}" }></input></td>
                        </tr>
                    <!-- End of tr -->
                  </tbody>
                  <!-- End fo tbody -->
                 </table>
                <!-- End of table -->
                <div class="button-set text-right">
                  <button type="submit" class="btn site-btn filled-btn">save</button>
                  <a href="" class="btn site-btn filled-btn">cancel</a>
                  <a href="" class="btn site-btn filled-btn">reset</a>
                </div>
                <!-- End of button-set -->

              </form>
              <!-- End of form -->
            </div>
            <!-- End of farmer create form -->
          </div>
          <!-- End of col -->
        </div>
        <!-- End of row -->
      </article>
      <!-- End of container -->
    </section>
    <!-- End of main-content-section -->
  </main>
  <!-- End of main -->

  <footer class="area">
    <section class="footer-section area">
      <article class="container-fluid">
        <div class="row">
          <div class="col-sm-6">
            <div class="footer-logo">
              <a href="#">Firm Life</a>
            </div>
            <!-- End of footer-logo -->
          </div>
          <!-- End of col -->
          <div class="col-sm-6">
            <div class="footer-copyright">
              <p>&copy; 2018 | All rights reserved</p>
            </div>
            <!-- End of footer-copyright -->
          </div>
          <!-- End of col -->
        </div>
        <!-- End of row -->
      </article>
      <!-- End of container-fluid -->
    </section>
    <!-- End of footer -->
  </footer>
  <!-- End of footer -->

  <!-- End of footer -->
    <script src="http://localhost:8090/farmvill/resources/js/siderbar.js"></script>
    <script src="http://localhost:8090/farmvill/resources/js/bootstrap.min.js"></script>
    <script src="http://localhost:8090/farmvill/resources/js/main.js"></script>
  </body>
</html>

我该如何解决?

0 个答案:

没有答案