xml « MVC « Spring Q&A





1. Can anyone explain servlet mapping?    stackoverflow.com

I'm trying to write a web application using SpringMVC. Normally I'd just map some made-up file extension to Spring's front controller and live happily, but this time I'm going for REST-like ...

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

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 ...

3. Spring configuration file gives BeanDefinitionStoreException    stackoverflow.com

I am trying to complete the Spring MVC tutorial at: http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html My problem is similar to this one http://stackoverflow.com/questions/266601/spring-configuration-error However none of those solutions seem relevant. I am getting the following ...

4. purpose of webAppRootKey?    stackoverflow.com

Can somebody explain this entry in web.xml ? When it has to be used and why ?

<context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>webapp.root</param-value>
</context-param>
Is this something related to Spring or ...

5. Using Spring, mapping to root in web.xml, static resources aren't found    stackoverflow.com

What I'm trying to do is map requests to the servlet root (correct terminology?). I'm at the point where URLs are mapped to correct view but all the static content ...

6. Loading external xsd and dtd render my application long start up time    stackoverflow.com

I'm developing a webapp using tiles and spring mvc. With the use of xsd and dtd validation on the definition of tiles and bean declaration of spring mvc, each time the ...

7. How to import a resource when using Castle Windsor    stackoverflow.com

I'd like to hold my components in a separate xml file for production, development etc etc. Can this be done with Castle Windsor? When using spring.net, i can use

<springDestinations>
   ...

8. Store Business Rules in XML Document, Validate afterwards in Java, how?    stackoverflow.com

Example XML Rules document:

<user>
  <username>
     <not-null/>
     <capitals value="false"/>
     <max-length value="15"/>
  </username>
  <email>
     ...

9. Spring annotation with xml mixing problem    stackoverflow.com

I'm trying to find an optimal way to use the latest Spring 3.0. I really like the @RequestMapping annotation with all features applied to it. However, what I don't like, is ...





10. How To Change Default Media Type for Spring MVC From XML to JSON    stackoverflow.com

Title pretty much says it all. Right now it's using XML as the default in the responses from my controller but I want it to use JSON as the default when ...

11. Could annotation based and xml based configuration be used together in spring 2.5?    stackoverflow.com

I've been working on a project where controllers have been written extending Controller classes. Could I configure and use the POJO based Controllers as well (using @Controller) in the same application? Many ...

12. Spring MVC 3 servlet.xml .. what is the use of the initial lines?    stackoverflow.com

In Spring MVC 3, what is the purpose of defining these lines

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
in the <servletName>-servlet.xml file.

13. How to add JSON support with XML already working?    stackoverflow.com

How is JSON support added to dispatch-servlet.xml (XML is working without problems)?
Commented text was just fail attempt...

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:beans="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   ...

14. XML view with Spring MVC    stackoverflow.com

this is a really newbie question: How can I output XML with Spring MVC, version 3.0.3.RELEASE? I'm currently using Tiles2 with JSTL, and when I want to output PDF, i.e., I just create ...

15. how to make spring mvc to output xml response?    stackoverflow.com

Does it has built-in support or I have to do java objects to xml converting by myself? An example would be very helpful. Thanks!

16. @ResponseStatus and web.xml     stackoverflow.com

Here's what i have so far : controller :

public abstract class MyController {
   @ExceptionHandler(Exception.class)
   @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
   public void handleAllExceptions(Exception e) {
      // ...





17. ExceptionHandler returning JSON or XML not working in spring mvc 3    stackoverflow.com

code is like this:

   @Controller
    public class TestController {

        @RequestMapping(value = "/testerror", method = RequestMethod.GET)
    ...

18. XML file as JSP script    stackoverflow.com

I'd like to generate an XML file with a JSP script. The catch is that I want my JSP script to be a Spring-MVC view, and thereby inherit the view's objects. ...

19. Enabling Spring MVC annotations while maintaining pre-existing XML mappings    stackoverflow.com

I work on an application that was developed under Spring 2.5 using XML mappings. Recently, we upgraded our JARS to Spring 3.0 and also added in some component scanning in an ...

20. How to import xml file in servlet xml file in spring mvc    stackoverflow.com

i have separate xml file which has jdbc , mysql details. Now i don't know how include file in servlet xml. i tried this but didn't worked

<import resource="jdbc-context.xml">

21. Configuring a WebBindingInitializer in Spring XML    stackoverflow.com

Is there a way that I can configure a WebBindingInitializer for a bean in Spring XML? I can configure the binder easily using the @InitBinder command, and then settings whatever state ...

22. Is it possible to display "<" or ">" in generated XML source using XStreamMarshaller    stackoverflow.com

I have been trying to use XStreamMarshaller to generate XML output in my Java Spring project. The XML I am generating has CDATA values in the element text. I am manually ...

23. Spring 3 MVC: App with out of annotations but using XML instead    stackoverflow.com

I am trying to develop application with spring 3 MVC not using annotations. I have several reasons for it (I like central configuration place, I do not want to put HTTP-specific info ...

24. set content type for xml response in spring    stackoverflow.com

I have this method that returns an object which is then serialized. I'd like to set the content type of the response (e.g. as application/xml). How can I do this? I have found other ...

25. BeanPostProcessor not called    stackoverflow.com

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
       ...

26. Why the BeanPostProcessor is not applied to beans that have their scope defined by a ScopeMetadataResolver?    stackoverflow.com


I'm currently using a class implementing the ScopeMetadataResolver in order to set the scope of a specific type of beans to "prototype" (because i'm trying to change the ...

27. How does Spring wire a OncePerRequestFilter with its init-param values?    stackoverflow.com

I've got a simple OncePerRequestFilter with a couple of init-param entries defined in my web.xml, but I don't know how to access them from within the filter. getFilterConfig() returns ...

28. Transform one XML format to another XML format using XSL    stackoverflow.com

I have a code with XML output as

<?xml version="1.0" encoding="windows-1252" standalone="yes"?>
<products>
    <product>
        <name>abc</name>
        <id>1</id>
 ...

29. How to output pure xml from a portlet?    stackoverflow.com

We are trying to output pure xml from a 286 portlet running on Websphere Portal Server 6.1 using the Spring 3.0 mvc framework. We had the following at the top of the ...

30. nested exception is org.xml.sax.SAXParseException: element type beans must be declared    stackoverflow.com

My project was using annotation based spring-config.xml (context:component-scan) XML schema. no need to configure every controller just base-package path is enough . But i want to use normal <!DOCTYPE > here ...

31. What's wrong with the commons-fileupload dependency?    stackoverflow.com

I'm trying to use commons-fileupload module by including its dependency in pom.xml. Packaging has no problem, however, when starting the web-app, it causes the "NoClassDefFound" error:

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
Here's my pom.xml config:
<dependency>
  ...

32. @PathVariable and web.xml other than '/'?    stackoverflow.com

can anybody confirm, that the usage of @PathVariable only works properly, if you use

<url-pattern>/</url-pattern>
within your SpringMVC-Dispatcher-Servlet section in the web.xml file ? If I set a more concrete pattern
<url-pattern>/activation</url-pattern>
for my SpringMVC controller ...

33. problem with very first spring project    stackoverflow.com

I just switched from Striped to Spring but i'm having issues with my very first project, Basically i get the 404 from the server. Strange enough, i have followed one by one all ...

34. issues with xml in spring mvc 3    stackoverflow.com

See my following 4 simple examples, 2 works for xml, the other 2 does not.

//works for html, json, xml
     @RequestMapping(value = "/test", method = RequestMethod.GET)
  ...

35. Loading context in Spring using web.xml    stackoverflow.com

Is there a way that a context can be loaded using web.xml in a Spring MVC application?

36. Spring web.xml for tomcat 6.0    stackoverflow.com

I got the follwowing web.xml for my Spring application to deploy in Tomcat 6:

<?xml version="1.0" encoding="UTF-8"?>
 <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>  ...

37. In Spring MVC 3 how can you make Jackson to pretty-print JSON by xml configuraton?    stackoverflow.com

I have noticed someone did that by "re-write Spring's MappingJacksonHttpMessageConverter from scratch, and override its writeInternal implementation"( When using Spring MVC for REST, how do you enable Jackson to ...

38. Getting both xml and jsp view in spring    stackoverflow.com

I am working on an app which provides views for some service and acts as web service for others. In controller i have mapped '/' to a view and when the app ...

39. Spring MVC + JAXB: ServletException: Unable to locate object to be marshalled in model    stackoverflow.com

I have a web service which returns a list of objects of an enumerated type. The enum has been annotated with @XmlRootElement, as well as another wrapper type which contains ...

40. Spring Exception handlers - using both annotated and xml defined    stackoverflow.com

I've annotated one of my controllers with @ExceptionHandler, in hopes of handling the exceptions for that class within the following method. We also have a site-wide exception handler defined in XML (SimpleMappingExceptionResolver). The ...

41. What is the best way to load spring config xmls?    stackoverflow.com

I have to load 3 spring config xml files in myproj spring mvc app named myproj-controllers.xml, myproj-services.xml and myproj-dao.xml. I have two options to load them. Firstly Use import resources in myproj-servlet.xml

<import ...

42. How to override urlpattern in web.xml    stackoverflow.com

I am working on a Spring MVC project incorporating Tiles. Here is the current urlPattern in the web.xml. <servlet-mapping> <servlet-name>appServlet</servlet-name> ...

43. XML files needed to configure spring application    stackoverflow.com

i want to know the best practice of configuring spring xml configuration files 1- how many configuration files should i have ? 2- contents of each file. right now, i have 3 xml ...

44. Spring v3 no declaration can be found for element 'mvc:resources'    stackoverflow.com

Currently Running

Tomcat: v6 Spring Tools Suite: v2.7.2 Spring Framework: spring-webmvc-3.0.5

Servlet XML

 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
  ...

45. how can i exclude from DispatchServlet mapping a folder (resources folder)    stackoverflow.com

My web.xml is: http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> TestStruts2

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
    <param-name>
 ...

46. Spring XML tags exhaustive list    stackoverflow.com

I am working on writing some transformations for Spring and need the list of all the tags (just MVC for now), their properties and their heirarchy. I went through the documentation ...

47. Spring mvc web.xml error    stackoverflow.com

I'm trying to write a web application using Spring MVC. I have a configuration in the web.xml that maps some URLs that are in my code:

@Controller
@RequestMapping(value = "app")
public class AjaxHandler {
 ...

48. urlrewrite.xml doesn't seem to be working    stackoverflow.com

I've been working on a Spring Project. I want my URL written in localhost:8080/app/main/something instead of localhost:8080/app/main.htm?type=something. Or maybe something like localhost:8080/app/employee/input instead of localhost:8080/employee.htm?type=input, but so far the URL remains the ...

49. How do I return an XML file using Spring MVC?    stackoverflow.com

View resolver

<bean id="jspViewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/xml/"/>
    <property name="suffix" value=".xml"/>
</bean>
There are some xml files e.g. /WEB-INF/xml/hello.xml This is the controller
public class HelloController implements ...

50. Use property file's property in spring mvc configuration servlet xml    stackoverflow.com

I use following line of code to read config.properties file in my spring mvc configuration servlet xml file.

<context:property-placeholder location="file:///${config.properties}" />
config.properties contains a property say: propertyName = propertyValue I want to use this ...

51. How to load a xsd file that is stored in my /WEB-INF folder    stackoverflow.com

I want to load a xsd file that is stored in:

/WEB-INF/myxsd.xsd
I will be referencing this in my controller's action, not sure how to do that. Also, since I will be referencing this ...

52. Spring MVC putting values into XML Config file    stackoverflow.com

I am working a Spring MVC project and in my Service object I need some information like system password, id, url etc but I would like to put this into one ...

53. SpringMvc 3.0 (possibility to use XML instead of annotations!!!!????)    forum.springsource.org

Good evening everyone, I wonder if I can still use xml instead of annotations for mapping with Spring 3.0 Note: View the hierarchy of the Controller is deprecatad except (controller and ...

54.  not working for .js and .xml extensions    forum.springsource.org

not working for .js and .xml extensions I have configured my web app to serve static resources (css,js etc) from a resources folder in web content. SpringMVC_folderStruct.jpg In my spring-servlet ...

55. RFE? Create fixed ModelAndView in XML    forum.springsource.org

RFE? Create fixed ModelAndView in XML Sometimes it is useful to be able to create a fixed ModelAndView instance in a bean context, with populated model data - after all if ...

56. *-servlet.xml reference application.xml for SpringMVC    forum.springsource.org

You can use the "", but if you are referring to the applicationContext.xml; it should already be included by default.

57. Return XML, not ModelAndView    forum.springsource.org

Return XML, not ModelAndView Hello, I'm totally new to SPRING and I want to create an application with Netbeans and the integrated Tomcat Container. I will submit requests to Tomcat that ...

58. load xml file at start up of SpringMVC    forum.springsource.org

Hello, I need to load an xml file, e.g. questions.xml, when the SpringMVC web app starts up. I can do this by: - implementing ServletContextListener interface and then storing the XML ...

59. Problems displaying XML in JSP via Spring MVC, in IE & Firefox    forum.springsource.org

Problems displaying XML in JSP via Spring MVC, in IE & Firefox Hiya, all I have a need to display some XML in the browser, and am having some problems getting ...

60. xml_escape with FreeMarker in Spring MVC 2.5    forum.springsource.org

xml_escape with FreeMarker in Spring MVC 2.5 For some reason, XML escaping is no longer working for me in my FreeMarker + Spring MVC project. It was working fine with Spring ...

61. Class not found warnings in mvc-config.xml of Spring project created from dashboard    forum.springsource.org

Class not found warnings in mvc-config.xml of Spring project created from dashboard Just downloaded SpringSource Tool Suite 2.3 and trying to get started. So created a project via the link to ...

62. Marshalling problem - only one value in ModelAndView is printed to XML    forum.springsource.org

Marshalling problem - only one value in ModelAndView is printed to XML Hello guys! I am writing here a Spring MVC application. I am using Spring 3.0.0.RELEASE. It is going to ...

63. XML data exchange with Spring MVC 2.5    forum.springsource.org

Hi, I have a classic controller that does some processing and forwards to JSP to do the rendering. Now I want to modify that controller in order to use it in ...

64. Unknown Spring Beans Problem: mvc-config.xml#13: in mvc-basic from spring samples    forum.springsource.org

Unknown Spring Beans Problem: mvc-config.xml#13: in mvc-basic from spring samples 1. Downloaded mvc-basic from https://src.springframework.org/svn/spring-samples 2. Executed clean... command under project menu in STS/Eclipse 3. Got 1 error and 2 warnings ...

65. Simple XML Binding in Spring MVC    forum.springsource.org

Simple XML Binding in Spring MVC I am using ContentNegotiatingViewResolver in my spring config to setup json, xml, xls, and html (via jstl) outputs from a RESTful service using MVC. All ...