2016-06-09 3 views
0
@Controller 
@RequestMapping(value = "/trip") 
public class BusController { 

private BusDao bdao; 

@Inject 
public BusController(BusDao bdao) { 
    this.bdao = bdao; 
} 

@RequestMapping(value = "/create", method = RequestMethod.POST) 
public String create(@ModelAttribute Bus bus) { 


    return "redirect:/ordersummary"; 

} 

만든 후, "ordersummary.jsp"라는 다른 JSP로 리디렉션하려고 시도하는 중 어떻게 할 수 있는지 알 수 없습니다. 거기에 리디렉션되는 get이있는 다른 컨트롤러가 필요합니까?POST 후 다른 JSP로 리디렉션 할 수 있습니까?

+0

예를 다른 컨트롤러 또는 requestmapping/ordersummary와 다른 방법 중 하나가 필요합니다 도움이 될 수 있기를 바랍니다. –

답변

0

코드가 정확하지만 리디렉션을 수행 할 때 리디렉션이 수행 할 get 요청을 처리하는 컨트롤러를 구성해야합니다. 컨트롤러가 다음과 같이 될 수 이러한 이유로

:

@Controller 
@RequestMapping(value = "/trip") 
public class BusController { 

private BusDao bdao; 

@Inject 
public BusController(BusDao bdao) { 
    this.bdao = bdao; 
} 

@RequestMapping(value = "/create", method = RequestMethod.POST) 
public String create(@ModelAttribute Bus bus) { 


    return "redirect:/ordersummary"; 

} 

@RequestMapping(value = "/ordersummary", method = RequestMethod.POST) 
public String redirectHAndler(....) { 

... 
    return "yourView"; 
} 

} 

나는 당신이

관련 문제