spring-mvc

How to register handler interceptors with spring mvc 3.0?

It should be easy: <bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"> <property name="interceptors"> <list> <ref bean="myInterceptor" /> </list> </property> </bean> but this way the interceptor isn't called. ...

double-initialization of spring beans in jetty 7.1.4

When I start a webapp that has a spring configuration in jetty, I see two calls to initialization (@PostConstruct methods). web.xml declares a ContextLoaderListener and provides contextConfigLocation. This seems wrong. (spring 3.0.3). Is there something I've done? EDIT My web.xml calls out both the DispatcherServlet and the org.spring...

XT Ajax Framework Help

Hi, I have been playing with XT Ajax framework and tried to replicate this dwr dynamic text example: http://directwebremoting.org/dwr/examples/index.html (specifically the dynamic text tutorial) My question is this: How do I retrieve the value from the input text field in my Ajax Handler for further processing? Any help will be very muc...

Spring MVC equivalent for Struts 2 Preparable

Is there something similar to Struts 2 Preparable interface / prepare method in Spring 3 MVC? That is, a method executed every time the controller is requested. Thanks. EDIT: What I want to achieve, for example, is to fill a group of properties depending on the user I am, for every request in this controller, trying to avoid this: @C...

Spring Controller init method

Hi there, as far as I understand are spring controllers stateless right? If I set a field to a value, this is revoked by the next call. Is there a possibility to add a init-method or something? A method which is called once, when my controller is triggerd? I'm using spring 3.0 and a annotation configuration atm. ...

Spring MVC: How to store € character?

Hi there, I am using Spring 3 MVC and I have setup a form to capture input from a user. This form includes a textarea for a description String in my model object, Event. My corresponding controller looks like this: @RequestMapping(value = "/admin/event/{eventId}/edit", method = RequestMethod.POST) public String updateEvent(@ModelAtt...

Validation errors are not being rendered by <form:errors> tag in my Spring 3.0.3 web MVC app

I'm developing an image rendering service that takes a bunch of query string parameters as arguments to render an image using Spring 3.0.3. I'm trying to validate the query string parameters and display errors if any exist. Validation seems to be working just fine as the conditional statement on the BindingResult result parameter will ...

Spring and Spring MVC 3.0 AJAX Intergration

Except for this article http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/ I cannot find any good examples of the new AJAX related features in Spring 3.0. I am interested in how the web application build utilizing Spring MVC with Annotations can be integrated with the various AJAX frameworks, such as Dojo to pro...

Spring MVC 3.0 with Annnotations performance tuning

Spring MVC 3.0 with Annotation seems like a great framework for the enterprise web development. However, the issue of performance tuning often comes up when you deal with any web applications, and I am wondering how the use of Annotations affects the strategy for improving performance. For example, would the Annotation-based validations ...

Equivalent to Struts 1.x "bean:define" tag?

Hi guys, I'm working on converting an old Struts 1.x application to Spring MVC, and in some of the jsp pages the "bean:define" tag is being used to get a string from a resource bundle, and is then used later in the page: <bean:define id="example_title"><fmt:message bundle="${example_Labels}" key="example_field"/></bean:define> then...

Using HandlerExceptionResolver for 404

I wanted to use HandlerExceptionResolver to handle exceptions related to request issues such as 404 and other error codes. Tomcat seems to respond to these errors without looking at Spring. Is there a way to make HandlerExceptionResolver respond to 404 errors. I know that configuring web.xml and using <error-page> will work. But is t...

Three Column Layout and Spring-MVC

I want to implement ThreeColumnLayout for my web-app. E.g. having NavigationComponent, BookmarkComponent in Left Panel, OnlineUserComponent in Right Panel. There are also some more components, which can be made visual/hidden by User dynamically and User can move components here and there. E.g. from Left Panel to Right Panel and/or chan...

Spring - mvc ( SimpleFormController ) with hibernate database insertion.

I have made one example , In which I have used Spring - mvc and hibernate. I have successfully insert data in the database table but after that I have refresh the page new entry is inserted. Required Solution : When I refresh the page the database entry would not be inserted second time. ...

NumberFormat for list of Hashmaps<String, BigDecimal> - need different formatters to be applied depending on another member variable

I am using Spring MVC as a front-end to my Spring app. I have an object which is put into the model, which contains all of the values for my report. It looks like this: public class AggregateResultBean { private String regionName; private String countryName; private String indicatorId; @NumberFormat(pattern="#,###,###.00") priva...

Spring MVC URL Path Change

Hi All, I am new to web programming and Spring MVC 2.5. I am not sure about my problem is spring sprecific or web specific in general. I have a menu.jsp and I use jsp:include to include it in all my jsp. <ul class="menu"> <c:url var="home" value="home.htm"/> <c:url var="data" value="data.htm"/> <li><a href="${home}" clas...

Steps to use hibernate in a spring 3 mvc application

Can someone outline the steps required to get hibernate working with spring mvc. I've seen EntityDao's that basically inherit from a GenericDAo. The generic Dao has basic operations like GetAll, GetByID, Save, Delete, etc. And inside their methods they use: getHibernateTemplate So basically the Session has to be wired up in a bean,...

Is it possible to bind/convert the items in a list of a form to a specific type in a Spring Web MVC app?

I'm building a Spring MVC app with Spring 3.0.3. I have data binding of my form working just fine, but one of the form fields is a list of items. Hypothetically speaking, my form object looks like this: public class MyForm { private String name; private List<String> items; public String getName() { return name; ...

Checkbox Binding

I am getting error message org.springframework.beans.NotReadablePropertyException: Invalid property 'produts[0]' of bean class [java.util.HashMap]: Bean property 'produts[0]' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? when i perform follo...

Swappable data layer using spring ioc

I have DAO's for each table, that all implement an interface. Now I want to be able to (potentially) swap database layer implementations. So my strategy is to create a DaoFactory, and this DaoFactory will be specific to a particular implemenation of my DAO's. So I will have DAO's for hibernate. Then a DaoHibernateFactory that will loo...

Have Spring DispacherServlet resolve the correct URLmap

On my Tomcat-Spring-Java project I want to have the following URLS /index - to display entry page /login - Login page /cars/ - list the available cars /cars/{id} - show a particular car /cars/{id}/action - do action on this particular car /people/ - list the available people /people/{id} - show a particular person /peopl...