Questions tagged [spring-mvc]

A cutting-edge software architecture for constructing feature-rich Java web applications using the innovative Model-View-Controller (MVC) pattern. This groundbreaking framework emphasizes the development of flexible and autonomous code, ensuring seamless integration with various view technologies without any dependencies.

Enhancing Security with Spring and JSON Authentication

I have a Spring/Spring-MVC application that relies solely on JSON for communication. I am now facing the challenge of authenticating my application with Spring Security 3, which utilizes LdapAuthenticationProvider, via JSON. The default Spring Security su ...

Enhance the fields on a spring form by incorporating new elements upon the click of a button

I am working with a class named Student that looks like this: public class Student { private String firstName; private String lastName; private BigDecimal balance; private List<Option> options; ... } Here is the form I am using: <form:for ...

Utilizing the Jackson Framework in Spring Boot for effective mapping with @RequestBody annotation

Hello everyone. I am dealing with some data fetched from a jQuery DataTable and sent to a Spring Controller using Ajax. The ajax function snippet looks like this: $.ajax({ url: "../todaydatarecover.json", t ...

jQuery Ajax form submission encountering issues

I created a form dynamically with the help of jQuery. Here is the code: <form id="editorform" accept-charset="utf-8" method="post" name="editorform" action="menuupdate"> <div> <input id="updateItem" type="submit" value="Update"& ...

Converting JSON data in Spring MVC 3.2 for REST services

I am encountering an issue while attempting to send a List of data as JSON from my Spring Controller. The error message "Could not find acceptable representation" is being thrown. Below are the snippets of code from different parts of my application: pom. ...

problems related to pagination in a spring mvc application

My Spring MVC project utilizes display tag pagination and jQuery tabs. However, I'm facing an issue where when I try to paginate in any tab (for example, moving from page 1 to page 2), the page refreshes and the first tab becomes active again. (Meaning, ev ...

My AngularJS integrated with Spring MVC is failing to render the desired page

Hello everyone, I'm fairly new to AngularJS and Spring MVC. I've managed to set up a basic application, but unfortunately, when I try to load it, nothing appears on the screen. The console shows a 404 error. I've double-checked everything, b ...

Uploading MultipartFile with additional parameters in Spring MVC 4 using AJAX

Currently in the process of developing a file upload feature using AJAX (jQuery) and Spring MVC 4. Aside from just uploading the file itself, additional parameters such as a description need to be sent along. The approach involves an $.ajax() call to send ...

update confirmed data from a record

I am facing a unique challenge, where I have an edit form that updates a record in a table. One of the fields, let's say username, needs to be unique. To validate this, I am using the jQuery validation plugin along with the remote method as shown below: c ...

Encountering difficulties in resolving the HTML view with Spring Boot

After creating a Spring Starter Project in Eclipse, I only selected the Web dependencies checkbox. Despite writing a simple html file and controller, I keep encountering the Whitelabel Error Page. I have made the decision not to use any template engines ri ...

Uploading Files to REST API using Angular2

Currently, I am developing a Spring REST API with an interface built using Angular 2. My issue lies in the inability to upload a file using Angular 2. This is my Java Webresource code: @RequestMapping(method = RequestMethod.POST, value = "/upload") publ ...

Error in Jquery Ajax due to an unexpected token ':' being caught

My spring MVC application is experiencing an issue when using jQuery AJAX to send data to the server from my HTML page. The error message indicates a problem with dataType: 'json', specifically pointing out the unexpected symbol :. $(document).ready(fun ...

Obtaining a document using Angular and Spring MVC API

Having trouble downloading a file upon clicking a button using Angular. The downloaded file is showing as 0 KB in size and won't open. This is the code snippet I'm currently using with Angular and Spring MVC: Angular : public downloadFile(file ...

Tips for achieving jQuery form submission with Ajax functionality

Currently in my Java application, I am submitting a form using JQuery. Below is the JSP code snippet: <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> ...

Exploring the world of Spring MVC: Utilizing partial view fragments

I've recently started working with Spring MVC on a new project and I'm doing some research to ensure it's set up properly for long-term success. One aspect of the project will require me to manually update small sections of the page using Ajax. While I kn ...

The JSON request triggers an unsupported media error in the Spring MVC controller

I'm having trouble sending a JSON object to the server. I've tried various solutions from StackOverflow, but none of them seem to work: On the client side: function submitWOZ(){ var sub = { "idNextexercise": parseInt($('#exList').val()), "user ...

The model attribute is returned by Ajax

Let me explain the scenario I am facing. Within my controller, specifically in the viewUserReminders method, I am passing remindersListWrapper to the uReminder.jsp page. @RequestMapping(value = "/user/reminders", method = RequestMethod.GET) public Mod ...

Spring MVC - The Servlet dispatcher encountered an error: java.lang.StackOverflowError

I originally developed an AngularJS + Spring MVC application, named A. I duplicated this web application by copying and pasting the project folder into another one called B. After running both applications, I noticed they exhibited identical behavior. My ...

Converting the response to a class in Spring Rest operations

Here is the code snippet for my rest call: RestOperations operations; UserIdentifier resourceResponse = operations.postForObject("...", entity, UserIdentifier.class); The structure of the UserIdentifier class used in the call: public class UserIdentifie ...

Create a JSON object using AngularJS to perform a delete operation

Struggling to create a JSON object for deleting data via REST API. Encountering issues with the API call and suspect it's due to improper construction of the JSON object. Here is an excerpt from my AngularJS Controller Code: var data = ["ABC","DEF"] ...

While utilizing Ajax with Spring, it is possible to send a JavaScript object and receive it as a custom object. However, there was an issue with

One of my challenges in Java is working with a custom class that looks like this: public class AddressesVO { private Long addressId; private String address; public Long getAddressId() { return addressId; } public void setAddressId(Long addressId ...

Include Java List in the return value of JsonObject

I am struggling with adding a list in the JSON return value. Can someone help me out? Below is my code snippet - @RequestMapping(value = "/servicearea", produces="application/json") @ResponseBody public String ServiceArea(Model model, HttpSer ...

What is the procedure for sending JSON data to a URL using AJAX?

<script> var postData = JSON.stringify({"S":"Sam"}); $.ajax({ type: 'POST', url: '/view', data: postData, contentType: "application/json; charset=utf-8", dataType: 'json', success: function(data) { alert('data: ' + data); } } ...

Utilizing Material-UI and Yup to reset a form field in a React Hook Form

I am searching for a way to clear the fields of a form without using reset() so that they still appear as changed. There are three options I am considering: using null, undefined, or ''. null Using null can cause issues with non-nullable fields, even if ...

The latest version of Spring MVC, 4.1.x, is encountering a "Not Acceptable" error while trying

After creating a Rest Service using Spring MVC4.1.X, I encountered an issue when attempting to return Json output to the browser. The error message displayed was: The resource identified by this request is only capable of generating responses with charact ...

AngularJS encounters an error message stating, "The data being posted is invalid in syntax according to the client."

Angular post request $http({ method: 'POST', url: '/DineOut/send', contentType:'application/json', dataType:'json', data:JSON.str ...

Using Kotlin to convert a map collection to a JSON array using Jackson

Recently started learning Kotlin, I'm attempting to configure a web server using the kotlin spring webserver template I need assistance with converting a kotlin collection into an array of JSON objects The endpoint is called test @PostMapping(value = [ ...

What methods can be used to protect an application with spring boot and angular 8 without requiring users to log in?

I am looking to enhance security for an application that leverages angular 8 and spring boot 5. Currently, the application is free form and does not require login to access the UI. Although I have implemented CSRF protection, it is still possible for som ...

Altering the names of fields in a REST API's response

Greetings! As a newcomer, I might not grasp advanced solutions right away. Let's get to the point: I need to send a response for a REST API. Essentially, what's happening is that I return an object from a method and then the fields of those obje ...

The requested URI SpringRestfulWebServicesWithJSONExample does not have a corresponding mapping in the HTTP request

I am facing an issue with the JSON example provided on this website: . Despite following all the instructions correctly, whenever I use Tomcat, a log message appears: November 11, 2015 5:09:52 PM org.springframework.web.servlet.PageNotFound noHandlerFou ...

Removing data from the controller with JQUERY AJAX in a Spring MVC application

Could someone assist me with this issue? I am trying to implement ajax and sweetalert.js using the following repository: So far, everything is working well when I use onclick = "" to call my function. However, I need guidance on how to properly utilize th ...

Using Spring Boot and AJAX to dynamically load content as users scroll down the page

Hi there! I've been running into some issues with Spring Boot and AJAX. Currently, I have buttons that need to be clicked in order to navigate to another page (next, previous). I'd like to use an AJAX request instead to load my page when scrolling down. ...

What is the best way to integrate JQuery code with Spring Restful services?

My Spring MVC project incorporates RESTful principles and jQuery code. However, I have noticed that the jQuery code does not work when the project is configured as a RESTful application. Strangely enough, when it is not set up as RESTful, all jQuery code f ...

The controller remains unresponsive when attempting to activate the button on the webpage

I'm a beginner in frontend development and I'm currently working on a website that uses Thymeleaf. On this website, there is a div block with a button. Please take a look at the HTML code below, specifically the button at the last three rows. <form th: ...

Update the index of each list object and then add them to the Angular controller

Currently, I am working on integrating Spring with AngularJS. In my setup, I have a Spring controller returning a List object to the Angular controller. When I print the List in the Spring controller console, it appears as follows: [org.com.pro.dto.MyDTO ...

What is preventing me from loading js and css files on my web pages?

I have developed a web application using SpringMVC with Thymeleaf and I am encountering an issue while trying to load javascript and CSS on my HTML5 pages. Here is a snippet from my login.html: <html xmlns="http://www.w3.org/1999/xhtml"> <head&g ...