Results 1 to 2 of 2

Thread: new xml tags <beans:bean > etc - Im confused

  1. #1

    Default new xml tags <beans:bean > etc - Im confused

    Hi ,

    I generated a Spring MVC web app from STS.

    I see that the xml files use a whole bunch of new tags i.e. <beans:bean .. etc


    Do I have to use these? can I mix with old ones ? whats the advantages? I just got the latest Spring in Action and theres no mention of these new xml namespaces

    see below

    hope you can help
    thanks




    <?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"
    xsi:schemaLocation="
    http://www.springframework.org/schema/mvc http://www.springframework.org/schem...ng-mvc-3.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->

    <!-- Enables the Spring MVC @Controller programming model -->
    <annotation-driven />

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
    <resources mapping="/resources/**" location="/resources/" />

    <!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
    <beans:bean class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
    <beansroperty name="prefix" value="/WEB-INF/views/" />
    <beansroperty name="suffix" value=".jsp" />
    </beans:bean>

    <!-- Imports user-defined @Controller beans that process client requests -->
    <beans:import resource="controllers.xml" />

    </beans:beans>

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    I suggest a read on xml namespaces... There are no new namespace which namespace is the root depends on how you configure your xml and xml namespace. For your xml the mvc namespace is the root, thus for all other namespaces you have to prefix them including the beans one.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •