spring-mvc

Spring 3.0 MVC ExceptionHandler

I'm writing my Exception Handler from Spring MVC controller and I have the following code: @ExceptionHandler(NullPointerException.class) public ModelAndView handleMyException(NullPointerException exception) { System.out.println(exception.getMessage()); ModelAndView modelAndView = new ModelAndView("/errors/404"); ...

Problem running Spring 3 mvc-basic sample

I am trying to get started with Spring 3, using Eclipse 3.6 and Spring STS. I have also installed m2eclipse. I have checked out and imported the Spring3 mvc-basic sample app. When I try to run it (via eclipse/run/run on server) I get a number of errors in the webapp startup on tomcat, all relating to jstl1.2.jar: org.apache.jasper.Jas...

Forward to a static html page from Controller

My spring mvc application has one single ContentNegotiatingViewResolver that defines JsonView for rendering json resonses: <mvc:annotation-driven/> <context:component-scan base-package="world.domination.test"/> <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <property name="mediaTypes"> ...

Spring MVC: RESTful web services + BlazeDS integration possible in the same web application?

I have a Spring MVC web application which provides RESTful web services via a controller class (annotated with @Controller) which has methods mapped to specific request types and signatures via @RequestMapping annotations. I have attempted to integrate a BlazeDS service destination into the mix by 1) adding the HttpFlexSession listener ...

Spring MVC : showing a link in the error message.

Hi, I have the following snippet of code in the Validator which basically is used to show an error message. In the error message I would like to show a link by sending it as a parameter in the error message. if (user != null && formData.getUserId()== null) { errors.rejectValue("email", "email.already.exists",new Object[]...

Render partial JSP fragments in Spring MVC?

hi, all I am quite new to Spring MVC, and trying to figure out how to render a partial view without refreshing the whole page. I thought: if I can post a request to the backend, in this case, a Spring controller method And if this method fills in model attribute, and then return ModelAndView object with specified view name mapping to ...

Using <mvc:resources .../> in spring 3 causes all other views to stop working

Simplest example: I have a dispatcher servlet configured to catch everything: <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> I have a simple test controller: @RequestMapping("/index") @ResponseBody public String rootTest(){ return "Main page displayed from TestC...

How to set a local variable in application-context.xml to represent a repeating value?

If the president changes, I would have to change the value of presidentName three times below in the application-context.xml: <beans:property name="presidentName" value="Barack Obama" /> Is there a way to set variable once in application-context.xml to represent the string Barack Obama. <?xml version="1.0" encoding="UTF-8"?> <beans:b...

How to alter the state of spring session/request scoped beans?

Hello all, I really like to use spring stereotype annotated beans in spring MVC apps and would like to use Spring scope annotations to the full extend. No more need to fiddle around in HttpServletRequest or it' s session. One thing isn' t really clear to me though and maybe someone could provide me with some insight or explanation on ho...

How to store model information in spring mvc with hibernate

Hi, I need advice how to store model in spring mvc 3 with HIbernate (example on ilustration) I have model public class Customer{ int id; String name; String surname; ArrayList<Contact> contacts; ... getters, setters } Here is class Contact public class Contact{ int id; String ...

Is it possible to add @Secured or @PreAuthorized annotations on an entire class

It seems logical to secure an entire class of controllers rather than each method. Can I do this: @Controller @Secured("ROLE_USER") public class accountPages { //Controllers } ...

Spring MVC 3 AJAX

I'm taking my first steps to explore Spring MVC 3 (annotation driven) and the JSON functionality that it supports. 1) In my JSP page I want to click a link that retrieves JSON $("a[class=simple2]").click(function() { $.getJSON("checkName.html", function(contacts) { alert(contacts); }); return false; }); ...

Spring MVC 3.0 + jsp footer

Hi, I'm writing Sping MVC based application all my methods inside a controller return ModelAndView objects. What I would like to do is to apply standard HTML footer on each JSP page, like signup/signin/about us/contact use/etc... Is there any way I can do it within a controller? I know that I can use <%@ include file="footer.jsp" %> ...