Based on the Model-View-Controller (MVC) pattern, Spring MVC helps you build web-based applications that are flexible and decoupled from the underlying view technologies.

learn more… | top users | synonyms

6
votes
1answer
4k views

Preventing XSS attacks in a Spring MVC application controller

One of the URL in my application is vulnerable to XSS attack, so I am handling it in the below way. I created a util class: ...
4
votes
0answers
375 views

Implement two level caching using spring's cache abstraction Cache and CacheManager

Details about spring's caching framework are here. When I was reading this link, I thought the composite cache mentioned there was one that used levels of caching based on the order given to the ...
3
votes
1answer
86 views

Spring controller code to group information by date

I'm using the Spring Framework in my web application and I'm curious as to whether my controller implementations are good or not. I've used many Hashmaps to make a object that serves my purpose for ...
3
votes
0answers
46 views

Boilerplate for spring-boot with spring-loaded

Since many Java web projects use Spring, I created my own boilerplate to quickly create a new spring project. I had to fix something that I didn't understand but it worked. Is it redundant and there ...
3
votes
0answers
102 views

Spring MVC dynamically adding form elements

I made a simple form with an option of adding one text field dynamically on mouse click. And I will be grateful for suggestions on how I may improve the code. ...
1
vote
1answer
88 views

Spring MVC controller

My code has a nasty smell that looks like this: ...
1
vote
0answers
31 views

Formatting data in a UIViewController in a weight-training app

I'm writing a weight training app that calculates a one rep maximum and it has several options including recording your lifts in pounds or kilograms. I'm trying my best to follow the MVC pattern but I'...
1
vote
0answers
49 views

Spring MVC web app for simple ciphers

I'm working on a simple Spring MVC web app that allows users to encrypt and decrypt messages with classical ciphers such as the shift or Caesar cipher. It also allows users to auto-decrypt a message ...
1
vote
0answers
146 views

Spring MVC validation Multipart file in form

I need make validation of Multipart file in form class. I wrote custom annotation for form class which validate Multipart file. This code works great, but I don`t know if this is a good approach. ...
1
vote
0answers
31 views

Throw exception in Spring when loading a file

I have this following piece of code: ...
0
votes
1answer
75 views

Does this unit test cover all edge cases? [closed]

I want to test a simple controller and I want to know if this unit test covers all cases: Controller: ...
0
votes
0answers
44 views

Optimizing Java (controller and service) code to work faster

I am creating online store, using spring MVC. So the point is when you create new product you need to upload picture for new product. I am using Cloudinary service, so when you upload image server ...
0
votes
0answers
38 views

ResponseEntity<Error> bad design

We have implemented this pojo to use in the org.springframework.http.ResponseEntity. ...
0
votes
0answers
39 views

Spring: Redirecting to a REST url on click

I have a page where a user can click on a link and send them to another url where the path variable is the user name. So example: user name is bmarkham. bmarkham is on www.website.com/welcome. ...
0
votes
1answer
257 views

Detect that a class is marked by a custom annotation in Spring

I would like to enable application behaviour based on the presence of a custom annotation that marks the configuration class (normally named something like ...