zoukankan      html  css  js  c++  java
  • @RequestParam注解的使用

    自SpringMVC4.2之后,RequestParam内部有4个参数:
    1、String name;
    2、String value;
    3、boolean required;
    4、String defaultValue;


    源码中name的别名是value,value的别名是name,

    所以说name和value两个属性基本是等价的,都是获取从前台传入的参数


    1. RequestParam来映射请求参数
    2. required表示是否必须,默认为true
    3. defaultValue请求参数的默认值

    1. @RequestMapping(value = "/testRequestParam")
    2. public String testRequestParam(@RequestParam(value="username")String un,@RequestParam(value = "age",required = false,defaultValue = "0") int age){
    3. System.out.println("testRequestParam,username:"+un+",age,"+age);
    4. return "success";
    5. }




    				<script>
    					(function(){
    						function setArticleH(btnReadmore,posi){
    							var winH = $(window).height();
    							var articleBox = $("div.article_content");
    							var artH = articleBox.height();
    							if(artH > winH*posi){
    								articleBox.css({
    									'height':winH*posi+'px',
    									'overflow':'hidden'
    								})
    								btnReadmore.click(function(){
    									if(typeof window.localStorage === "object" && typeof window.csdn.anonymousUserLimit === "object"){
    										if(!window.csdn.anonymousUserLimit.judgment()){
    											window.csdn.anonymousUserLimit.Jumplogin();
    											return false;
    										}else if(!currentUserName){
    											window.csdn.anonymousUserLimit.updata();
    										}
    									}
    									
    									articleBox.removeAttr("style");
    									$(this).parent().remove();
    								})
    							}else{
    								btnReadmore.parent().remove();
    							}
    						}
    						var btnReadmore = $("#btn-readmore");
    						if(btnReadmore.length>0){
    							if(currentUserName){
    								setArticleH(btnReadmore,3);
    							}else{
    								setArticleH(btnReadmore,1.2);
    							}
    						}
    					})()
    				</script>
    				</article>
  • 相关阅读:
    图片上传-下载-删除等图片管理的若干经验总结3-单一业务场景的完整解决方案
    图片上传-下载-删除等图片管理的若干经验总结2
    HDU 1195 Open the Lock
    HDU 1690 Bus System
    HDU 2647 Reward
    HDU 2680 Choose the best route
    HDU 1596 find the safest road
    POJ 1904 King's Quest
    CDOJ 889 Battle for Silver
    CDOJ 888 Absurdistan Roads
  • 原文地址:https://www.cnblogs.com/zhuhui-site/p/10088305.html
Copyright © 2011-2022 走看看