Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6603525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:01:32+00:00 2026-05-25T19:01:32+00:00

i am new to Spring. I created a maven project in eclipse to test

  • 0

i am new to Spring. I created a maven project in eclipse to test Spring MVC by resembling the mvc-basic example from Spring example SVN repository. when i tried to retrieve model values in jsp, the jsp just displayed ${model attribute name}, not the model attribute value.

Do I miss anything making Spring failed to retrieve model value?

Below are the details:

code: controller:

@Controller
public class TestAction {

@RequestMapping(value="/test" , method=RequestMethod.GET)
public String returnHelloWorld(Model model)
{
    ObjectTest objectTest=new ObjectTest();
    objectTest.setName("heng");
    model.addAttribute(objectTest);
    return "/test/start";
}
 }

code JSP:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<!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>
     hello ${objectTest.name}  
</body>
</html>

When running it on the server (tomcat 6)
the page displayed like

hello ${objectTest.name}

but should be

hello heng

POM.XML file:

  <project xmlns="http://maven.apache.org/POM/4.0.0"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven- 4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>heng.spring</groupId>
   <artifactId>firststudy</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <packaging>war</packaging>

   <properties>
    <org.springframework.version>3.0.5.RELEASE</org.springframework.version>
    <org.slf4j.version>1.6.1</org.slf4j.version>
   </properties>

   <dependencies>

   <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${org.springframework.version}</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-expression</artifactId>
     <version>${org.springframework.version}</version>
    </dependency>

    <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context</artifactId>
       <version>${org.springframework.version}</version>
    </dependency>

   <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context-support</artifactId>
      <version>${org.springframework.version}</version>
   </dependency>

   <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-web</artifactId>
       <version>${org.springframework.version}</version>
   </dependency>

  <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-webmvc</artifactId>
       <version>${org.springframework.version}</version>
  </dependency>


  <dependency>
     <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
 </dependency>



  </dependencies>



</project>

here is the snapshot

enter image description here

Note:

I created a normal eclipse dynamic project and create the same controller , jsp and other component. and the jsp can retrieve the model value successfully.
here is the snapshot of the project and jars.

the difference is that this project has springframework.web.servlet jar
while the maven project has sprinng-webmvc jar

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:01:33+00:00Added an answer on May 25, 2026 at 7:01 pm

    the reason for the problem is EL is not enabled

    to enable EL, i changed the web.xml from

    <?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>
     ....
     </web-app>
    

    to

    <?xml version="1.0" encoding="UTF-8"?>
     <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    </web-app>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to spring mvc and spring projects. I've created new spring roo project.
Almost every new Java-web-project is using a modern MVC-framework such as Struts or Spring
For example, I have created a slew of 'test-my-service' Objects in my Spring config
I created a Maven project in Eclipse using the webapp artifact and put the
i've been working on a project in java+maven+spring+hibernate and i wanted to automatically assign
In Eclipse, if I create a new Spring application context XML document when I
I am new to Maven and Spring. I'm using Netbeans 7 as my IDE,
I'm new on spring and I want a spring singleton bean to be created
I'm new to Spring Security. How do I add an event listener which will
I'm pretty new to the Spring Framework, I've been playing around with it and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.