spring-mvc

How to use multiple ViewResolvers in Spring?

I am working on a web app where I have most of my pages making use of apache tiles (2.1.2), but a few of them need to just be plain jsps. I am having a problem in that both an InternalResourceViewResolver and a UrlBasedViewResolver will try to resolve the view no matter what, so that no matter which ordering I use, it will either fail o...

Strange 404 error using spring mvc

This is a long shot but hopefully someone can help. My application is using spring framework mvc. 99% of if works properly. However when I attempt to go to one link lets call it [path]/link.html. I get a 404 error. If however, I go to this link within my development environment (tomcat,windows,IE and eclipse) I get no such 404 error...

Error 500: Filter [Spring OpenEntityManagerInViewFilter]: could not be loaded

hi Experts, I am trying to deploy a Spring application on WAS 6.0 (JDK 1.4.2). Day back I was getting tons of (Unsupported major.minor version 49.0) errors. I replaced most of the jar files and now I am left with only one error on: org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter (Unsupported major.minor version 49.0) ...

Should validators in spring access the database?

I'm not really sure if it's a good design decision to make the validators validate commands based on the state of the database. For example if I need to validate a User bean besides checking if the email and username are empty etc. I also need to reject values if they are already used. Should this kind of logic go in the validators or th...

Spring MVC and Prototype JavaScript

Hi, I am trying to call a Spring MVC controller through an ajax call from JavaScript method.The javascript method is using Prototype library to make the ajax call.The controller throws JSP as output. I am able to hit the controller as i can see in the log messages however the response seems to get lost.What could be the issue.Here is t...

Spring MVC form input value is always null

Hi all, I'm new to Spring MVC, but not new to web development in Java. I'm attempting to create a simple form->controller example. I have a form, a form controller (configured in a context XML pasted below) and my model (a simple bean). When I submit the form the value of my text input is always null, regardless. Any ideas? Form cont...

Resolve message from property file

How can we resolve a message from properties file? Just like when we use errors.reject ( "xyz.abc" ); in this case "xyz.abc" is resolved from the property file specified in messageResource ( servlet.xml ) ...

Spring MVC support for dynamically populating select box

Does Spring 2.5 (or 3.0) include support for dynamically populating a select list based on what the user selects from another form element? For example if you have a form with 2 select for (Car) Make and Model. When the user selects a Make from the first list, the Model select should get populated with the available Models for that Make...

Parent Contexts in spring based web-app

Hey, I'm deploying my EAR/WAR file to Jboss 4.2 and i've wired the web.xml to load the common application context file, so i can share common bean via parent spring context. <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoc...

Neither BindingResult nor plain target object for bean name available as request attr

Hi Experts, I have this controller code which is throwing the above mentioned error. It was working fine till yesterday, I have no clue what colleague did to this code and today I am seeing the error: Neither BindingResult nor plain target object for bean name 'sideForm' available as request attribute Can you please suggest me where...

Can I find the URL for a spring mvc controller in the view layer?

I think what I need is called reverse url resolution in Django. Lets say I have an AddUserController that goes something like this: @Controller @RequestMapping("/create-user") public class AddUserController{ ... } What I want is some way to dynamically find the url to this controller or form a url with parameters to it from the view (...

How to load themes from the database in Spring MVC?

I'm going to have a single site that needs to be themed a number of ways. I want to pull the theme information from a database to save from having to redeploy every time a new theme is needed. I read you can create a custom ThemeSource implementation but was unsure how to implement a database driven theme source. Anyone have experienc...

How to bind a Child collection element to a Parent command class through addChild convenience method (Spring MVC)

Hi, I have a domain class named Parent as follows public class Parent { public List<Child> childList = new ArrayList<Child>(); public void setChildList(List<Child> childList) { this.childList = childList; } public List<Child> getChildList() { return childList; } public void addChild(Child ch...

Form binding a HashMap using annotation based controller in Spring 2.5

Hello, I have been hitting a brick wall with this problem for some time and no amount of searching and reading has turned up an answer. I have posted on the Spring forums, but to no avail. Maybe someone here can help? I have a bean containing a HashMap which I have bound to form using the Spring:form taglib and Spring:bind. Binding to ...

Spring roo Vs (Wicket and Spring)

Spring roo is new framework and I found it very interesting. I have been working on web application for last 3-4 years and Always found JSPs are hard to maintain across teams if everyone is not disciplined enough about separation of markup and serverside logic. I have used JackBe/BackBase in last projects and I enjoyed xml templates work...

Problem with ModelAndView and ModelMap in AnnotationController, Springframework

I have a question that is a point difference between ModelAndView and ModelMap. I want to maintain modelAndView when requestMethod is "GET" and requestMethod is "POST". My modelAndView saved others. So I made modelAndView return type to "GET", "POST" methods. But, Request lost commandObject, form:errors..., if request return showForm ...

Specifying relative resource path via Spring XmlWebApplicationContext

The actual question is: Is there a way to get XmlWebApplicationContext to load resources using paths relative to the context location? For clarity's sake, let's say "context location" is the location of the first file specified via setConfigLocation() method. Detailed explanation is below: I'm using Spring MVC in web tier and Spring...

org/springframework/metadata/Attributes not found in spring3.0?

may i know which jar is this class java.lang.NoClassDefFoundError: org/springframework/metadata/Attributes located? i cannot find it inside org.springframework.aop-3.0.0.M1.jar . but in older version of spring, it exist spring2.0 . the reason i need this file is because i am trying out spring modules 0.9 @Cacheable tutorial. ...

Retrieving a model from ModelAndView in jsp

Hi all, I am currently trying to return a model from onSubmit() in my controller. I then am trying to retrieve this in my jsp. for example Map model = new HashMap(); model.put("errors", "example error"); return new ModelAndView(new RedirectView("login.htm"), "model", model); and then retrieving it with <c:out value="${model.errors}...

Vaadin and Spring MVC Integration

I'm thinking about the possibility of using Spring MVC with Vaadin Framework. Are there any documented ways of making them play nicely together ? Also is it a good idea to use them together ? relating to performance; I'm going to run the app on a dedicated server. To make my question a bit more clear, how can i return a modelandview fr...