spring-mvc

questions on spring mvc form handling form's and validation

With spring MVC, do you have to use one of the special form controllers or it just makes things easier? I want to create a form, which doesn't directly map 1:1 to a particular entity, and perform server side validation on them data. For the front end, I want to use jQuery. Does spring tie itself to a particular javascript library or c...

Trying IntelliJ with spring 3.0 MVC, how to import required libs?

I'm trying out intelliJ's commercial editor with spring mvc 3.0 It seemed to have imported the files into the lib, but I guess I am missing something. I have downloaded spring 3.0 in my downloads folder, but I haven't imported them into the editor since it set things up for me automatically. The annotation: @RequestMapping is not being...

Using spring framework with maven instead of ant

Is there a tutorial somewhere which shows how to use spring framework with maven instead of ant? This one seems very good but it's all built with ant. EDIT I really don't know which answer to accept both are valid. I'll wait for some time let the community decide ...

Help with first spring MVC page using annotations

I'm trying to get http://localhost:8080/test to map to the index.jsp page. The jsp file is stored in the folder: /web-inf/jsp/index.jsp what I have so far: @Controller public class HomeController { @RequestMapping(value = "/test") public String Test(){ return "index"; } } My web.xml: <?xml version="1.0" ...

Spring MVC 3 Validation - Unable to find a default provider

I get an error when trying to set up Spring MVC validation. javax.validation.ValidationException: Unable to find a default provider I read in the documents that the default provider they use is the hibernate-validator. Do I need to include this library to get validation to work? Is it okay to include this library even though i'm not...

what tomcat native library should I be using in production?

When I compile my spring mvc app, I get this in the output: INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_17\bin;...... What exactly should I use in production that this is referring to? ...

including style sheet in a jsp page with Spring MVC

I am having trouble linking to a style sheet from a jsp page. I believe it has something to do with my directory structure which is: WEB-INF |-- css | |-- main.css | |-- jsp |-- login.jsp I have tried various forms of the standard html link tag such as: <link href="css/main.css" rel="stylesheet" type="text/css" medi...

Spring form handling, mapping an entity to form inputs

Just looking at the petclinic sample application, and trying to learn form handling. It seems the form maps to an entity 1:1 correct? Is there any other configuration that has to be done, or will spring just know that all the form inputs map to the entity because that is what was added to the model in the GET request? @Controller @Req...

Spring MVC 3 - Binding parameters to backing object

I am trying to setup an edit form for my User object. I have automatic binding from the form to the user object working fine. I'm wondering how do I prevent malicious users from binding to fields of my User object that I don't want them to? For example, my user object has userName, and it also has points. When they click edit user, I...

Spring 3 MVC Nesting RequestMapping

From Spring Official Document, Spring 3 MVC look to be support nesting Request Mapping. http://static.springsource.org/spring/docs/3.0.0.RELEASE/spring-framework-reference/pdf/spring-framework-reference.pdf In page 448, they mentioned: @Controller @RequestMapping("/appointments") public class AppointmentsController { //... @RequestM...

Issues with setting URL mappings in Spring MVC 2.5

I have the following in my web.xml file: <servlet> <servlet-name>onBoardingUI</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>sample</servlet-name> <url-pattern>*.html</url-pattern> </servl...

Deploying to tomcat via eclipse and maven2 plugin doesn't seem to be working

I have a simple spring 3 mvc application, that just ouputs index.aspx when someone browses to http://localhost:8080/ When I do RunAs and run on server option (which is hooked into tomcat 6), it opens up the browser to http://localhost:8080/springmvc2/ (where springmvc2 is the applications name). I have build this same simple test app...

Spring MVC 3 - Respond to request with a 404?

In my controller I do a permissions check to see if the user can do the certain action. If they can't, I'd like to return a 404. How do I tell Spring to return a 404? ...

Spring application context : webapp folder variable ?

Greetings, Is there any Spring variable for Web application folder? I want to assign a bean property as following. Where ${WEBAPP-FOLDER} is the absolute path of the web-app folder. Any tips? <bean id="compass" class="org.compass.spring.LocalCompassBean"> . . <prop key="compass.engine.conne...

How to configure DispatcherServlet to run in junit test enviromnent?

I'a using spring 3.0 and I want to test my Spring controller using MockHttpServletRequest and MockHttpServletResponse. My controller is configured using annotations, so it has no method that takes HttpServletRequest and HttpServletResponse params. The only way is to setup DispatcherServlet properly and call service method. The problem is...

How to implement pagination in Spring MVC 3

Hello, Is there any out-of-the-box, easy to implement, standard pagination component/tag-lib or code-sample available for pagination in Spring MVC? Cheers ...

A page with some input boxes posts to a action, what are my options in retrieving form values?

I have a controller that a form posts to: @RequestMapping(value = "/formtest", method = RequestMethod.POST) public ModelAndView HandleFormPost() { ModelAndView mv = new ModelAndView("posttest"); return mv; } What are my options in retrieving the data from the form? In asp.net I would just do: Request...

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class

I replaced j2ee.jar with servle-api.com from my tomcat 6.0 installation directory: And that yields the error below. I'm presently trying to figure out the cause. What might the problem be. I have a the bean defined in a configuration file: Sempedia-service.xml as follows <beans xmlns="http://www.springframework.org/schema/beans" x...

How to handle back browser button problem using spring?

How to handle back browser button problem using spring?. In my application user login properly and when user click on back button page state is not maintained. So do i maintain the page state even the user click on back button / forward button Thanks ...

Spring view controller different mapping

i want to create a mappings for a spring view controller: this works: <b:property name="mappings"> <b:props> <b:prop key="/index.do">indexSpringController</b:prop> <b:prop key="/index.htm">indexSpringController</b:prop> <b:prop key="/index.html">indexSpringController</b:prop> </b:props> </b:property> b...