Hi, I am trying to run a simple webpage with the code:
But when I run it using tomcat 6 server...I get the following error:Code:<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <center> <h3>Login page</h3> <br/> <form:form commandName="login" method="POST" name="login"> Username:<form:input path="username"/> <font color="red"><form:errors path="username"/></font><br/><br/> Password:<form:password path="password"/> <font color="red"><form:errors path="password"/></font><br/><br/> <input type="submit" value="Login"/> </form:form> </center> </body> </html>
There is even no content in front of "message" and "HTTP Status 404 -". What can be the reason. This is something related to tomcat configuration but I am not able to get it. Please help me...HTTP Status 404 -
--------------------------------------------------------------------------------
type Status report
message
description The requested resource () is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.18
This is my web.xml:
And this is my spring config file:Code:<?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_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>EnR Application</display-name> <welcome-file-list> <welcome-file>/login.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>enrapp-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>enrapp-dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/enrapp-servlet.xml</param-value> </context-param> <servlet-mapping> <servlet-name>enrapp</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <error-page> <exception-type>java.lang.Exception</exception-type> <location>/WEB-INF/pages/error.jsp</location> </error-page> <!-- Spring Security --> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class> org.springframework.web.filter.DelegatingFilterProxy </filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping> <session-config> <session-timeout>120</session-timeout> </session-config> </web-app>
Code:<?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" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <context:component-scan base-package="com.infosys.enr.question.controller" /> <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter"> <property name="showSql" value="true"/> <property name="generateDdl" value="true"/> <property name="databasePlatform" value="oracle.toplink.essentials.platform.database.MySQL4Platform"/> </bean> </property> <property name="loadTimeWeaver"> <bean class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/> </property> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/enrapplication"/> <property name="username" value="root"/> <property name="password" value="root123"/> </bean> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <!-- Data Validation --> <property name="validator"> <bean id="questionValidator" class="com.infosys.enr.question.validator.QuestionValidator" /> </property> <bean id="MCQSingleAns" class="com.infosys.enr.question.domain.MCQSingleAnsDomain"> <property name="answerOption" value="0"></property> </bean> <bean id="userDomain" class="com.infosys.enr.user.domain.UserDomain" scope="session"> <aop:scoped-proxy /> </bean> <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <props> <prop key="com.infosys.enr.question.exception.QuestionException"> QuestionException </prop> <prop key="java.lang.Exception">Error</prop> </props> </property> </bean> <!-- view resolver --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" > <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property> <property name="prefix"> <value>/WEB-INF/pages/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource" basename="/WEB-INF/messages"/> </beans>


Reply With Quote