0
我正在嘗試在REST,Spring中設置客戶端 - 服務器通信。REST,Spring(RestTemplate)中的客戶端 - 服務器通信:獲取404錯誤
在客戶端側我的代碼:
Map<String, Double> variable = new HashMap<String, Double>(1);
variable.put(newTicket.getMovieName(),newTicket.getTicketPrice());
try{
Boolean rresult = restTemplate.getForObject("http://localhost:8081/SpringMVCMerchant/movieTheater.htm", Boolean.class, variable);
在服務器側我的代碼(以接收上述「可變」,並獲得以下的布爾作爲返回對象):
@ResponseBody
@RequestMapping(value="/movieTheater/", method=RequestMethod.GET)
public boolean getCustomerInput(Map<String, Double> input) {
return transactionService.addTransaction(input);
}
我不確定上述語法是否正確。當我運行的兩個服務器,我收到以下錯誤在客戶端(8080):
GET request for "http://localhost:8081/SpringMVCMerchant/movieTheater.htm" resulted in 404 (Not Found); invoking error handler
請讓我知道我在這裏失蹤,和什麼樣的變化,我需要在我的代碼進行。 在此先感謝!
在我的web.xml中我有: SpringMVCerchant servlet-name> * .htm url-pattern> servlet-mapping> –
kajarigd
它仍然無法正常工作。你能幫忙嗎? – kajarigd
但你是否更新了控制器上的請求映射,從movieTheater到movieTheater.htm –