我調用了一個使用RequestMapping定義的類,但我不知道該類上執行了哪些代碼。當我調用RequestMapped類(而不是方法)時執行什麼代碼?
<form th:action="@{/admin/gestionUtilisateurs.action}" method="post">
<label>Numéro de contrat: </label>
<input type="text" id="numeroContrat" name="numeroContrat" />
<input type="submit" id="changerInformations" name="changerInformations" value="Charger les informations" class="w_actionButton"/>
</form>
而且我得到了這個類:
@Controller
@RequestMapping(value = "/admin/gestionUtilisateurs")
public class GestionUtilisateursController {
@RequestMapping(method = RequestMethod.POST, params = { "changerInformations" }, produces = MediaType.APPLICATION_JSON_VALUE)
public String getInformationContrat(HttpServletRequest request, InformationContratForm informationContrat, BindingResult result, Model model) {
//code
}
@ResponseBody
@RequestMapping(value = "/modifierMail", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseDTO> modifierMail(HttpServletRequest request, @Valid InformationContratForm informationContratForm,
BindingResult result) {
//code
}
@ResponseBody
@RequestMapping(method = RequestMethod.POST, params = { "importerProfilForm" }, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseDTO> importerProfilDeGestion(HttpServletRequest request, @Valid ImporterProfilForm importerProfilForm,
BindingResult result) throws UtilisateurInexistantException {
//code
}
@RequestMapping(method = RequestMethod.GET)
public String processRechercheContrats(Model model) {
//code
}
}
所以,我想知道的是執行了什麼代碼,以及爲什麼。
你不能叫一個類... –
但代碼工作。再次請求 –
。你不能打電話給班級。在你發佈的類中有**沒有代碼**(除非'code'是一個佔位符),但是這裏工作的最有可能是基於你的註釋生成代碼。 –