samedi 4 avril 2015

My web.xml file



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://ift.tt/ra1lAU" xmlns="http://ift.tt/nSRXKP" xsi:schemaLocation="http://ift.tt/nSRXKP http://ift.tt/1eWqHMP" id="WebApp_ID" version="3.0">
<display-name>Go Scrapper</display-name>

<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>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<welcome-file-list>
<welcome-file>new.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

</web-app>


I only use any one of the following when i run the program, when i use new.jsp, i get a page, but when i use index.html i get an error 404, both are in the same directory, (i.e) under WebContent/.


I have entered both here for ur understanding


My dispatcher-servlet.xml



<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://ift.tt/GArMu6"
xmlns:context="http://ift.tt/GArMu7"
xmlns:xsi="http://ift.tt/ra1lAU"
xmlns:mvc="http://ift.tt/1bHqwjR"
xsi:schemaLocation="
http://ift.tt/GArMu6
http://ift.tt/1cnl1uo
http://ift.tt/GArMu7
http://ift.tt/1ldEMZY
http://ift.tt/1bHqwjR
http://ift.tt/1kF4x7W">

<context:component-scan base-package="com.go.controller" />
<mvc:annotation-driven />

<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".html" />
</bean>

<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/GoAnalyserDB" />
<property name="username" value="postgres" />
<property name="password" value="toor" />
</bean>

</beans>


hey guys, When the welcome file is a jsp then it loads the page, If i change it to a html, it hits me with a 404 error. I have checked with other codes. everything seems to be correct. I cant quite get what i have done wrong here.


Aucun commentaire:

Enregistrer un commentaire