spring-mvc

No mapping found for HTTP request with URI [/WEB-INF/pages/apiForm.jsp]

my handler forwards to internalresourceview 'apiForm' ? but then i get error 404 RequestURI=/WEB-INF/pages/apiForm.jsp . i'm sure apiForm.jsp located in /WEB-INF/pages/ 13:45:02,034 DEBUG [org.springframework.web.servlet.view.JstlView] - Forwarding to resource [/WEB-INF/pages/apiForm.jsp] in InternalResourceView 'apiForm' ...

How can i register a global custom editor in Spring-MVC ?

Hi, I use the following custom editor in MANY Spring-MVC controllers according to: A controller binder.registerCustomEditor(BigDecimal.class, new CustomNumberEditor(BigDecimal.class, NumberFormat.getNumberInstance(new Locale("pt", "BR"), true)); Other controller binder.registerCustomEditor(BigDecimal.class, new CustomNumberEditor(B...

intercepting requests before they go to the controller in an annotation-based Spring web-app

Hello, I'm developping a web-app and i'm using Spring framework. Thing is, i never properly learned to use Spring and i'm kind of lost in all this. However, using Annotations-based controllers, i was able to create most of my app! Now, the problem is that i would need to be able ton intercept requests before they're sent to the contro...

jdbctemplate, jpatemplate

in my dao, in each method, when i call jdbctemplate, i should call with new jdbctemplate(). right? or get one static instant of jdbctemplate and reuse ? how about jpatemplate? ...

call valang validator in MultiActionController ModelAndView method... possible? how?

hello dudes. is this possible? i am basically making a Spring CRUD web app using MultiActionController class and would want my forms validated. i have used a SimpleUrlController before and valang works perfectly. ...

Is customizing DispatcherServlet in Spring MVC a common practice?

Hi, I am new to Spring MVC. But I had certain experience in working with Struts 1.x. I would like to know if it is a common practice to customize DispatcherServlet while working with Spring MVC, like people sometimes customize ActionServlet or RequestProcessor in Struts 1.x? Or let's extend the question a little bit. Where are the entr...

Programmatically call @Controller

I am transitioning code that used implementations of Spring MVC's Controller to use the annotation stereotype @Controller. Everything is going fine except for one issue: Given a request/response, how do I programmatically handle requests for annotation-based controllers? Previously, (regardless of implementation) I was able to call: ...

Database-sessions in Spring

Hi guys, I'm quite new to Spring, and I would like to understand a bit more about sessions. I've mapped a legacy database with Hibernate annotated entities and built a couple of service objects to fetch, retrieve etc. My entities also contain other entities (mapped through foreign keys) and sets of entities. When I traverse the entitiy ...

Spring AnnotationHandlerMapping not working

Hi, I'm new to spring controllers using annotated controllers. Here is my configuration Bean definition <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /> Controller package learn.web.controller.annotation; import javax.servlet.http.HttpServletRequest; import learn.web.controller.Bas...

How do you set cache headers in Spring MVC?

In an annotation-based Spring MVC controller, what is the preferred way to set cache headers for a specific path? ...

Spring MVC <form:errors/> tag doesn't find error messages

I work with a front-end developer who writes JSP files. We have a form that is working correctly, except validation/binding/processing errors can't seem to be displayed with Spring's <form:errors/> tag. I've confirmed that the error is being set, and what is apparently the correct path for the errors. Supposedly <form:errors path="*" /...

How does ThrowawayController in Spring MVC get the parameters from a request?

This is an example of using ThrowawayController in Spring MVC: public class DisplayCourseController implements ThrowawayController { private Integer id; public void setId(Integer id) { this.id = id; } public ModelAndView execute() throws Exception { Course course = courseService.getCourse(id); ...

How to store session in Spring MVC

What's the best way of storing session related data of a user (like, for example a log of recent actions a user has done) in a Spring MVC (2.5) web application ? Using the classic javax.servlet.http.HttpSession or by specifying scope="session" in controller beans, and storing the data in a session object ? ...

Spring MVC and parsing HTML

I have a controller class as in the following code segment: @Controller public class SiteEntryController { @RequestMapping(value="/index.htm") public ModelAndView handleIndex( @RequestParam(value="enableStats", required=false) String enableStats) { ModelMap map = new ModelMap(); ........... return ne...

Grails request parameter type conversion

Hi, In my Grails app, I need to bind a request parameter to a Date field of a command object. In order to perform the String-to-Date conversion, one needs to register an appropriate PropertyEditor in grails-app\conf\spring\resources.groovy I've added the following bean definiton: import org.springframework.beans.propertyeditors.Custom...

When do @SessionAttributes in SpringMVC get removed? (With code sample)

Under what exact circumstances do @SessionAttributes get cleared? I've discovered some confusing behaviour when trying to use two models in a page. When I do a GET followed by a POST using this controller... @Controller @RequestMapping("/myPage*") @SessionAttributes(value = {"object1", "object2"}) public class MyController { @Reque...

how to display custom error message in jsp for spring security auth exception

I want to display custom error message in jsp for spring security authentication exceptions. For wrong username or password, spring displays : Bad credentials what I need : Username/Password entered is incorrect. For user is disabled, spring displays : User is disabled what I need : Your account is diabled, please contact ad...

Reslove PageNotFound with spring MultiActionController

I am trying to use a MultiActionController in spring mvc, but I keep getting a 404 with the following message in the log (org.springframework.web.servlet.PageNotFound) No mapping found for HTTP request with URI [/www.mysite.no/a/b/c] in DispatcherServlet with name 'myServlet' It looks like I'm following the book example, but ...

spring-mvc download action

Is there some trick to getting a SpringMVC custom view to cause a file download in the broswer? I've implemented the render method from org.springframework.web.servlet.View but the code results in my data being written to the page as a blob of data rather having a download action start. try { Document oDoc = (Document) model.get("o...

How can i get generic type from a Class object ?

Hi, Suppose the following class public class Message { // some code } And a Spring Validator implementation (no Spring knowledge required) public class MessageValidator implements Validator { public boolean supports(Class clazz) { if(clazz.isAssignableFrom(Message.class)) return true; else if(<AN...