簡單的controller方法和action方法

2021-08-25 05:57:43 字數 794 閱讀 2897

不同系統的controller方法和對應的action方法都不一樣,但是基本知識呼叫路徑和介面的定義方法有區別,方法中的編寫是一樣的,post和get定義,介面引數的定義,路徑的編寫和註解的使用

1.controller

post

@restcontroller

public class storecontroller extends basecontroller

}get

public baseresponsevo getcontracttype(@pathvariable string carsymbol)

map.remove("billingcompany");

map.remove("rate");

return baseresponsevo.success(map);

}2.這個是使用的rpc,介面路徑直接定義

@service

public class testrs extends abstractrs

public static void main(string args)

}3.自定義註解,無框架

自定義註解中的郵箱和type設定了許可權和不可為空狀態,配置中定義

@apermission(name =  )

@adev(code = "sun", email = "[email protected]", name = "sun")

@aauth(type = aauthtype.login)

public reply getdispatchpage()

Controller方法返回值

controller方法中定義modelandview物件並返回,物件中可新增model資料 指定view。入門程式 第一 包類 類包 方法名 public modelandview itemlist 參考 在controller方法形參上可以定義request和response,使用request...

SpringMvc的Controller的返回值

controller方法返回值 指定返回到哪個頁面,指定返回到頁面的資料 1 modelandview modelandview.addobject itemlist list 指定返回頁面的資料 modelandview.setviewname itemlist 指定返回的頁面 2 string ...

springMVC的controller返回值

1.可以返回modelandview 2 可以返回乙個string字串 即乙個jsp頁面的邏輯檢視名,這個在springmvc.xml中可以配置此頁面邏輯檢視的字首和字尾 3 可以返回void型別 此時使用request.getrequestdispatcher 具體頁面的完整路徑 response...