Hi all i am doin a small web app using Sprin and Ibatis. I am facing a weird problems.
1) when i query a page.. ie say hello.jsp. It goes through the Controller But the ModelAndView("hello.jsp") is having a problem. Like its giving a http404 error. dont know what the problem is..
2) This is with respect to the Ibatis. I have an interface and the implementation. I would like to have the complete table data to be visualised . I was wondering like how to add the entire data to the Pojos. Please let me know.
Here is the code of the first problem
web.xml
===================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!--
- Location of the Log4J config file, for initialization and refresh checks.
- Applied by Log4jConfigListener.
-->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
<
servlet>
<servlet-name>f1App</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>f1App</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--
<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/lib/spring.tld</taglib-location>
</taglib>
-->
</web-app>
=============================================================================
my f1-servlet.xml
=============================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!-- Application context defn for "f1 app" DespatcherServlet. -->
<beans>
<bean id="RaceListController" class="com.blahblah.f1.controller.RaceListController"/>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/RacesGeneralList.jsp">RaceListController</prop>
</props>
</property>
</bean>
<!-- View Resolver -->
<bean id="viewReslover" 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/jsp/</value></property>
<property name="suffix"><value>.jsp</value></property>
</bean>
</beans>
===========================================================================
I dont think there is any problem with the above two files. I have posted just for your reference.
my controller
===================================================================================
package com.blahblah.f1.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import org.apache.log4j.Logger;
public class RaceListController implements Controller
{
Logger log=Logger.getLogger(RaceListController.class);
/**
* instance of the Request Controller.
*/
private
String page;
public RaceListController()
{}
/**
* handles the Request.
*/
public ModelAndView handleRequest(HttpServletRequest httpServletRequest,HttpServletResponse httpServlet)
{
// I am able to see this message in the console.
System.out.println("<<<<<<<<<<<<<<<<<<<<<<in the Controller.>>>>>>>>>>>>>>>>>>>>>>>");
return new ModelAndView("RacesGeneralList");
}
}
=========================================================================
Please let me know the soln at the earliest. i am using
tomcat 5.5, jdk6, spring framework 2.1m2, eclipse 3.2 with lomboz.
Thank you