wood burning stoves
The moose likes Other Application Frameworks and the fly likes Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Spring" Watch "Spring" New topic


kate pal

Joined: Sep 25, 2008
Posts: 9
Hello All ,

I am trying very basic spring application
below is the xml files

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<bean name="/home.htm" class="com.test.controller.testController">
<property name="greeting">
<value>Welcome to Spring Training!</value>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<property name="suffix">

this is training-servlet.xml

and below is web.xml
<?xml version="1.0" encoding="UTF-8"?>
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"






package com.test.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class testController implements Controller{

public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
return new ModelAndView("home", "message", greeting);
private String greeting;
public void setGreeting(String greeting) {
this.greeting = greeting;

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<% out.println(" ==> home" ); %>

I kept all neccessary .jar in my classpath

when I deploy this application I got
HTTP Status 404 - /springMvc/home.htm


type Status report

message /springMvc/home.htm

description The requested resource (/springMvc/home.htm) is not available.


Apache Tomcat/5.5.26
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1323

Have you looked at any of the Tomcat logs to see what, if anything, is going wrong? and what is the directory structure of your web app and where, exactly is it located on your machine?
and also check into your tomcat manager to check the status of your application.
[ October 11, 2008: Message edited by: Muhammad Saifuddin ]

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Try the servlet mapping in your web.xml. Maybe it just needs a "/" in from of the URL mapping. That is where I always make my mistakes.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link: http://aspose.com/file-tools
subject: Spring
jQuery in Action, 3rd edition