Configuration for url-pattern in web.xml in Spring web application -
in spring app, have follow web.xml file:
<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0"> <display-name>horariolivre2</display-name> <welcome-file-list> <welcome-file>acesso/login.html</welcome-file> </welcome-file-list> <servlet> <servlet-name>horariolivre2</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>horariolivre2</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> </web-app> my problem is: despite way page being found correctly, if change url-pattern '/', can't reach page (neither login page - first 1 project). try several combinations welcome-file, acesso/login, acesso/login/, /acesso/login, /acesso/login/ etc).
my spring-servlet.xml file is:
<?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" 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 http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <context:component-scan base-package="com.horariolivre"/> <bean id="viewresolver" class="org.springframework.web.servlet.view.urlbasedviewresolver"> <property name="viewclass" value="org.springframework.web.servlet.view.jstlview" /> <property name="prefix" value="/web-inf/jsp/" /> <property name="suffix" value=".jsp" /> </bean> <context:annotation-config> <bean class="com.horariolivre.resources.hibernateconfig"> </bean> </context:annotation-config> <tx:annotation-driven transaction-manager="transactionmanager"/> </beans> and 1 of controller is:
@controller @requestmapping(value="acesso") public class primarycontroller { @autowired private sessaohome sessao; @autowired private usuariohome usuario; @requestmapping(value="login") public modelandview login() { modelandview mav = new modelandview(); mav.setviewname("acesso/login"); return mav; } (...) } someone know right path should use url-pattern '/'?
you can give url-pattern * or /*
Comments
Post a Comment