Это видео недоступно.
Сожалеем об этом.
How to integrate JQuery Ajax POST/GET & Spring MVC | Spring Boot | Java Techie
HTML-код
- Опубликовано: 12 июн 2018
- This Spring Boot Thymeleaf Ajax Example will shows you how to create a simple web application based on Spring Boot and Thymeleaf template + jQuery.ajax. Here, we are using jQuery.ajax function to send a request to Spring REST API and return a JSON response
#JavaTechie #SpringBoot #Ajax #JQuery
GitHub:
github.com/Jav...
Blogs:
javagyanmantra...
Facebook Group :
/ 919464521471923
Like & Subscribe
Very Very Nice Video Basant...........really you are doing great job.And 1 more thing your explanation is very clear
Don't know how did I miss to watch this one. Really great Basant Bhai, u r a #Gem
Brother, I am big fan of Ur knowledge.. thanks for sharing ur knowledge with us. Keep it up..
THANKS, THANKS VERY MUCH
Thank you for this video. its very helpful
I need it to my project I'll back here next week
Thank you
Java Techie. Well done and very helpful!
gracias , thanks Techie !!
Thank you ❤️ java techie, if I get delete and update operations video or code that will be much better..
Super bro...
very nice one! , thanks ,It's really a good Job
Awesome..
Thank you so much bro. It was very helpful for me.
Excellent! Thanks!
Super Bhai
Upload a video using spring security, auth with JWT, and RESTFul API for consume from the vuejs frontend, login page, register (user management), please master ;)
Many thanks for this. Pls how can I use Ajax/Restful Service to get book details by id and show results in html input.
Thank you for sharing such valuable content ! Can you give a hint on how to refresh data after adding/deleting to/from a table with Ajax ?
You need to do callback again to load all object , one more additional rest call to refresh
I'm having trouble with getRequest.
When I click the button, the ajax is able to fetch the data from the controller, It displays "success" in the console along with the list of Book objects.
But my DIV and UL inside it is not populated.
What do I do ?
Did you added thymeleaf tag in your HTML head
Hi thanks for the vedio
Can u share vedio for file upload to database
please help..
when i try run this project.... it is trying to create the bean .......trying to access the application.properties file and throwing the following error
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Hi, when I close the browser and open it again, the array of books is still loaded. Why?
How can i fix it
. Thanks!
@basant Can you tell me @modelAttribute in spring mvc support content type json during Ajax call which passing json data?
No @ModelAttribute won't work
Very nice video altogether... Since I am new to Spring Boot it would be great if it has some more explanations on the mapping side...
Planning to upload Spring boot tutorial from basic
Awesome..... I used your code. But, after starting the server . when I am hitting localhost:8080/home ,the home page is not coming out. Only Whitelevel Error page is showing. What's the reason for this issue? Could you please let me know?
Check the URL mapping .pass the proper URL
@@Javatechie Using same url, which is used by u
cool man
Nice
Hello,
I tried to run the code from your GitHub, and I get a 500 bad request error when I try to post/get the books. I didn't make any changes to the code. Could you give me any solution?
To get a book you need to fire Get request not post
@@Javatechie Thank you for your reply! I found the problem, it was because of the WebSecurity, I was not sending the CSRF token. :)
@@chucknorris8921 cool 👍
Hi Prashant , Thanks for sharing the video. I am getting below error when I am trying to use your code in RestController : The constructor ServiceResponse(String, Book) is undefined. Can you help please . Waiting for your prompt reply.
Do you have constructor in ServiceResponse class ? I used Lombok so used @AllArgsConstructor
@@Javatechie Yes Prashant there is a constructor in ServiceResponse and I have also used the same Lombok, but it's still now working.
Did you configured Lombok with your eclipse
Yes I did Prashant
did you find the issue?
Can you post Video On Integration Testing And 1 Video On Spring Oauth Security
PRASHANT sure will upload
Why i am getting constructor proble in serviceresponse i import lombok and add all annotation that you have used
You should configure lombok in your eclipse ide
Hi, great tutorial learned a lot. However, no matter what I try (and I am new to all this) I cannot get around the HTTP 400 Bad Request, specifically " Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986". Doing some research online, more than a few Stack Overflow discussions on the error seem to point to newer versions of Tomcat not permitting certain characters in the HTTP request, such as {},[], and | characters. One solution suggested adding -Dtomcat.util.http.parser.HttpParser.requestTargetAllow=|{} to the VM start up, or adding it to Tomcat properties, but the first option didn't work, and wouldn't know how to set Tomcat properties for an embedded Tomcat server in a Spring eclipse project (don't see the files an external Tomcat would expose). Also, supposedly requestTargetAllow was deprecated apparently in the lastest versions. So not sure what to do at this point. Any suggestions??
Hi Russell , can you share your code in GitHub so that I can check this out
@@Javatechie Hi, I just sent a reply, hopefully you received it with the github link. But just in case github.com/rlongo-dev/demo
I tried to copy your code exactly as you presented it, but there are a few changes i made after several errors.
First, I kept getting errors that the server expected the controller for "saveBook" to be an HTTP GET request, which confused me. No matter what I tried, it seemed it would not accept a post, so I set the mapping to @GetMapping in class BookController, then changed the postrequest.js to use a Get. That got rid of the issue with expecting a GET.
But then I got the HTTP 400 Bad Request, specifically " Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986" when it attempted the GET. I am not very familiar with Tomcat, but the stack overflow answers were claiming the {} brackets were unacceptable for Tomcat 8 and later?
have you done spring security login with ajax?
Using Ng http call I did not using ajax
@@Javatechie im having method not allowed 405 in my app, it's an ajax call login with spring security do you have any idea why this is happening?
Make sure to mention same http method in both client and server .
Also inspect your browser and verify whethe initialr put call is happening from client or not
@@Javatechie put call meaning the put http method? i am using $.post in jquery
Yes put HTTP method to check cross origin
Getting 500 error
how should I get this code?
GitHub link mentioned in video description you can download and reuse it
How to send multiple values to the controller
If you want to send multiple value then create a separate class and add attributes which you want to pass then do the post call
@@Javatechie Can you provide an example for this?
I have created a dynamic form and it can be multiple rows and the data will be pass via ajax call.
My data is looks like
Ex: {name:["A", "B"], age:["23","21"]}
cors error
how to solve it
plaese
Please add below snippet of code in your spring boot config or main class
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE").allowedOrigins("*")
.allowedHeaders("*");
}
};
}
ok sir
deprecation warning
Is your cors issue resolved ?
no