spring-mvc

post xml to Spring REST server returns Unsupported Media Type

I'm trying to create a simple spring based webservice that supports a "post" with xml content. In spring, I define an AnnotationMethodHandler: <bean id="inboundMessageAdapter" class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> <property name="messageConverters"> <util:list> ...

request scoped beans in spring testing

I would like to make use of request scoped beans in my app. I use JUnit4 for testing. If I try to create one in a test like this: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:spring/TestScopedBeans-context.xml" }) public class TestScopedBeans { protected final static Logger logger = Logger...

Spring MVC manual form elements

How would explicit hidden input elements be bound a model attribute? I'm not using <spring:bind> or <form:hidden>. I have a Form bean that has an object with a child collection. A user adds to that collection on the fly... public class Parent { List<Child> children = new ArrayList<Child>(); } public class Child { String name...

Issue in executing Spring Web project in Eclipse on Tomcat server

Hi All, I have a Spring web project that uses Maven to compile/build. There is no issue in building the project. I am trying to run the project in Eclipse (3.3.2) on Tomcat (v6) server. As part of Spring project, I have a spring-servlet.xml file in WEB-INF directory. This file includes another resource xml file that has datasource conf...

Representing multiple ordering through Spring @RequestParam

My Application currently serves requests for data, and can order the data to the users requirements, using RequestParams @RequestParam(value = "orderBy", required = false, defaultValue = "severity") String orderBy, @RequestParam(value = "order", required = false, defaultValue = "desc") String order, You get the idea. However, I want ...

Spring 3 simple extentionless url mappings with annotation-based mapping - impossible?

Hi, I'm using Spring 3, and trying to set up a simple web-app using annotations to define controller mappings. This seems to be incredibly difficult without peppering all the urls with *.form or *.do Because part of the site needs to be password protected, these urls are all under /secure. There is a <security-constraint> in the web.xm...

Newlines and Spring's SimpleUrlHandlerMapping

I recently upgraded my app from Spring 2.5.6 to Spring 3.0.0. A few days later, I noticed that some of my pages were no longer functional. The problem appears to be my UserContent.do controller. UserContent.do is mapped using the SimpleUrlHandlerMapping mapping. It looks like this: <bean id="urlMapping" class="org.springframework.we...

Spring 2.5 MVC + controller is getting called twice for each request

Hi, Using Spring 2.5 MVC, Controller is getting called twice for each request. Is this a configuration issue. onclick of the button, javascript function will do some process & submit the form with post request generate method of the controller is getting called twice for no reason as i am submitting the form through javascript only o...

Creating a session scoped bean in Google App Engine using Spring 2.5

Hi, I am trying to create a session bean in spring mvc. I am having the following error message when I run my google app engine server in my local box: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'siteController' defined in ServletContext resource [/WEB-INF/springapp-servlet.xml]: Cannot res...

Spring 3 pet clinic example uses ${owner.new}, in the JSTL EL where can I read about out about .new operator?

Spring 3 pet clinic example uses ${owner.new}, in the JSTL EL where can I find out more about where the .new comes from and what spec it is a part of? Ive seen empty and not empty operators/ reserved words but not .new until now in the Spring 3 pet clinic example.hers is the line im questioning: <h2><c:if test="${owner.new}">New </c:if...

Spring 3.0: Handler mapping issue

I am having a trouble mapping a specific URL request to one of the controllers in my project. the URL is : http://HOSTNAME/api/v1/profiles.json the war which is deployed is: api.war the error I get is the following: [PageNotFound] No mapping found for HTTP request with URI [/api/v1/profiles.json] in DispatcherServlet with n...

How to do Grouping using JPA annotation with mapping given field

I am using JPA Annotation mapping with the table given below, but having problem that i am doing mapping on same table but on diffrent field given ProductImpl.java @Entity @Table(name = "Product") public class ProductImpl extends SimpleTagGroup implements Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private lo...

MultiActionController no longer receiving requests?

I was attempting to make changes to my controller, and all of a sudden, I no longer seem to receive any requests (404 when attempting to hit the servlet mapped URLs). I'm sure I've broken my web.xml or app-servlet.xml, but I just don't see where. I can access index.jsp from tomcat (http://IP/app/index.jsp), but I can't get my servlet map...

Java Spring 3.0 MVC Annotation vs COC. Whats the preferred method in the Java community?

I am using Spring's MVC framework for an application I'm hosting on Google's App Engine. So far, my controllers are registered via the @Controller annotation; however, prior to getting into Spring, I evaluated ASP.net MVC 2 which requires no configuration and is based on convention. Is convention over configuration (COC) the current and ...

Which view will be resolved, code from spring's docs

So when you go to /appointments the get() action is called, so then would the view be get.jsp (assuming you are using .jsp, and assuming you are mapping action names to views)? And what about the getnewform? It seems to be returning an object? Is that basically passed into the view? @Controller @RequestMapping("/appointments") public...

Does Java Spring 3.0 MVC support annotation/attribute based client side validation like Asp.net MVC 2.0?

In Asp.Net MVC 2.0, at least in the beta, you could decoration your model classes with data annotation attributes and enable client side validation that leverages that criteria defined in your model data annotation attibutes. Is there anything similar for Java Spring MVC 3.0? Is it possible to inject a component into the response pipeli...

Code assist in (jsp /jstl) view for Spring MVC model objects in Eclipse

In Spring MVC when placing an object in the view model like so: public String getUser( Model model ) { //...fetch user... model.addAttribute( "user", user ); return "viewName"; } and accessing it's values in the JSP / JSTL view like this: ... <p> ${user.name} </p> ... I'm wondering if it is possible to have code ass...

Does Spring MVC form submit data bind children objects automagically?

I have a data model that is something like this: public class Report { // report owner private User user; ... typical getter setter ... } public class User { ... omitted for clarity } What happens is when a report is created, the current user is set to the report user object. When the report is edited, the spring controlle...

Spring validation errors not displayed

I have the following situation. I have a validator to validate my command object and set the errors on a Errors object to be displayed in my form. The validator is invoked as expected and works okay, but the errors i set on the Errors objects are not displayed, when i am sent back to my form because of the validation errors. Validator:...

Using ControllerClassNameHandlerMapping with @Controller and extending AbstractController

Hey there, actually I thought I was trying something really simple. ControllerClassNameHandlerMapping sounded great to produce a small spring webapp using a very lean configuration. Just annotate the Controller with @Controller, have it extend AbstractController and the configuration shouldn't need more than this <context:component-s...