spring mvc框架下jsp页面为什么提交传递不到删除数据的id值到Controller方法中?
jsp页面
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <base href="<%=basePath%>">
    <title>广告列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="text/javascript" src="<%=basePath %>js/common/constant.js"></script>
    <link href="<%=basePath %>css/admin/cms_style.css" rel="stylesheet" type="text/css" />
  </head>
 
  <body class="info">
      <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="news">
        <thead>
            <tr class="titleBackground">
                <td align="center"><font class="title">序号</font></td>
                <td align="center"><font class="title">广告名称</font></td>
                <td align="center"><font class="title">开始时间</font></td>
                <td align="center"><font class="title">结束时间</font></td>
                <td align="center"><font class="title">状态</font></td>
                <td align="center"><font class="title">操作【<a href="<%=basePath%>admin/addAdInfo">新增</a>】</font></td>
            </tr>
        </thead>
        <tbody>
            <c:forEach var="adInfo" items="${adInfos}" varStatus="s">
            <tr<c:choose>
            <c:when test="${s.index%2==0}">
            class="trcontent1"
            </c:when>
            <c:otherwise>
            class="trcontent2"
            </c:otherwise>
            </c:choose>
            >
                 <td><c:out value="${s.index+1}"/></td>
                <td><c:out value="${adInfo.adTitle}"/></td>
                <td><fmt:formatDate value="${adInfo.beginTime}" type="both"/></td>
                <td><fmt:formatDate value="${adInfo.endTime}" type="both"/></td>
                <td><c:out value="${adInfo.state}"/></td>
                <td>
                <a href="<%=basePath%><%=basePath%>admin/updateAdInfo/${adInfo.adId}">修改</a>
               
                <a href="<%=basePath%>admin/deleteAdInfo?adId=${adInfo.adId}" >删除</a>
                                    
                <a href="<%=basePath%>admin/addAdInfo">新增</a>
              
                </td>
            </tr>
            </c:forEach>
        </tbody>
    </table>  
  </body>
</html>
controller中
package com.tmhome.mall.web;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.tmhome.mall.model.AdInfo;
import com.tmhome.mall.service.AdInfoService;
@Controller
@RequestMapping("admin")
public class AdInfoController {
    @Value(value="#{propertiesBean[fileSysWebUrl]}")
    private String fileSysWebUrl;
    @Value(value="#{propertiesBean[fileSysUploadUrl]}")
    private String fileSysUploadUrl;
    
    @Autowired
    private AdInfoService adInfoService;
    
    @RequestMapping(value="adInfoList",method={RequestMethod.GET,RequestMethod.POST})
    public String adInfoList(Model model) {
        
        List<AdInfo> adInfos = adInfoService.findAdinfoList(null);
        model.addAttribute("adInfos",adInfos);
        
        return "views/ad/ad_list";
    }
    
    @RequestMapping(value="addAdInfo",method={RequestMethod.GET,RequestMethod.POST})
    public String addAdInfo() {
        
        return "views/ad/add_ad";
    }
    
    @RequestMapping(value="saveAdInfo",method={RequestMethod.GET,RequestMethod.POST})
    public String saveAdInfo(AdInfo adInfo,String imgName,String imgUrl,String url) {
        System.out.println(imgName+"--imgUrl:"+imgUrl+"--url:"+url);
        adInfoService.addAdinfo(adInfo);
        return "redirect:adInfoList";
    }
    
    /*删除*/
    @RequestMapping(value="deleteAdInfo",method={RequestMethod.GET,RequestMethod.POST})
    public void deleteAdInfo(int adId){
        System.out.println("-PPPP-adId:"+adId);
        adInfoService.deleteAdinfo(adId);
    }
    /*修改*/
//    @RequestMapping(value="updateAdInfo",method={RequestMethod.GET,RequestMethod.POST})
//    public String updateAdInfo(AdInfo adInfo){
//        AdInfoService.updateAdInfo(adInfo);
//        return "redirect:adInfoList";
//    }
    
    @RequestMapping(value="test",method={RequestMethod.GET,RequestMethod.POST})
    public String test() {
        
        return "views/ad/ad_test";
    }
}
 所有回答列表(3)
所有回答列表(3)
				- 等 最代码怎么获取牛币啊?
- 完 谁来告诉我最代码上线的时间,答对者给5牛币,先来先得
- 等 牛友们,大家好,你们做程序员多久了?现在还好吗?
- 完 在微信打开的页面里进行app下载
- 等 最代码2014年欢乐聚声会
- 完 mysql如何查询表数据并且对3个字段降序的SQL?
- 完 最代码牛币机制改革
- 完 成功的在bae上使用了自定义运行环境 jetty+nginx的组合,大家对jetty+nginx优化有哪些心得?
- 完 进来分享一下各位牛牛是如何加入最代码大家庭的?
- 等 为什么java BufferedImage类处理大图直接抛出内存溢出的异常?
- 等 最代码是否开发手机app客户端?
- 完 java程序员学习哪些java的技术?java有哪些框架?都能做哪方面的开发?
- 等 php格式网页文件怎么运行?
- 等 Java volatile值获取的问题
- 等 前端vue,拦截了登录后台后,返回的token,requests拦截token,但是发送请求的时候,就出现跨越异常
- 等 大专本科计算机科班怎么找到Java工作?
- 等 eclipse怎么把三个java swing游戏项目合成一个项目?
- 完 伙伴们,大家都有什么好的解压方式么,分享一下~
- 完 三四线城市,6、7k,运维工作,索然无味,想去辞职上培训,各位牛牛有什么建议嘛
- 等 jsp页面输入中文变成问号
- 等 JPA在线上运行一段时间后报错Caused by: java.lang.IncompatibleClassChangeError: null
- 等 PHP 这个规则用preg_match_all怎么写
- 等 大佬们,有没有知道Alfresco如何配置LDAP登录呢?
- 等 php的install目录是框架带的吗?
 相关问答
相关问答
				- 完 spring MVC中使用国际化为什么是乱码?
- 等 spring MVC中的@service和@autowired有什么联系么?
- 等 spring mvc项目源码实例代码哪位一行一行解释一下?
- 等 spring MVC开发后台权限admin登录正常,其他权限登录为什么抛出异常?
- 完 spring mvc框架开发java web项目如何学习才能快速入门?
- 完 spring mvc整合mybatis后配置中自动扫描包问题
- 完 spring mvc为什么文件下载失败?
- 等 Spring MVC如何实现InternalResourceViewResolver多视图配置?
- 等 spring mvc开发关于handlermapping和handlerAdapter的问题
- 完 学习spring MVC为什么抛出nested exception is java.lang.NoClassDefFoundError的异常?
- 等 Spring MVC是怎样架构的?
- 完 java初学小白 想了解一下spring MVC工作机制





 最近浏览
最近浏览
				 
                 
                