spring-mvc

url-action mapping & routing in Spring MVC 3.0

I'm developing a web application using Spring MVC 3.0 and looking for a ready-made solution, if any, or a "best practices" reference for a url/action mapping and routing system that can achieve the following: REST-friendly controller / method name to view mapping. The current mapping implementation translates the request to a view name...

Spring MVC and annotated controllers issue:

I'm having a strange issue with annotated controllers and Spring MVC. I was trying to use Annotated controllers for the sample MVC application that Spring ships with its documentation. I used 2.5 version. When I specify @RequestMapping at type level, I get "HTTP ERROR: 500 No adapter for handler [Controller class name]: Does your handle...

Spring Dynamic List Binding

I have a typical scenario - I have read many articles on this and dynamic addition seems to work fine. I could not get elegant solution for dynamic delete. A Web Form is simulating a User. User can have name and List of phoneNumbers. phoneNumbers can be added dynamically using Javascript at client side. Dynamic addition of phoneNumber...

Sping MVC - pass model between controllers

Hi, I have created a controller that does some business logic and creates a model. If I pass this model directly to view by returning ModelAndView with view name and model - everything working great. But now I want to display results at another page. So I use "redirect:" prefix to redirect to another controller, but the model is lost. ...

Logging from SpringMVC controller

I have just started exploring SpringMVC and logback. This is my controller, (the only one i have so far) import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Contro...

spring mvc servlet initialization

Hi, I am new to spring MVC. I am looking for a place in my spring mvc applicationwhere I can initialize all sorts of things in the application. usually I did that in the init() method of the my main servlet but now the dispatcher servlet is of spring and I cannot overide the init function. what is the best practice? Thanks. ...

spring 3 upload many files

yeah,our customer want to upload more than one file. we use spring 3 mvc. the official example like this: markup: <form method="post" action="/form" enctype="multipart/form-data"> <input type="text" name="name"/> <input type="file" name="file"/> <input type="submit"/> </form> code: @RequestMapping(value = "/form", method = Req...

Is it possible to reuse the pre-defined controllers in spring annotation configured mvc projects?

Is it possible to reuse the predefined controllers, like the SimpleFormController, with annotation configured spring mvc projects? I downloaded a project that looks like what I want; however, the writer did not use the annotations that are predefined in Spring. The controller of the downloaded project: package net.sourceforge.sannotat...

Java web app security: adding tokens to requests

I'm looking for a method or current API that allows you to add on tokens to web app requests. Maybe within the session but not persisted. Or if you could help me by outlining an efficient method for doing this E.g. 1. GET request => Servlet generates a token and prints it in the view 2. returns a view with a hidden token <input typ...

Spring form not submitting

I am using Spring SimpleFormController for my forms and for some reason it won't go to the onSubmit method Here's my code: public class CreateProjectController extends SimpleFormController { ProjectDao projectDao; public CreateProjectController() { setCommandClass(Project.class); setCommandName("Project"); setSessionForm...

Spring - Show dynamic errors based on specific form field

In my Spring application, I have a form that has multiple inputs of the same field (the user can enter several user names at once). In the validator, I check for the existance of each user name and I want to show an error on the form next to each invalid user name. I can set an error in the validator that will show on the form, but thi...

integrating springMVC and extjs

I am using springMVC and hibernate in my current j2ee project. The view as of now consists of plain jsp, with JSTL to make things a bit simple. Looking at the extjs project, I believe it can be used as a substitute for the view. I have been looking at the extjs docs but frankly, I am not sure how to integrate it in spring. Does anyone ...

MarshallingView in Spring to adjust output?

I have some POJOs which are the basis for this RESTful API I am working on. However, some of the responses I need to include some other information to make the API more complete. I really don't want to put these extra information in the POJO, but include it at the web service layer as if it were. It deals with "People" who have "Appoin...

Why does Spring MVC appends a "1" to the path to generate id of form:checkbox ?

If I have a checkbox like this in my jsp: <form:checkbox path="agreeToLegalAgreements" /> It results in: <input id="agreeToLegalAgreements1" name="agreeToLegalAgreements" type="checkbox" value="true"/><input type="hidden" name="_agreeToLegalAgreements" value="on"/> Why is a "1" being appended to the id ? The reason I ask is because I h...

Help with spring-json using annotated controllers

I've scourged the internet for an example that would use both spring-json and annotated controllers, I'm new to spring so I've had no luck adapting the configuration on spring-json's samples (it uses SimpleController et. al.) Currently I have a controller with 2 mappings, one lists results in html (and works), the other should render js...

Spring MVC Mapping problem

hi everyone I have what I thought was a simple Spring MVC app. However, I can seem to set the requestMappings correctly. What's strange is that the logs show that the url is mapped to the proper controller, yet the Dispatcher cant seem to find it at runtime. Any suggestions would be much appreciated: Log INFO: Mapped URL path [/app...

Spring MVC REST : static files unaccessible because of url-pattern

Hi, My Spring Dispatcher servlet url-pattern is /* (as spring MVC REST suggests) Now all the request are resolved by this Servlet. even CSS/JS/Images also get resolved and handled by servlet.. So, Spring MVC tries to find controller.. :( How to bypass this? Is there any standard way out of this problem?? & Don't want to change url-...

Issue updating a dynamically-binded AutoPopulatingList in Spring/JSTL

Hello, I am having an issue updating a select box's value that was created from a dynamically-binded AutoPopulatingList. Here's what I have: An AutoPopulatingList "basicList" that contains "BasicDefinition" objects that I created. Each BasicDefinition object contains: String value OperatorType object (the OperatorType object contains...

Spring Ajax controller - Accept submissions without refreshing page

I am using Starbox in my Spring page. I want to submit the user rating so I can store it in the database and not have to refresh the page for the user. How can I have a Spring controller that accepts this value and doesn't have to return a new view. I don't necessarily need to return any updated html - if the user clicks the Starbox, ...

What other libraries or tools would you add to a Spring/Hibernate stack for improved rapid application development?

My team at work maintains a fairly large webapp written on top of Spring and Hibernate. We're about to start making some fairly large scale changes to the site, and we're enamored with the rapid application development speeds allowed by some other frameworks, like Rails. We haven't really changed our stack much in the last year or two,...