Announcement Announcement Module
Collapse
No announcement yet.
new xml tags <beans:bean > etc - Im confused Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment

    Working...
    X