spring-mvc

Spring MVC DefaultRequestToViewNameTranslator capitalization issue

I'm trying out the whole "convention over configuration" thing with Spring MVC. Spring has all sorts of tools to help with this, and I'm trying some of them out. However, I ran into a problem with our team's configuration not quite matching what Spring wants. The problem is that we take URLs like "http://ourSite/SomePage.do", put them...

Spring MVC - Form Mapping

Probably missing something completely obvious here, but here goes. I'm starting out with Spring MVC. I have a form controller to process inbound requests to /share/edit.html. When I hit this url from my browser, I get the following error: The requested resource (/inbox/share/share/edit) is not available. Here is my applicationCont...

Spring MVC isFormSubmission() equivalent for annotations?

With Spring MVC, it's easy to express a concept like "A user is submitting the form if they use POST or if they include the 'isSubmit' parameter." You'd just extend SimpleFormController and override the isFormSubmission method. However, Spring MVC now uses these neat annotations like @RequestMapping to handle requests. @RequestMapping...

Is it possible to manually set the command object in an @RequestMapping method before Spring binding?

I have a JSP that has a Spring form in it. The form's command object is added in the controller before the JSP is rendered. Spring binds the form in the JSP to this command object, and will correctly handle it when submitting a NEW instance. However, I would like to persist the command object via DWR (which also works correctly), an...

Hibernate + Spring using multiple datasources?

I'm working on a web application that uses Spring MVC 2.5 and Hibernate. One of the requirements of the application is that it must be able to export some objects to an external database. I figure I might as well use my existing data layer and just save the objects to the external source. I'm new to Spring and Hibernate, and I guess I...

Testing Spring MVC annotation mapppings

With Spring MVC, you can specify that a particular URL will handled by a particular method, and you can specify that particular parameters will map to particular arguments, like so: @Controller public class ImageController { @RequestMapping("/getImage") public String getImage( @RequestParam("imageId") int imageId, Map<String,Obje...

How should business errors be handled in a web application?

Say that I've got a web application that can store Persons in a database. Every Person must have a unique email address (or username or whatever). If a user attempts to add a Person with an email address that already exists, the form should be returned with an error message (like it would during a typical validation failure). How is t...

Is Spring ever going to combine MVC and WebFlow?

I thought I read Juergen Holler somewhere once in the past say that a future goal of Spring was to combine Spring MVC and WebFlow... Is this still the case? At the moment they still seem to be fairly separate projects, with WebFlow being recommended as an EXTENSION to MVC. As a developer it would be great if I could use both and defin...

Grails Security Problem and Search Engine optimization

I'm trying to build a control logic that depends on the current gsp page to call an action, is there a tag or a session method that i can use to identify the current gsp page I want to restrict access to all GSPs except singup and login, so if a user open any other gsp he will be redirected to signup page and he will also be able to n...

What's the difference between using @Transactional and Spring template?

If I use @Transactional in my DAO will all of my EntityManager queries be encapsulated with commit and close? Or do I need to use Spring template (JPA template, Hibernate template)? What's the difference between using @Transactional and Spring template? ...

Mocking Spring MVC BindingResult when using annotations

I'm migrating a Spring MVC controller to use the newer style annotations, and want to unit test a controller method that validates a command object (see simple example below). @RequestMapping(method = RequestMethod.POST) public String doThing(Command command, BindingResult result, HttpServletRequest request, HttpSer...

How to create a JSON view from a domain object?

I'm creating the server side implementation of an AJAX based web application, where the client side receives responses that are domain objects serialized as JSON. In order to provide a common look and feel, I would like to create templates for different types of domain objects, and re-use these as Spring views for multiple controllers. ...

What happens if I forget to mark the Spring SessionStatus as "Complete"?

In Spring MVC, suppose I define a SessionAttribute, using the @SessionAttribute tag like so: @SessionAttributes(value = "myModel") public class MyController{ ... } Suppose that I forget to call status.setComplete() on the SessionStatus like so: @RequestMapping(method = RequestMethod.POST) public void doSomething(@ModelAttribute("m...

generate java domain objects from database table

may i know in eclipse, is there any feature that will auto generate domain objects with all table relationship properly mapped in class? can provide me with some reference articles on this? ...

Narrowing problem with Spring MVC annotation-based controller and @RequestMapping

Consider this Spring MVC Controller: @Controller @RequestMapping("/test*") public class TestController { @RequestMapping(method = RequestMethod.GET) public void doStuff(Model model){ ... } @RequestMapping(params = "myParam") public void doStuff(@RequestParam("myParam") int myParam, Model model){ ... } } When I p...

Fixing Null EntityManger in Spring MVC application?

In the following code I am trouble with my injected EnitityManager, which always shows up as null; public class GenericController extends AbstractController { @PersistenceContext(unitName = "GenericPU") private EntityManager em; protected ModelAndView handleRequestInternal( HttpServletRequest request, ...

better way for dynamic forms with Spring?

What I wonder is if there's a easier/better way to handle dynamic forms (adding form items to the dom via js) when using SpringMVC and Spring forms? Imaging having an Invoice object that have many LineItems. public class Invocie { private List LineItems; public Invoice() { lineItems = ListUtils.lazyList(new ArrayList<LineItem>(), ...

springdoclet usage?

is springdoclet use to generate bean defination xml files? servlet-config.xml..etc ? i trying to find out what is the different springdoclet compared to spring roo ...

How does one manage object pooling in Spring?

It's my understanding that in Spring, all objects are treated by default as singletons. If singleton is set to false, then a new object will be served at each request. But what if I wanted to pool objects? Say set a range from a min of 1 to a max of 10 instances? Is this possible using Spring? ...

The prefix "security" for element "security:http" is not bound

i get error 2009-05-24 21:49:56,399 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 38 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseExc...