spring-mvc

Is it best practice to mention commandClass in the controller instead of url bean mapping xml file ?

Is it best practice to override formBackingObject() in the controller(which extends SimpleFormController) instead of mentioning the command class in the url bean mapping xml file ? CommandClass is not frequently changeable, so is it right to mention in the controller itself ? ...

How can I use SimpleFormController with Validator with Spring 3?

Hi, I'm using Spring 3 and using SimpleFormController is deprecated. It sounds like we should use annotions like @Controller instead. Okay, but how can I manage the validator for my form within my controller? Thanks ...

spring @autowired

to use @autowired. in xml, i only need to included <context:annotation-config /> ? is there any other tag i need to put ? need to put componenet-scan ? weird, i get error below ERROR - ContextLoader.initWebApplicationContext(203) | Context initialization fa iled org.springframework.beans.factory.BeanCreationException: Error creat...

Getting error when submitting form using SpringMVC and REST

Hello there, Created an online form in JSP using SpringMVC tag libraries. The controller for my form is a RESTful web service. The RESTful web service has two calls: (1) http://localhost:8080/myapp/applications/new This brings up the online form in the browser (this works). (2) http://localhost:8080/myapp/applications/create This ...

Spring MVC - jsp not rendering

I'm just starting with Spring MVC trying to create a new project, and came accross an issue for which no manual or tutorial seems to help... I have set up a simple application with no logic, just trying to get Spring configured properly. The controller just returns the name of a view to be displayed, but the view resolver is not renderi...

How can I access path variables in a URI template in the view (Spring 3/SpringMVC)?

I have a URI template in the form of "/hotels/{hotel}/bookings/{booking}", and can access the path variables in the controller via @PathVariable, but when building links in the view I need a reference to the different path variables. As an example, let's say the user requests "/hotels/123/bookings/booking-123", and in the view, there ...

How to best use JTidy with a Spring servlet container?

I have a Java servlet container using the Spring Framework. Pages are generated from JSPs using Spring to wire everything up. The resulting HTML sent to the user isn't as, well, tidy as I'd like. I'd like to send the HTML to Tidy right before it's sent to the client browser. I'll set it up to work in development and be turned off in ...

using spring validation on request headers

Is it possible to use the spring validation framework with Spring MVC to validate the presence/absence and value of an HTTP request header? Thanks! ...

Custom JSTL tags with body

Hi, We are going to use JSTL and custom JSTL-tags for some sort of template-engine in our JSP/spring-project. Is there a way to create a tag that looks similar like this: <div id="site"> <div id="header">Some title</div> <div id="navigation"> SOME DYNAMIC CONTENT HERE </div> <div id="content"> ${content} </div> <div id...

Spring view resolution problem

Spring, Spring MVC 2.5, Tomcat 6.0. In my controller: ModelAndView returnModelAndView = new ModelAndView(new InternalViewResolver("/sandbox/test1.jsp")) Was working. Then I switched the Tomcat (6.0) context path from "/appname" to "" in order to reference the webapp from the root context "http://localhost:8080/". All my filter, intercep...

Is there any way to create form with multiple submit buttons on Spring MVC using annotations?

I'm trying to create simple add/remove form using annotation based Spring MVC. 'Add' functionality comes smoothly, but when I tried to add another button to form i've got stuck. Here is my code: Controller actions: @RequestMapping(value = "/books/documentType.do", method = RequestMethod.GET) public String getDocType( @RequestP...

Spring MVC resource bundles

Hello. Is it possible to have multiple resource bundles in spring mvc? I want to separate my resource bundles for example one for errors, another for global messages, other for image names etc. so I don't have just one very big file I'm using this <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessag...

Spring security 2.0.5. custom login form. Cannot see errors in language other than English.

Hello, I've got my Spring Security custom login form working. It displays errors if the user has input bad credentials, or is expired, etc. Looking inside spring-security-core-2.0.5.RELEASE.jar, I notice the following files in the org.springframework.security package: messages.properties messages_cs_CZ.properties messages_de.propertie...

Spring MVC binding parameters to backing object

I am using Spring MVC and in my controller, I want to be able to automatically bind incoming parameters to my Java object. It seems like this should be pretty easy to do. The only wrinkle is that the incoming parameter names (e.g. "username") may not match up exactly with the field name in the java object (e.g. "name"). From the Spring ...

what do the terms formBackingObject and ModelAttribute mean in Spring MVC?

I guess I don't understand the difference between a "FormBackingObject" and a "ModelAttribute" in spring MVC. Seems like both gets initiated and populated by Spring with an incoming request. ...

Return same view controller using ModelAndView of Spring Web MVC

I am using Spring Web MVC and Hibernate for developing my application. My login.jsp page has following code : <form:form method="post" commandName="User"> User Name : <form:input path="email"/> Password : <form:input path="password"/> <input type="submit" align="center" value="Execute"> Now, My servlet.xml file ha...

Best way to do Spring MVC without JSP?

I wish to use Spring MVC to provide a REST web service. However, running through some books and tutorials, it looks like ModelAndView always returns a parsed JSP file. I guess I could make the JSP build my XML document, but is this the best way to go about things? I thought that perhaps a more structured XML building approach might be ap...

Help needed for integrating Displaytag with spring web mvc

Hello All.. I just wants to know that is it possible to integrate Displaytag with spring web mvc ? If it is possible then can anybody please provide some tutorial or links for that ? Thanks in advance.. ...

Error suggests springmvc-servlet.xml is wrong but on inspection it looks right?

I am learning Spring and building a sample app. I am getting the error: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Bean name '/list_cars.html' is already used in this file Offending resource: ServletContext resource [/WEB-INF/springmvc-servlet.xml] I previously got a similar error ...

Spring Forms - How to Check for Error on Specific Path

Hello, I'm using the Spring Form library to handle a search page in my application. Here is a snipped from my DD showing the bean configuration: <bean name="/search.html" class="myapp.web.AccountSearchController"> <property name="sessionForm" value="true"/> <property name="commandName" value="searchAccounts"/> ...