1. 程式人生 > >SpringMVC(1)[email protected]

SpringMVC(1)[email protected]

1、@RequestParam

使用@RequestParam接收前段引數比較方便,前端傳參的URL:

url = “${ctx}/main/mm/am/edit?Id=${Id}&name=${name}

後端使用集合來接受引數,靈活性較好,如果url中沒有對引數賦key值,後端在接收時,會根據引數值的型別附,賦一個初始key(String、long ……)

@RequestMapping("/edit")
public String edit(Model model, @RequestParam Map<String, Object> paramMap ) {
        long
id = Long.parseLong(paramMap.get("id").toString()); String name = paramMap.get("name").toString; return page("edit"); }

2、@PathVariable

使用@PathVariable接收引數,引數值需要在url進行佔位,前端傳參的URL:

url = “${ctx}/main/mm/am/edit/${Id}/${name}”

@RequestMapping("/edit/{id}/{name}")
public String edit(Model
model, @PathVariable long id,@PathVariable String name) { return page("edit"); }

前端傳參的URL於後端@RequestMapping的URL必須相同且引數位置一一對應,否則前端會找不到後端地址

—————————————————————————————————————————————————–

java架構師專案實戰,高併發叢集分散式,大資料高可用視訊教程,共760G

下載地址:

https://item.taobao.com/item.htm?id=555888526201

01.高階架構師四十二個階段高
02.Java高階系統培訓架構課程148課時
03.Java高階網際網路架構師課程
04.Java網際網路架構Netty、Nio、Mina等-視訊教程
05.Java高階架構設計2016整理-視訊教程
06.架構師基礎、高階片
07.Java架構師必修linux運維繫列課程
08.Java高階系統培訓架構課程116課時
+
hadoop系列教程,java設計模式與資料結構, Spring Cloud微服務, SpringBoot入門

—————————————————————————————————————————————————–

相關推薦

SpringMVC(1)<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7954545454392b1c080c1c0a0d29180b1814">[email&#160;protected]a>

1、@RequestParam 使用@RequestParam接收前段引數比較方便,前端傳參的URL: url = “${ctx}/main/mm/am/edit?Id=${Id}&name=${name}” 後端使用集合來接受引數,靈活性較好,如

[ 轉]Shell中引數($0,$1,$#,$NF,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b6f0b">[email&#160;protected]a>等)的含義

Shell中引數($0,$1,$#,$NF,[email protected]等)的含義         釋出時間:2018-01-19 來源:網路 上傳者:使用者  &nbs

springMVC @<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9eddf1f3eef1f0fbf0eab3deccfbedf1ebecfdfbb3">[email&#160;protected]

作用: @Component------------------------泛指元件,當元件不好歸類的時候,我們可以使用這個註解進行標註。(Component-------成分; 組分; 零件) @Resource------------------------(資源) @Autowired------

spring給容器中註冊元件的幾種方式,1.包掃描+元件標註註解<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0634284664636768">[email&#160;protected]a>(

              給容器中註冊元件;        1)、包掃描+元件標註註解(@Controller/@Service/@Repository/@Component)[

Linux下$#,$0,$1,$2,$3,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bc98fc">[email&#160;protected]a>,$*,$$,$?代表的含義

$# :傳給指令碼的引數個數; $0 :指令碼名稱; $n :n為數字,代表傳給指令碼的第n個引數; [email protected] :引數列表; $* :也是顯示引數列表,與上一條命

springMVC原始碼分析<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="35181875665046465c5a5b744141475c57404150">[email&#160;protected

@SessionAttribute作用於處理器類上,用於在多個請求之間傳遞引數,類似於Session的Attribute,但不完全一樣,一般來說@SessionAttribute設定的引數只用於暫時的傳遞,而不是長期的儲存,長期儲存的資料還是要放到Session中。通過@Se

SpringMVC基礎<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b39ef3e1d6c2c6d6c0c7fbd6d2d7d6c1">[email&#160;protected]a>

1.概述  從Http請求頭中提取指定的某個請求頭.等價於HttpServletRequest.getHeader(String) 2.配置 (1)value(default ""):引數名例如: Accept (2)required(default true):是否請求

淺談linux中shell變數$#,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="674327">[email&#160;protected]a>,$0,$1,$2,$?的含義解釋

淺談linux中shell變數$#,[email protected],$0,$1,$2,$?的含義解釋 下面小編就為大家帶來一篇淺談linux中shell變數$#,[email protected],$0,$1,$2的含義解釋。小編覺得挺不錯的,現在就分享給大家,

SpringMVC基礎<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ad80ede0c2c9c8c1ecd9d9dfc4cfd8d9c8">[email&#160;protected]a>註解&P

在總結@ModelAttribute註解功能配合PUT請求方式使用之前,先來總結一下POJO類作為入參接收form表單POST提交方式提交資料。 POJO類接收引數 總的來說POJO類還是與普通的Java Bean類還是特別的相似的,私有的屬性,需要

shell 中的$0 $1 $* <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e5c1a5">[email&#160;protected]a> $# $$ $?

$0: 指令碼本身檔名稱 $1: 命令列第一個引數,$2為第二個,以此類推 $*: 所有引數列表 [email protected]: 所有引數列表 $#: 引數個數 $$: 指令碼執行時的PID $?: 指令碼退出碼 ∗與@的區別 當命令列為test.sh 1 2 3 "$*“表示"1

SELECT (@i :<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c0fd80a9">[email&#160;protected]a> + 1)生成序列號

SELECT  (@i :[email protected] + 1) AS i,         d.pkid,d.createTime,d.updateTime,d.date,d.employeeNum         ,d.serviceNum,d.servi

springCloud的<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="346651474060515944585540511f74785b5550765558555a575150">[email&#1

學習springcluod的時候,有一個困惑,為什麼RestTemplate上面@LoadBalanced註解,就能實現負載均衡,今天我們一起學習下原始碼,探索下springCloud底層的祕密:第一步:在看原始碼之前我們先自己搭建一個消費者微服務(因為我們這裡主要講解的是s

springMVC原始碼分析<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="65484825280a010009241111170c07101100">[email&#160;protected]a

這一篇部落格我們簡單的介紹一下ModelAttribute的使用和執行原理。1、首先@ModelAttribute是使用在方法或者上的,當使用在方法上時其作用於本身所在的Controller,在訪問Controller中的所有請求時都會執行到@ModelAttribute所註

Springmvc知識二細節<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7a57575757573a37151e1f163b0e0e0813180f0e1f">[email&#160;protect

舉例說明 對於@modelattribute註解比較吃力。現在我們先考慮一個問題,關於資料的修改。 假設我們需要修改一個User物件,但是我們規定某一個或者幾個欄位不能修改,我們會利用表單填寫相關資訊,然後提交給後臺,然後 在後臺會new出一個物件,並將表單

從資料庫(wm_concat函式)接收值變成<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d4bba6b5b7b8b1faa7a5b8fa97989b9694acacacacac">[email&#1

從資料庫接收值變成[email protected]型別的處理方法。oracle資料庫從10g以後,使用wm_concat函式接收到的值會變成[email protected]型別,下面是處理結果: //oracle程式碼 select wmsys.wm

shell腳本中的$# $0 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f8dcb8">[email&#160;protected]a> $* $$ $! $?的意義

腳本 $* width 上一個 pre shell int .cn height 轉載自:http://www.cnblogs.com/davygeek/p/5670212.html 今天學寫腳本遇到一些變量不認識,在此做下記錄。 變量 含義 $0 當前腳本的文件

shell中$*與<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b296f2">[email&#160;protected]a>的區別

劃分 位置 一個 這也 差異 獨立 [email protected] 情況 雙引號 $*所有的位置參數,被作為一個單詞 註意:"$*"必須被""引用 [email protected] 與$*同義,但是每個參數都是一個獨立的""引用字串,這就意味著參數

Spring4.0系列<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aa9f87eae9c5c4cec3dec3c5c4cbc6">[email&#160;protected]a>

one window 標識 cto ace ted ada bsp 布爾 這篇文章介紹Spring 4的@Conditional註解。在Spring的早期版本你可以通過以下方法來處理條件問題: 3.1之前的版本,使用Spring Expression Langua

Spring高級話題<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b29ff2f7dcd3d0ded7">[email&#160;protected]a>***註解的工作原理

sso metadata bool logs tcl task ota -c ann 出自:http://blog.csdn.net/qq_26525215 @EnableAspectJAutoProxy @EnableAspectJAutoProxy註解 激活Aspe

<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="297a595b40474e69685c5d465e405b4c4d">[email&#160;protected]a>註解與自動裝配(轉發)

配置 調用方法 support autowired 信息 ann over 反射機制 test 1 配置文件的方法我們編寫spring 框架的代碼時候。一直遵循是這樣一個規則:所有在spring中註入的bean 都建議定義成私有的域變量。並且要配套寫上 get 和 se