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 8849141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:34:27+00:00 2026-06-14T12:34:27+00:00

i am already starting using Spring framework and already i came across some kind

  • 0

i am already starting using Spring framework and already i came across some kind of stupid problem ( but in fact i can’t solve it) I have controller which looks like:

package org.springframework.rest;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class SomeController {

    @RequestMapping(value = "/", method = RequestMethod.GET)
    @ResponseBody
    public String returnHtmlPage() {

        return "page";

    }

}

where page is page.jsp:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>Home</title>
</head>
<body>
<h1>
    Hello world!  
</h1>

<P>  The time on the server is ${serverTime}. </P>
</body>
</html>

but insteed of HTML file i have only string “page” returned. How can i fix the problem?

  • 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-14T12:34:28+00:00Added an answer on June 14, 2026 at 12:34 pm

    your code would print out just “page” (because of @ResponseBody). It does not return web page for you. you can use “ModelAndView” instead of “String” as your method output. And set your jsp page name (=page) there. something like this:

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView returnHtmlPage(){
        ModelAndView model = new ModelAndView("page");
                    /* here you can put anything in 'model' object that you
                       want to use them in your page.jsp file */
        return model;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Already found this page with some helpful hints. Problem is I need to debug
I have searched, but nothing happens, I just starting using C#.NET and I a
I just starting as an Android app developer and I already have a problem
Just starting out with ASP.NET MVC and have come across a stumbling block already.
Already finished implementing the player. I want to implement the progress bar. But I
I already have my azure web role running in cloud using azure sdk 1.6.
I already make some search on the forum and on google about initializing and
I already know about Ghostscript front end viewers; but I was wondering how gs
I already asked this question but at that time I tought that the refresh
I watched some videos, demos of Roo and I kind of liked it. However

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.