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

  • SEARCH
  • Home
  • 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 7980559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:06:42+00:00 2026-06-04T10:06:42+00:00

I made a model from a controller and return to dispatcherservlet. It looks like

  • 0

I made a model from a controller and return to dispatcherservlet. It looks like there is no problem

in model since I double checked output by system.out.println. for viewname string, I double checked

an actual directory name which is “WEB-INF/views/hello.jsp”.

but I believe dispatcher servlet does not adapt model to a view since browser does not displayed

a model value which should be displayed. It would be easier to understand what I am going through

if I put my code here. so… here is my code.

web.xml

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/spring/appServlet/spring-servlet.xml
    </param-value>
</context-param>

spring-servlet.xml

<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd"
>
<context:annotation-config/>
<bean name="/hello" class="com.spring.toby.HelloController"/>
<bean id="HelloSpring" class="com.spring.toby.HelloSpring"></bean>  
</beans>

and controller java file

public class HelloController implements Controller{

@Autowired HelloSpring helloSpring;
public ModelAndView handleRequest(HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    // TODO Auto-generated method stub
    String name = request.getParameter("name");
    String msg = this.helloSpring.sayHello(name);
    System.out.println(msg);
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("msg", msg);
    return new ModelAndView("WEB-INF/views/hello.jsp", model);
}
}

and bean file

public class HelloSpring {
public String sayHello(String name){
    return "Hello " + name;
}
}

and jsp file

</head>
    <body>
    <div><h1>Testing</h1></div>
    ${message}
    </body>

can anybody tell me what am I doing wrong? thanks in advance.

  • 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-06-04T10:06:45+00:00Added an answer on June 4, 2026 at 10:06 am

    Its just a silly mistake.

    Please replace ${message} in your jsp with ${msg} and you will get the message printed in your jsp.

    Hope this helps you.

    Cheers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a data model, and now I've made a 2nd version. All
What is the best way to access my models and forms from a controller
I am building an application in Zend Framework. My model is made up of
Basically i'm trying to build a comment system. The user looks at a photo
I want to create a binding from one model to my User model on
i have a problem with the kohana pagination. i have made a method for
I am rendering out a partial view like so: <div id=cart> <%Html.RenderPartial(Cart, Model); %>
I'd like to get access to the current executing Controller so I can offload
Based on the answer from axtavt, this is almost certainly a naming problem between
I've created a simple webapp with user authentication. I've made two models: Users for

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.