今天写的一个form表单提交时总是报错找不到mapping,form如下:

 <form action="toUpdate.do" method="post">
id:<input type="text" name="id" value="${list.id }" readonly="readonly"><br>
name:<input type="text" name="name" value="${list.name }"><br>
sex:男:<input type="radio" name="sex" value="1" ${list.sex==1?"checked='checked'":"" }>
女:<input type="radio" name="sex" value="0" ${list.sex==0?"checked='checked'":"" }><br>
birthday:<input type="text" name="birthday" value="${list.birthday }"><br>
phone:<input type="text" name="phone" value="${list.phone }"><br>
<input type="submit" value="ok">
</form>

检查发现每次提交时地址栏中多出了一部分:

这是由于在跳转页面时,由于使用了@PathVariable这个注解,所以在地址中插入了一个id

 <a href="toAddPage.do">添加</a>
<table border="1">
<tr>
<td>id</td>
<td>name</td>
<td>sex</td>
<td>birthday</td>
<td>phone</td>
<td colspan="2">操作</td>
</tr>
<c:forEach items="${list }" var="l">
<tr>
<td>${l.id }</td>
<td>${l.name }</td>
<td>${l.sex==1?"男":"女" }</td>
<td>
<f:formatDate value="${l.birthday }" pattern="yyyy年MM月dd日"/>
</td>
<td>${l.phone }</td>
<td><a href="${l.id }/toDelete.do">删除</a></td>
<td><a href="${l.id }/toUpdatePage.do">修改</a></td>  //可以看到a标签的超链接地址中多了一个id
</tr>
</c:forEach>
</table>

这就导致在执行页面跳转后url里就多了一部分,这时再像上面的form表单那样填写action时就会使地址栏信息不匹配,出现500错误

此时form表单的action中应该加上项目路径,如下:

 <form action="/t0402/toUpdate.do" method="post">
id:<input type="text" name="id" value="${list.id }" readonly="readonly"><br>
name:<input type="text" name="name" value="${list.name }"><br>
sex:男:<input type="radio" name="sex" value="1" ${list.sex==1?"checked='checked'":"" }>
女:<input type="radio" name="sex" value="0" ${list.sex==0?"checked='checked'":"" }><br>
birthday:<input type="text" name="birthday" value="${list.birthday }"><br>
phone:<input type="text" name="phone" value="${list.phone }"><br>
<input type="submit" value="ok">
</form>

这样就不会再报错了

No Mapping For GET "xxx.do"的更多相关文章

  1. Rejecting mapping update to [xxx] as the final mapping would have more than 1 type: [xxx, xx]

    说明: 1.elasticsearch 版本 6.3.1 2.在同一个index下创建两个type时报错,信息如下: 在创建第二个type:solr时,先前已经在相同索引下创建了一个type:es [ ...

  2. 使用hibernate tools插件生成POJO

    很多时候我们已经设计好了数据库,需要使用hibernate来做数据持久化,因此需要根据数据库中的表结构生成相应的POJO. 本例使用hibernatetools来自动创建pojo. 测试环境:ecli ...

  3. BAE 环境下 hibernate annotations 配置

     annotations 配置 首先需要加入 hibernate-jpa-2.0-api-1.0.1.Final.jar 和 ejb3-persistence.jar 这两个包 ejb3-persis ...

  4. Hibernate逆向工程全过程

    前提你已经创建好了数据库,按如下操作进行: 1.添加hibernate.cfg.xml 在src下-->new-->other--->hibernate-->选择“Hibern ...

  5. Hibernate框架_搭建第一个Hibernate框架

    一.eclipse搭建 A.创建动态web项目 New-->Dynamic web project(web project) B.导入jar包 1.数据库驱动包 2.hibernate开发必须j ...

  6. (转)ElasticSearch教程——汇总篇

    https://blog.csdn.net/gwd1154978352/article/details/82781731 环境搭建篇 ElasticSearch教程——安装 ElasticSearch ...

  7. Hibernate知识点总结(一)

    前言:学习的过程在于不断的总结与思考,这里记下笔者在学习过程中,所遇到的知识点,增加对框架掌握的熟悉程度. 1.环境的搭建 通过maven可以轻松搭建hibernate的环境. <propert ...

  8. hibernate入门配置及第一个hibernate程序

    学习了hibernate后就想先给大家分享一下它的配置方法: jar包导入 一.数据库表的创建   二.开启hibernate配置 编译器:eclipse 数据库:mysql 1.创建第一个xml文件 ...

  9. Java进阶知识03 Hibernate的基础配置详解

    1.Hibernate的原理/流程步骤 1.通过Configuration().configure(); 读取并解析hibernate.cfg.xml配置文件,并创建一个configuration对象 ...

随机推荐

  1. JSONP前世今生及原理

    https://blog.csdn.net/hansexploration/article/details/80314948 http://www.cnblogs.com/yuzhongwusan/a ...

  2. 【Oracle 12c】最新CUUG OCP-071考试题库(56题)

    56.(14-14) choose the best answer: You need to create a table with the following column specificatio ...

  3. 【12c OCP】最新CUUG OCP-071考试题库(50题)

    50.(11-15)choose two Examine the structure of the MARKS table: Which two statements would execute su ...

  4. Hibernate 干货

    一 .hibernate概念: hibernate应用在javaee 三层框架中的dao层(web 层 --service层--dao层),在dao层实现对数据库的CRUD操作.hibernate是对 ...

  5. 浅析group by,having count()

    SELECT COUNT(*) FROM (SELECT COUNT(id),order_type,city_id,category_id,major_category_id,puid,user_id ...

  6. Deepin personalized transplantation of kali platform tools

    首先配置更新源: 把kali的源添加到 Deepin 自带的源后面: 简易换源方法: 1.打开文件管理 -> 地址栏输入路径:/etc/apt/ 然后回车->在目录中右键以管理员身份打开 ...

  7. centos绑定https

    1.百度云申请免费ssl证书 一年一申请 2. https://www.wosign .com /faq/faq-apache-https.htm 3.注意ssl.conf里面各个证书的顺序 证书路径 ...

  8. 爬虫2:urllib

        了解即可,不好用   一. 概述   python内置的http请求库,包括4个模块,分别如下   urllib.request   请求模块 urllib.error       异常处理模 ...

  9. P2051 中国象棋

    P2051 中国象棋 题目描述 这次小可可想解决的难题和中国象棋有关,在一个N行M列的棋盘上,让你放若干个炮(可以是0个),使得没有一个炮可以攻击到另一个炮,请问有多少种放置方法.大家肯定很清楚,在中 ...

  10. SpringCloud2.0

    一.网站架构演变过程 从传统架构(单体应用)  到   分布式架构(以项目进行拆分)  到  SOA架构(面向服务架构)  到   微服务架构 1) 传统架构: 其实就是SSH或者SSM,属于单点应用 ...