Visualizzazione dei risultati da 1 a 9 su 9

Hybrid View

  1. #1
    Utente di HTML.it L'avatar di Ironmax
    Registrato dal
    Dec 2008
    Messaggi
    1,026
    Questo è il codice che non mi da più problemi, corretto come mi hai detto:


    codice:
    
    @RequestMapping("/hi/{countryName}/{userName}")
    
    
     public ModelAndView hiWorld(@PathVariable java.util.Map<String, String> pathVars) {
    
    
     String name = pathVars.get("userName");
    
    
     String country = pathVars.get("countryName");
    
    
     ModelAndView model = new ModelAndView("HelloPage");
    
    
     model.addObject("msg", "hello " + name + " You are from " + country);
    
    
     return model;
    
    
    }

    Questo è l'errore dopo l'esecuzione nel browser che ho ottento:
    codice:
    HTTP Status 500 - Request processing failed; nested exception is org.springframework.web.bind.annotation.support.HandlerMethodInvocationException: Failed to invoke handler method [public org.springframework.web.servlet.ModelAndView com.gontuseries.hellocontroller.HelloController.hiWorld(java.util.Map)]; nested exception is java.lang.IllegalStateException: Could not find @PathVariable [pathVars] in @RequestMapping

  2. #2
    Utente di HTML.it L'avatar di andbin
    Registrato dal
    Jan 2006
    residenza
    Italy
    Messaggi
    18,284
    Quote Originariamente inviata da Ironmax Visualizza il messaggio
    codice:
    HTTP Status 500 - Request processing failed; nested exception is org.springframework.web.bind.annotation.support.HandlerMethodInvocationException: Failed to invoke handler method [public org.springframework.web.servlet.ModelAndView com.gontuseries.hellocontroller.HelloController.hiWorld(java.util.Map)]; nested exception is java.lang.IllegalStateException: Could not find @PathVariable [pathVars] in @RequestMapping
    Direi che al 99% è un problema di configurazione di Spring. Come è configurato? XML? Java Config? Come?
    Andrea, Senior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
    Java Versions Cheat Sheet

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.