spring-mvc

multi-staged form using spring

hi all, please forgive me for this stupid questions. I just started developing web application using spring yesterday. The project that i worked on, have a multi staged form, that require users to complete them before the data can be persisted on the database. Is there any way to keep those input in a temporary storage eg: session scope...

Spring Forms + GWT

I'd like to learn how to use Spring Forms and GWT. Basically my forms just ask for a bunch of links and you can submit them. The twist is that when I add a link I want it to be previewed (e.g print the title of the page, some description etc) via an RPC call. The solution I can think of is to use GWT's form panel and bind the inputs to...

Spring configuration file gives BeanDefinitionStoreException

I am trying to complete the Spring MVC tutorial at: http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html My problem is similar to this one http://stackoverflow.com/questions/266601/spring-configuration-error However none of those solutions seem relevant. I am getting the following stack trace: org.springframework...

Spring MVC: How to resolve the path to subdirectories of the root 'JSP' folder in a web application

What is a simple way to resolve the path to a JSP file that is not located in the root JSP directory of a web application using SpringMVCs viewResolvers? For example, suppose we have the following web application structure: web-app |-WEB-INF |-jsp |-secure |-admin.jsp |-admin2.jsp index.jsp login....

Is it good practice to use multiple command object for a MultiActionController ?

I have a MultiActionController which has 4 methods. Is it good practice to create 4 different command objects as 2 fields are common for all methods and other 2 fields are not used by two methods ? ...

Calling @Controller methods once per request

Is there a nice way to have Spring's @Controller classes to call a specific method once per request? Right now I'm using a method annotated with @InitBinder for this purpose, but this is suboptimal as @InitBinder methods get called several times per request. I just want to do some initialization / update stuff to use in my controllers. ...

Spring Security: Cannot access target page even after successful login

Spring version: 2.5.6 SEC01 Spring Security version: 3.0.0 RC1 I'm attempting to integrate Spring Security with a Spring MVC application. The security part is largely based on the example applcation that ships with Spring Security. I've defined some pages that require a specific role to access them and as expected, when accessing them w...

In a spring messages.properties, how to ensure line break of error message when using an error code as key ?

In messages.properties: error.code=This is error message.\nThis is next line of error message. Now, when I set "errors.rejectValue" with this "error.code" for a form field, I cannot get the line break of '\n' to display on the jsp page when displaying the error message using the form:errors element. Instead of '\n', using <br/> also ...

How to reuse fieldlength in form, validation and ddl ?

I'm working on an Spring application with lots of input forms. I'd like to reuse the field length in the UI-form, validation and JPA annotations. Is there an elegant way to solve this. My solution at the moment is, to use constants to declare the length: public class Person { public static final int FIRSTNAME_LENGTH = 25; @Column...

Spring Webflow Best Practice

Hi. I have a java web application which uses spring webflow as framework. I have a problem with processing data on a plain flow xml. When the processing gets more complicated I find it hard to implement using the flow xml of the web flow. I was considering of using controllers to perform these operations. How do I do this. Have no Idea ...

Spring - handle multiple forms submit with one controller

Is it possible to have one controller to handle multiple forms in spring? For example, i have 3 steps registration that map with "/register" url. Is it possible to have only one RegisterController that can handle all registration's steps form submit? ...

Serve JSP stored in DB

Hi, I want to server a JSP page that is stored in a database as a blob. So if a request comes in at the url http://mydomain.com/app/list.jsp I know to go to the DB to retrieve the resource list.jsp. I am using spring and tiles, so have adispatcher servlet and controllers set up and working in traditional sense. Would this be similar in...

Execute a task after the modelAndView is returned

In Spring, is there a way to execute a task after returning a view or I need to create a ThreadPool and do it ? Ex: public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { Map<Object, Object> data = new HashMap<Object, Object>(); //do some stuff exe...

Spring - multiple command class with AbstractWizardFormController

Can i have a AbstractWizardFormController controller with different command class for each page ? ...

back button filter not working

Hello I have configured a filter to disable my browser back button and show the user as session expired. It is working as expected when i configure that in my application prototype but when i incorporated it to my (spring MVC) application it is not working. I have configured my filter like this <filter> <filter-name>backButtonFilter<...

purpose of webAppRootKey ?

Can somebody explain this entry in web.xml ? When it has to be used and why ? <context-param> <param-name>webAppRootKey</param-name> <param-value>webapp.root</param-value> </context-param> Is this something related to Spring or general one? ...

Spring MVC: Resolving the view based on User-Agent

Spring Version: 2.5.6 I want to resolve the view to a specific velocity file based on the value of the User-Agent header. My current line of thinking is an implementation similar to the UrlBasedViewResolver such that the user-agent value is Map'd (via context) to a specific directory(value) based on a matching a regular expression(key)...

Where are the Spring MVC validation error codes resolved?

I am attempting to write validators under the Spring MVC framework, but there is a glaring omission in the documentation. When calling passing an error to the Errors object most of the methods expect an String parameter named errorCode. These errorCodes, if I understand correctly serve as stand ins for specific error messages. But I can'...

Spring Web Application without any XML

Spring JavaConfig makes possible to create spring applications without xml cotext configuration. And servlet 3.0 specification makes possible to create web applications without web.xml. So, is it possible to create spring web application not using any xml configuration? Is there any already implemented solution? PS At now I do not see ...

keeping track of multiple related input boxes using spring mvc

we have a list of domain objects needing to be edited on an html page. For example, the command & domain objects: class MyCommand { List<Person> persons; } class Person { String fname; String lname; } Then, the HTML I expect to have the Spring MVC tag libraries generate is like this: <form> <input name="persons[0].fn...