Open djangofan opened 8 years ago
@rstoyanchev Would you care to weigh in here?
XML vs Java config and JSP vs Thymeleaf doesn't make the sample easier or harder, just more or less aligned with your application stack. That said the general idea (and the server side code) should be the same. I'm curious what difficulty did you run into with replicating the same with JSP?
As for the use of Boot that's a decision across all GS guides. It does enable the ability to be up and running in 15 min. It isn't possible otherwise.
@gregturn taking a look what I find lacking is at least one binding/validation failure. Adding a JSR-303 anotation, @Valid
to the model attribute, a BindingResult
argument after it, and and error tag in the template shouldn't be that much harder and is a fundamental thing to show even in the most basic example. Also on success a redirect to the result page (vs rendering in the same POST).
Thanks. I'll run through the example today or tomorrow, once again, and then reply to this thread once more with exact details on the parts of this form-submit guide that I found troublesome.
In the meantime, I agree that spring-boot + thymeleaf is faster to get up and running but it seems to me that Thymeleaf hides a little bit of the implementation detail from people, when they are trying to learn how the pure version of Spring libraries work? For example: the example shown is not testable with MockMvc unless you move the .html/.jsp file locations to under WEB-INF?
Ok, finally had time to follow up on this:
Things I noticed after starting with 'gs-handling-form-submission' demo project, and using that as a template to build my own:
Thats all. I guess the doc doesn't need as much update as I originally thought but I think I identified a couple things that would improve it?
The 'handling-form-submission' guide needs a non-thymeleaf, jsp version of the guide
https://spring.io/guides/gs/handling-form-submission/
The "form submit" guide should have a GOAL of BEING EASY but, as a beginner, I had great difficulty reconciling other jsp Spring examples of form submission (found around the internet) with this guide. Basically, if I say it another way, your site does not currently a "form submit" example in your guidebook that shows how to do a form submit the standard way, using jsp (non-thymeleaf/html template).
Also, I think I would find the guide better if it did not use spring-boot , and instead just did it the traditional way. I think the guide would be easiest using a .xml spring config, but an annotated config would be acceptable. Additionally, if there is more than 1 way to submit a form, there should be 1 controller for each example.