spring-mvc

SpringMVC validation : No property 'commandClass' found

I'm trying to implement validation in a springmvc app, I followed the example described at http://maestric.com/doc/java/spring/form_validation When I run the app, I get the following error : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'beanNameUrlHandlerMapping' defined in ServletCon...

Please recommend a good Spring MVC 3 book

I am new to spring and am trying to find a good book, all the books Ive found so far are at latest published in 2008, can someone recommend any Spring books? Unfortunately the company I work for is not prepared to send me on any of the courses and apart from the reference documentation there's next to no Spring 3 user guides, tutorials ...

java.lang.NumberFormatException - Data Binding errors

I am using Spring MVC for a web application and I am working with a simple form that deals with selecting clients and showing contact information. One of the problems I am having is that If I select a client the first time, it will pull the information up, but the second time it wont. It will show the information from the previous clie...

Does spring mvc have response.write to output to the browser directly?

I am using spring mvc with freetemplate. In asp.net, you can write straight to the browser using Response.Write("hello, world"); Can you do this in spring mvc? ...

In Spring MVC, can I have a stateful dropdown with a backing object?

In Spring MVC, I want to have a form with an html drop down which is backed by a list of domain objects, but only displays one field from the objects. When the form is submitted, I want to be able to retrieve the entire object. Can I do this? ...

How does autowiring work in spring?

I'm a little confused as to how the IOC works in spring. Say I have a service class called UserServiceImpl that implements UserService interface. How would this be auto-wired? And in my Controllers action, how would I instantiate an instance of this service? Would I just do: UserService userService = new UserServiceImpl(); ...

How to specify the default scope in Spring's applicationContext.xml to request scope?

I want to make all beans request scoped by default, however the Spring documentation says that the default scope is Singleton. (sections 3.4.1 and 3.4.2 http://static.springsource.org/spring/docs/2.5.x/reference/beans.html) I want to declare the default scope to be request scoped. This is the closest thing I have found so far -- it's ...

spring basic mvc sample application, annotation scan confusion

Little confused, the basic spring mvc app has this: app-config.xml <context:component-scan base-package="org.springframework.samples.mvc.basic" /> and the mvc-config.xml has: <!-- Configures the @Controller programming model --> <mvc:annotation-driven /> Do you really need both? for component-scan, does this mean if I don't p...

how to use messages with freemarker in spring mvc?

In a .jsp I would use: <fmt:message key="welcome.title"/> to display a message from my messages.properties file. How would I do this with freemarker ? ...

header and footer and freemarker

My website has a consistant header and footer that I want on all pages. What is the best way to do this? The header will have some dynamic data also, based on the current view. P.S Does freemarker have any sort of master page functionality? Where I can create a base template, then have other templates build upon the base? Basically ...

Spring 3.0 RESTful Controller Fails on Redirect

I am setting up a simple RESTful controller for a Todo resource with an XML representation. It all works great - until I try to redirect. For example, when I POST a new Todo and attempt to redirect to its new URL (for example /todos/5, I get the following error: Error 500 Unable to locate object to be marshalled in model: {} I do know...

What is the model key for an Errors object in Spring MVC?

In my Spring MVC based web-app, I'm manually creating an Errors/BindingResult object after manually validating one of my domain objects. I can add my domain object into the Model by doing the obvious: model.addAttribute("myObject", myObject); After I do validation and have created an Errors/BindingResult object, under which key should...

How do you call a controller method from an onchange event?

How do you call a controller method from an onchange event? I'm using Spring MVC. I have a <form:list> and I wish to update the current page when an onchange event is triggered in the list. ...

How to make a SimpleFormController show a form using HTTPS

How is this done? I have a view which in certain conditions I need to display using HTTP and in other cases HTTPS. The controller is using SimpleFormController. ...

Spring-MVC Common Model Attributes Used in Tags or Page Fragments

It's common to have many pages in a website that request the same model attributes, for example, a header that renders the current users name, or a column that needs a few server based pieces of information. ... <body> <mytaglib:header/> ... <jsp:include page="footer.jsp"/> ... </body> The simplest solution is that every controller me...

Keep file between http requests

Imagine this simple form for uploading a file: <form action="upload" enctype="multipart/form-data"> <input type="text" name="name"/> <input type="file" name="file"/> <input type="submit"/> </form> If there is some error (can't copy file, name is not correct...) submitting the form, it must return to the same page, but the ...

Apache CXF and Spring MVC

I have set up a CXF web service which works well. My service primarily loads data from an ftp to a db. I would like to create a web interface through which the invoker can view the progress of their package. I thought it would be easy to integrate Spring MVC with CXF but there doesn't seem to be any good solution. I searched all over t...

What beans do you wire in a spring mvc app?

I am wiring my UserService type classes using spring's IOC. But what about my User class? I have a interface User, then a UserImpl class. In my controller action's do I just do: User u = new UserImpl(); Or would it sometimes make sense to use IOC for this also? Sometimes I use a different constructor also when instantiating a cla...

How to embed Jetty into Spring and make it use the same AppContext it was embedded into?

I have a Spring ApplicationContext where I declare Jetty server bean and start it. Inside Jetty I have a DispatcherServlet and a couple of controllers. How to make that DispatcherServlet and its controllers use beans from the same ApplicationContext where Jetty is declared? In fact, in that outer context I have a couple of daemon-like b...

Spring 3 Type Conversion Errors

I have been trying out the new Spring MVC 3.0 Type Conversion Framework. I cannot find out how to trap conversion errors. I am using the new mvc schema: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi=...