zoukankan      html  css  js  c++  java
  • SpringMVC 过滤器 以及注解的一些应用

    继承自 OncePerRequestFilter 接口。

    获取用户的IP:  request.getLocalAddr().toString();

    获取用户Session  request.getSession().getAttribute("adminUser")

    ModelAndView view=new ModelAndView();

    view.setViewName("admin/index");

    view.addObject("error", "用户名或密码错误,请重试!");  在前台可以直接取得 error   用EL表达式就可以     ${error}

    @ModelAttribute("admin")Admin admin   其实有没有@ModelAttribute("admin")无所谓   在前台的 name 要和 admin的属性相对应 

    <input type="password" class="form-control" id="password" name="password" placeholder="密码">

    href="list/校友会.html"

    @RequestMapping(value = "/list/{type}.html", method = RequestMethod.GET)

    @PathVariable("type")String type

    jstl标签:<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

      <c:forEach var="topnews" varStatus="status" items="${allNewsList}" begin="0" end="0">

        <a href="news.html?id=${topnews.id}" target="_blank">

       </c:forEach>

                      <c:choose>
                        <c:when test="${newstype == 'allnews'}">   
                         全部新闻
                        </c:when>
                        <c:when test="${newstype == '通知'}">   
                         通知公告
                        </c:when>
                        <c:otherwise>
                        ${newstype }
                        </c:otherwise>
                     </c:choose>

  • 相关阅读:
    系统架构技能之设计模式组合模式
    系统架构师基础到企业应用架构单机软件架构
    设计模式系列装饰模式
    设计模式系列命令模式
    设计模式系列外观模式
    设计模式系列原型模式
    设计模式系列代理模式
    设计模式系列桥接模式
    设计模式系列适配器模式
    设计模式系列享元模式
  • 原文地址:https://www.cnblogs.com/dobestself-994395/p/4378555.html
Copyright © 2011-2022 走看看