spring-mvc

Spring RestTemplate Behavior when handling responses with a status of NO_CONTENT

Okay, I have a class NamedSystems, that has as its only field a Set of NamedSystem. I have a method to find NamedSystems by certain criteria. That's not really important. When it gets results, everything works fine. However, when it can't find anything, and thus returns a null (or empty -- I've tried both ways) set, I get problems. Let...

Hibernate JPA, Spring MVC and LazyInitializationException

Hi All When trying to get items from db, I got this error: 13:00:13.876 [7838526@qtp-204712603-0] ERROR o.h.LazyInitializationException - failed to lazily initialize a collection of role: bo.myobj, no session or session was closed org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: de.myob.linke...

Infinite Recursion with Jackson JSON and Hibernate JPA issue

When trying to convert a JPA object that has a bi-directional association into JSON, I keep getting org.codehaus.jackson.map.JsonMappingException: Infinite recursion (StackOverflowError) All I found is this thread which basically concludes with recommending to avoid bi-directional associations. Does anyone have an idea for a workaro...

How to create a default method in SpringMVC using annotations?

I can't find a solution to this, and it's driving me crazy. I have @Controller mapped that responds to several methods using @RequestMapping. I'd like to tag one of those methods as default when nothing more specific is specified. For example: @Controller @RequestMapping("/user/*") public class UserController { @RequestMapping("l...

How to use @requestMapping headers?

I studying springmvc,When I use @RequestMapping(value="/helloWorld", headers = "content-type=text/*"),I input http://localhost:8080/SpringMVC_10100/helloWorld ,I found console is WARN org.springframework.web.servlet.PageNotFound - No matching handler method found for servlet request: path '/helloWorld', method 'GET', paramet...

Spring Configuration Settings For Neo4j

Hi I would like to integrate the "neo4j_config.props" file from http://wiki.neo4j.org/content/Configuration_Settings#Optimizing_for_traversals_example into the : a neo4j spring app, the graphDbService which is configured the in app-config.xml: <bean id="graphDbService" class="org.neo4j.kernel.EmbeddedGraphDatabase" init-method="en...

Why SpringMVC Request method 'GET' not supported ?

I trying @RequestMapping(value = "/test", method = RequestMethod.POST) but is error Code is @Controller public class HelloWordController { private Logger logger = LoggerFactory.getLogger(HelloWordController.class); @RequestMapping(value = "/test", method = RequestMethod.POST) public String welcome() { logger.info("Spring param...

learning Spring's @RequestBody and @RequestParam

Hello, So I'm editing a web project that uses spring and I need to start adding some of spring's annotations. Two of the ones I need to add are @RequestBody and @RequestParam. I've been poking around a little and found this, but still don't completely understand what I'm to do with these annotations. Could anyone give me an example?...

Spring's Json not being resolved with appropriate response

I've tried to have a controller in Spring return a JSON response to no avail using the Jackson classes as recommended with 3.0. I've got the jackson jar files(jackson-core-asl-1.5.5.jar & jackson-mapper-asl-1.5.5.jar) in my class path of course. As for the appconfig.xml entries, I'm not sure I need these. I've put them in there as a las...

java multithreaded ajax update

I have jsp, which does ajax requests to a controller and passes IP's and shell commands that server will do. For example, ajax request has params "127.0.0.1", "ls -la, ls". (commands - is a list) Server executes these commands in separate threads(one thread per IP, or other) and updates table on jsp which contains output data of these co...

Need to verify the older way of defining handler mappings using mvc:annotation-driven?

In an app I'm looking at I find this in the dispatcher xml: <mvc:annotation-driven /> Am I correct that this is the Spring 3 way of defining handler mappings (url routes). One of the controllers in the app looks like this: @Controller @RequestMapping("/order") @SessionAttributes(OrderController.ORDER) public class OrderController { ...

What's the difference between ModelAndView and ModelMap?

Is ModelMap just the new name in Spring 3 for a ModelAndView? Does the functionality change in Spring 3? Consider this code in a Spring 3 app using a ModelMap: @RequestMapping(value = "/order", method = RequestMethod.GET) public final String setup(final ModelMap model) { model.addAttribute(ORDER, new Order()); return "setup"; ...

When does it make sense to use Spring WebFlow on top of Spring MVC?

Spring MVC has become a very popular framework for building enterprise web applications. Any complex web application has certain flows that need to be coded, including some conditional flows (i.e., show order processed if the credit card information was correct, or validation errors if something was not entered correctly). When does it...

How to use Servlet 3 @WebServlet & async with Spring MVC 3?

I wanna integrate the servlet 3.0 async support with spring MVC. Something like: @RequestMapping("/chat") @WebServlet(name="myServlet", asyncSupported=true) public String getMessage(String userName) { ...... } is it possible? ...

How does Spring 3 map the form-post in this jsp?

At line 17 of login.jsp, there is the following line of code: <form action="/login/submit" method="post"> What I can't determine is where Spring submits this form to. In the corresponding LoginController.java, I don't see any mapping to the URL '/login/submit' such as this: @RequestMapping(value = "/login/submit", method = RequestMe...

spring 3 | show binding errors next to each input

Hi @all! My first question as a spring newbie: How do I show validation errors NEXT to each input/component? Validator: @Override public void validate( final Object obj, final Errors e ) { ValidationUtils.rejectIfEmpty( e, "firstname", "error.firstname.empty" ); } JSP: <form:label path="firstname"> <spring:message code="labe...

Please recommend what navigation strategy to use for Spring MVC 3.0.

I'm starting out a Spring MVC 3.0 application and getting controllers and views working nicely, the one thing I now need to do is get navigation working. So for each view I have, it needs to know what item in the "menu" part of the view to highlight and what menu options are available to that view. One thing I thought of was to get the ...

spring 3 sub-bean validation

I try to validate via org.springframework.validation.Validator. My Problem: I have the a form-bean which has data beans. PlayerRegistrationDataBean -> has: PersonBean So how do I have to validate the PersonBean if I do not want to implement the validation everywhere I use PersonBeans as "sub-beans"? ...

Grails 1.3.3 filters - either a NullPointerException or a ClassCastException

Hello, Today I upgraded our grails app from 1.0.3 to 1.3.3 and, of course, things started behaving weirdly. The problem I'm currently asking about is as follows: the web.xml contains: <filter> <filter-name>sitemesh</filter-name> <filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class> </filter> ...

SpringMVC How to obtain a bean from session scope when it's constructor is called.

Hey there! I'm pretty new to the Springframework (as you will guess) and ran into a situation, where help is desperatly needed. I do hava a J2EE application here, running on tomcat with lots of old code. Anyway, we decided to use the Spring framework for certain tasks. For example we want to store a security object (containing the usern...