I was following the application example in the book - Section 8-10 and I am stuck in an issue. I try to keep it low
I have the following fields in the reservation bean: player bean has just two fields - Sport type a enum : Administrators have the following annotations: Now, when I deploy the application, I use the url: Form reservationForm.jsp has been displayed. And then press the submit button in that form to me, the The problem is that if verification is successful, then is not working. This is showing an HTTP status -404 I have the url displayed in the browser after submitting the form: I do not know how those 2 request attributes came in the query string. When I have tested whether the method handler- In addition, in Eclipse Console, it is showing a warning: I do not understand what the problem might be I have added - in the configuration file This is a configured view resolver: Also, it seems that the examples of that book are not complete. They have not defined the Can anyone help me here, what is happening? The more information I have tried to compact as I can here, if you want some more information, then ask. I would add. It looks like you should be redirected to Since the law is within the controller, and the administrator also has request-mapping, this method is not independent of the request-mapping controller.
string court name, date date, int
names , and
ages < / Code>.
public anonym sport type {tennis ("tennis"), soccer ( " Football"); Now, I have a view - reservationForm.jsp , with the same controller - the reserve parameter controller / Em>.
@Controller @RequestMapping ("/ reservation form") @ session attraction ("reservation")
@RequestMapping (method = RequestMethod.GET) public string setup form (@RequestParam (required = false, value = "username ") String Username, @Racepharmum (essential = true, value =" age ") int age, model model) {System.out.println (" forming set up "); Reservation reservation = new reservation (); Reservation.setPlayer (new player (user name, age)); Model.addAttribute ("reservation", reservation); Return "reservation"; } @RequestMapping (method = RequestMethod.POST) public string submitForm (model model, @model att ("reservation") reservation reservation, binding results, session status status) {reservationValidator.validate (reservation, results); If (result.hasErrors ()) {model.addAttribute ("reservation", reservation); Return "reservation"; } And {reservationService.make (reservation); Status.setComplete (); // The return of the session ends "Redirection: Success"; }} @RequestMapping ("Success") Public String Reservation Success () {System.out.println ("Called"); Return "reservation enabled"; }
http: // localhost: 8080 / springmvc / reservationForm = Age = 21
submitForm () method will be called.
other blocks:
return "redirect: successful reservation" < / Pre>
http: // Localhost: 8080 / springmvc / successful reservation? SportTypes = tennis and sporttypes = SOCCER
reservationSuccess () matches the successful reservation , I saw that it should not be called Used to be. Because of that, the scene is not being resolved.
Warning: No mapping was found for HTTP request with URI [/ SpringMVC / Successful Reservation ] With the name 'Court' in the Dispatcher Circle
& lt; Reference: component-scan & gt; .
& lt; Bean square = "org.springframework.web.servlet.view.InternalResourceViewResolver" & gt; & Lt; Property Name = "Prefix" Value = "/ Web-NF / JSP /" /> & Lt; Property name = "suffix" value = ".jsp" /> & Lt; / Bean & gt;
reservation enabled () method for the reserved URL. That I have added on my own.
/ reservationForm / successfulReservation .
No comments:
Post a Comment