Skip to content
Advertisement

Tag: spring-mvc

Manually call Spring Annotation Validation

I’m doing a lot of our validation with Hibernate and Spring Annotations like so: And then in the controller it’s called in the arguments: But I would like to decide the group used based on some logic in the controller method. Is there a way to call validation manually? Something like result = account.validate(Account.Step1.class)? I am aware of creating your

How to return a text file with Spring MVC?

The string is generated inside the Controller. What I want is to send back to the user a Window where he can save a file which contains the myString. It clearly doesn’t work in this current state and I am stuck at the moment. Answer here is a sample: PS: don’t forget to put some random stuff in your url

Download file with original file name

In my project I am uploading a file. While uploading, I am saving its original file name and extension in a database and saving that file with some GUID on server, generated GUID is also stored in database along with file name and extension. For example- -File name for uploading is questions.docx -Then orignalFileName will be “questions” -FileExtension will be

Spring DeferredResult setResult causing 404

I am using the new spring 3.2 async servlet requests. All works well except in this one scenario… When someTest() is true spring/tomcat returns a 404. I am not sure how I should go about this or why this happens? I assume it might be because the Servlet Async Context has already been created. Is this a bug or am

Bind elements to a list with spring mvc ModelAttribute

The question is based on getting a spring model attribute list element using an index from javascript on which explains that each name of the html element must contain an index. Example user[0] I have a form that allows the user to dynamically add or remove elements from the list before submitting it. Let me put an example: we add

alternative to GrantedAuthorityImpl() class

I want an alternative to GrantedAuthorityImpl() class. I want this in spring security implementation. GrantedAuthorityImpl() class is deprecated. Hence I want an alternative solution to it. My code : Answer The class GrantedAuthorityImpl has been deprecated – you can use SimpleGrantedAuthority instead:

Making Spring 3 MVC controller method Transactional

I am using Spring 3.1 and have my DAO and service layer(transactional) written. However in a special case to avoid a lazy init exception I have to make a spring mvc request handler method @transactional. But It is failing to attach transaction to that method. Method name is ModelAndView home(HttpServletRequest request, HttpServletResponse response). http://forum.springsource.org/showthread.php?46814-Transaction-in-MVC-Controller From this link it seems it

Advertisement