Questions tagged [spring-mvc]

A framework for building Java web applications based on the Model-View-Controller (MVC) pattern. It promotes flexible and decoupled code from the underlying view technologies.

spring-mvc
Filter by
Sorted by
Tagged with
1 vote
1 answer
2k views

Replace JNDI lookup with mock object

I'm using jndi to perform a database lookup : <jee:jndi-lookup id="myDataSource" jndi-name="jdbc/mydb" resource-ref="true" expected-type="javax.sql.DataSource" /> In a spring context ...
blue-sky's user avatar
  • 53k
1 vote
2 answers
11k views

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet and org.springframework.beans.factory.Aware

I'm trying to develop a spring app using hibernate for persistence. I have everything in place, but when I try to run the app on tomcat I got the following error java.lang.ClassNotFoundException: org....
user1485182's user avatar
0 votes
1 answer
56 views

Spring form saves two similar values for one field

I have a spring form bind to object. When form submitted I get Object's name field with additional name. E.g. field value is "test". When it is saved it becomes "test,test". If saved again then it ...
Muhammad Imran Tariq's user avatar
3 votes
1 answer
2k views

Can I define beans inside dispatcher-servlet

In my web.xml I have removed contextConfigLocation and instead of pointing to application context I defined my beans in my dispatcher-servlet. Is that allowed or Spring looks for contextConfigLocation ...
Rahul Bussa's user avatar
1 vote
1 answer
2k views

Formatting of BigDecimal in Spring 3

I have a bean with BigDecimal field defined as @Digits(integer=3, fraction=2) @NumberFormat(style=Style.NUMBER) private BigDecimal vatRate = new BigDecimal(0.0f); Formatting works well inside form (...
sodik's user avatar
  • 4,675
0 votes
0 answers
198 views

Display treeView

this is my controller method ,where i set treeView attribute, Now i want to display that in jsp as treeview @RequestMapping(value = "/main.html", method = RequestMethod.GET) public ModelAndView ...
Pankaj's user avatar
  • 11
1 vote
0 answers
232 views

How can I invalidate session in resource listener's 'onDisconnect' event?

I tried to invoke session.invalidate() in AtmosphereResource's onDisconnect, but the session instance is not HttpServletSession object, it is instance of FakeHttpSession and without invalidate method ...
Xiujun Ma's user avatar
  • 2,584
0 votes
0 answers
124 views

Correct way to handle @Version column and AJAX calls with Hibernate/Spring Forms

I am using spring forms to bind a domain object to a view. I have added the following binding to the jsp page <sf:hidden id="myObject-id" path="myObject.version"/> version is a hibernate ...
jax's user avatar
  • 38.3k
6 votes
1 answer
2k views

Spring/REST Application with HOT Deployment: Groovy script does not load dynamically from applicationContext.xml on tomcat startup at runtime

I am in the process of converting an already exisiting Java Web application into a RESTful web application using Spring MVC and Groovy. One of the main features I wanted to achieve was HOT DEPLOYMENT. ...
user2339874's user avatar
0 votes
0 answers
664 views

Spring AOP @RequestBody interfering with @Configurable

I am working on a Spring project using 3.2.3.RELEASE and cannot get the dependency injection to work with a non-spring managed object. Specifically using an object as below using @Configurable. @...
Mark Vander Lugt's user avatar
0 votes
1 answer
614 views

AppFuse - Spring Hibernate - no session found for the current thread

This is my problem: I started testing AppFuse in order to understand if it fits or not my needs. So I start creating a project (AppFuse not the Light version, not the multi module project). Then I ...
AlexD's user avatar
  • 81
5 votes
1 answer
8k views

How to send data to a redirected URL spring mvc

I have an URL which redirects to another URL when called. I would like to pass some data along with the redirection. For example I have this method: @RequestMapping("efetuaEnvioEmail") public ...
Felipe Mosso's user avatar
  • 3,907
1 vote
1 answer
4k views

@RequestMapping not working in spring mvc

I am relatively new to spring mvc. i am not able to get the page navigation to work. i looked through the documentation and other forums for help, but I am not able to figure out where I am going ...
user2180794's user avatar
  • 1,435
11 votes
4 answers
15k views

Spring MVC 3.2 @ResponseBody interceptor

In our application we are using JSON for request and response. The controller methods are annotated with @RequestBody(). The object being returned e.g. TransferResponse. I would like to get hold of ...
user2279337's user avatar
0 votes
1 answer
6k views

How To Autowire a String MVC Session Scoped Bean Into RestEasy Client Interceptor?

I am consuming a rest api created using RestEasy in a Spring MVC based front end. There are two WAR projects being developed. RestEasy + Spring IOC based REST API Spring MVC + Spring IOC + ...
Rakesh Waghela's user avatar
1 vote
4 answers
8k views

Initialization of collection throws LazyInitializationException

I have a problem with the access to a collection from JSP file. Application is based on MVC Spring framework. I put OpenSessionInViewFilter filter to my web.xml. When I want to access to URL with ...
misco's user avatar
  • 1,912
0 votes
3 answers
451 views

Solution to dynamic configure Spring aplication

Our application is developed using Spring framework, however, some of the configuration(i.e. database url in a properties file) need to define dynamically. So here comes the questions: Is it possible ...
Dreamer's user avatar
  • 7,411
0 votes
1 answer
2k views

Bind of the model with view in POST with Spring MVC 3

I'm trying to do a dependency injection in my controller, instead using setters methods, but it didnot work. The purpose is bind the form inputs with attributes of my domain model when do the post of ...
Valmir Moraes Pereira's user avatar
4 votes
3 answers
4k views

Spring MVC: exception when using @ResponseBody and entity with circular reference

I have the following method, which behind scenes uses Jackson to parse the list of entities to json: @Controller @RequestMapping("/user/") public class EditarLugarController { @RequestMapping(...
damian's user avatar
  • 4,034
19 votes
1 answer
40k views

Mixing Spring MVC with Angular.JS

I want to make a Single Page Application with my Spring MVC Backend. I've just learnt Angular.js. I have a left menu consisting of two links. One makes request to the below controller. This ...
user706071's user avatar
6 votes
1 answer
351 views

Spring WEB security: list of accessible URLs

I'm migrating a WEB-application to Spring Security. Application uses Spring MVC for rendering JSPs, and controller methods are annotated with @Secured(...). So, at some point after successful login ...
Andy's user avatar
  • 1,464
0 votes
2 answers
8k views

Show image on Spring MVC project in .jsp view (html)

I have tried for so long now trying to use a Image on my website that I've created in Spring. When I google/search on stackoverflow it, its said that if I wanna use this in the .jsp: <img src="&...
benskiiii's user avatar
  • 459
0 votes
1 answer
574 views

Adding web content dynamically with jquery and jstl in a Spring-MVC app

I'm developing a control panel web app. Now, i have to do an edit user window in order to add or delete roles of the user. I'm thinking in many ways to do it so i would like to ask you how i can ...
mannuk's user avatar
  • 1,269
2 votes
1 answer
809 views

Error 400 while using StringTrimmerEditor in Spring MVC

We are using Spring MVC 3.2.3.RELEASE (annotations) with google app engine 1.8.0. We added a StringTrimmerEditor for converting blank strings from form as null values and it is working fine, but as a ...
skywalker's user avatar
  • 415
0 votes
0 answers
858 views

Spring web application displays blank page for the first request

I am working in a spring web application and faces a strange behavior. when hitting the application URL, the browser displays blank page and I should reload the page to work properly. The ...
Fanooos's user avatar
  • 2,768
0 votes
0 answers
447 views

Spring MVC-requested resources not found

this is my logincontroller package com.spring.controllers; import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import org....
Renganathan V's user avatar
0 votes
1 answer
790 views

Spring MVC - have to manually flush() to get object to save

For some reason I can't get my object to save via hibernate unless I explicitly flush(). I am using Spring MVC Part of the DAO that does the save public final T saveOrUpdate(final T instance) { ...
jax's user avatar
  • 38.3k
1 vote
0 answers
94 views

Spring Forms and org.hibernate.StaleObjectStateException

I am using Spring Forms to bind an object to an HTML form. The object already exists in my database so it is now being edited. The problem is that when I try to update the object via AJAX or a full ...
jax's user avatar
  • 38.3k
0 votes
1 answer
86 views

junit 4 with spring mvc 3.1

I am new with spring mvc .I have written my dao and now i want to test it .So which framework will be best for testing spring mvc app. and How to do testing in spring 3.1 mvc application with ...
Ravi Kant's user avatar
  • 4,925
0 votes
1 answer
2k views

Get Windows User Account Name using Java from Server Side

I am writing Java web application using Spring MVC framework, I hava already done authorization through Windows AD with Spring Security framework. But now, I have to get client's Windows account ...
Madi Sagimbekov's user avatar
0 votes
1 answer
579 views

setContentType fails for portal controller

I am trying to write a controller that generates a CSV spreadsheet to save as a file. I have written the following action and render methods /** * Get the stats for the search. */ @ActionMapping(...
BevynQ's user avatar
  • 8,219
-1 votes
2 answers
2k views

Storing app preferences in Spring app

I'm working in a Spring MVC application that needs access to some variables that the admin user must set using a web wizard (smtp server, preferences, etc). I want to store this info in a database to ...
David Moreno García's user avatar
0 votes
1 answer
3k views

Cookie lost on multiple requests (spring mvc + jsp)

I set my cookie in my controller, return a new modelandview, the cookie gets set. However, on any other request, the cookie is lost. Also, when I reset the cookie to some other value, the value doesn'...
Jayz's user avatar
  • 1,174
2 votes
0 answers
2k views

Need help in accessing a List in JSP using ModelMap of spring frame work

This is the first time ever iam asking a question over here. I have to display a list in JSP which is beig access over there using the Spring ModelMap object The output in form is loop in braces 46 ...
Nayeem's user avatar
  • 691
6 votes
4 answers
17k views

How to disable JSESSIONID cookie-based (and any else) session-tracking features in jetty 9?

i wish to disable all kinds of session tracking features in Jetty 9 for my stateless- or manually maintained state Spring MVC application, but i failed to find any working examples showing how to do ...
Alexander Tumin's user avatar
0 votes
1 answer
1k views

Custom UserDetailsService not executing correctly

I'm trying to configure Spring Security but I have an extrange problem with my custom UserDetailsService. Everytime I try to login in I'm redirected to my failure page. This is the code of the service:...
David Moreno García's user avatar
4 votes
1 answer
5k views

Connect to multiple DB from Hibernate and Spring

I need to connect to two DB in my spring hibernate application. The configuration is as following: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/...
Nir Sagiv's user avatar
  • 165
2 votes
2 answers
7k views

JBoss 7 Spring JPA + Hibernate Application: no transaction is in progress

I'm trying to develop a simple Payroll Application with Spring 3.2 using JPA and Hibernate and the JPA Provider. I'm deploying it on the JBoss AS 7 Server. I keep getting the following error: 16:42:...
Colenso Castellino's user avatar
2 votes
1 answer
4k views

How to filter request parameters in Spring MVC?

I have a form which submits 3 request parameters: name, age, location. This method gets both parameters. @RequestMapping(method = RequestMethod.POST) public void displayData(@RequestParam Map<...
Mythul's user avatar
  • 1,807
1 vote
2 answers
7k views

Spring MVC form:radiobuttons tag not setting value attribute

Here is relevant code from my controller: @ModelAttribute("store_location_types") public StoreLocationType[] getStoreLocationTypes() { return StoreLocationType.values(); } Here is the definition ...
aamiri's user avatar
  • 2,430
0 votes
1 answer
142 views

Prefix "redirect:" not able to resolve the view

I was following the application example in the book - Spring Recipes, Section 8-10. And I am stuck in an issue. I'll try to keep it short. I've Reservation bean containing following fields: String ...
Rohit Jain's user avatar
  • 212k
0 votes
1 answer
247 views

Validation Spring confusion to render error message

I try to render error message but it's not appears: I have validator: @Component class ValidatorFBOSSearch implements Validator { @SuppressWarnings("rawtypes") @Override public boolean ...
java_user's user avatar
  • 939
0 votes
2 answers
2k views

SpringDataRest and show welcome-file-list/disable link discovery

I am using spring-data-rest(1.0.0.RELEASE) in my spring-mvc application But I am getting following problem In my WebConfig @Import(RepositoryRestMvcConfiguration.class) public static class ...
Sujeet's user avatar
  • 143
1 vote
1 answer
1k views

Spring MVC - Insert link in email

Excuse the newbie question but I am building an web application with Spring MVC. I have built a registration function that sends an email to the user upon successful reg. The email includes a link to ...
Simon Tilbury's user avatar
0 votes
1 answer
231 views

Spring triple load controller on server start

I am using Tomcat 7 with Spring MVC 3.2.x RELEASE. The spring template code is generated by Intellij, I just added an syserr message output. When I start the server the default controller is called ...
milkphany's user avatar
  • 145
31 votes
2 answers
18k views

Spring @RequestBody containing a list of different types (but same interface)

Let's say that I have a domain class : public class Zoo{ private List<Animal> animals; .... where an Animal is an interface with different implementations (Cat,Dog). Let's ...
Viktor K.'s user avatar
  • 2,730
0 votes
1 answer
88 views

<form:input> inside of <form:select> How to realize?

I'm building a jsp which will let user select data from database, it will uploads when page will render for user. But the problem is <form:select> don't let user insert new value his own one if ...
java_user's user avatar
  • 939
0 votes
1 answer
49 views

Constat redirecting to login site

Let assume that I have /admin and /login site. User want go to the /admin secured site (require login). Spring security ask user about creditials, after login user is redirected to default-target-url. ...
user902691's user avatar
  • 1,159
1 vote
1 answer
267 views

Spring MVC REST

I'm using Spring MVC and I have a controller mapped to a url lets call it example. I also have a method called show that allows me to view one of my examples based on an id. @RequestMapping("/...
Bhopewell's user avatar
3 votes
1 answer
862 views

Java/Spring web application: why do I get a very long URL with parameters I did not add?

I am doing a Spring web application and I am using Spring MVC. I have a form with many fields, including the following one: <select name="birthYear" id="birthYear"> <...
curious1's user avatar
  • 14.4k

1
974 975
976
977 978
1181