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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:58:33+00:00 2026-06-14T15:58:33+00:00

I have some doubts regarding how does @RequestMapping and @RequestBody actually woks.I have a

  • 0

I have some doubts regarding how does @RequestMapping and @RequestBody actually woks.I have a code which is as follows:

@Controller
public class CoreController {
@Autowired
LoggerExtension log;
@Autowired
DoService doService;
    @RequestMapping(value="/method.do")
public @ResponseBody String getActionResponse(HttpServletRequest request,HttpServletResponse response){         
    String action = request.getParameter("action");     
    String gender = request.getParameter("gender");
    String language = request.getParameter("language");
            if("getLanguage".equalsIgnoreCase(action)){
            returnResponse = doService.getUserLanguage(msisdn);
           }
     }
        return returnResponse;
       }

I want to know how does the above code works? Please help me to clear this concepts…

  • 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-14T15:58:35+00:00Added an answer on June 14, 2026 at 3:58 pm

    The Spring documentation explains it very well, for @RequestMapping

    You use the @RequestMapping annotation to map URLs such as
    /appointments onto an entire class or a particular handler method.

    In your specific case, @RequestMapping(value="/method.do") means that a http request (in any method) to the URI /method.do (e.g. http://myserver.com/app/method.do) will be handled by the annotated method getActionResponse(HttpServletRequest,HttpServletResponse) and Spring will bind the parameters automatically.

    As for @ResponseBody it says:

    This annotation can be put on a method and indicates that the return
    type should be written straight to the HTTP response body

    In your specific case, this means that the returned string of the method annotated will be written to the response output stream or the writter like if you were calling something like this:

    String result = getActionResponse(request, response)
    response.getWriter().print( result ); //Suppose result is "en_US" or something
    

    See ServletResponse#getWriter() or ServletResponse#getOutputStream()

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

Sidebar

Related Questions

I have some doubts regarding the following controller action (in ASP.NET MVC, but it's
I have some doubts regarding sitemap.xml generation and Django's sitemap framework particularly. Let's say
I have some doubts regarding In-Application-Billing in android: Can i test it with different
I have the following code: http://jsfiddle.net/fCWJ5/1/ , and following doubts regarding the viewbox. body{margin:0;}
I have some doubts regarding service hosting in WCF. I want to host a
i'm writing my first plugin for wordpress and i have some doubts regarding the
I have some doubts in the paypal integration in my website. Actually I have
I have some doubts regarding Strings Are they live on Heap or String pool?
I have some doubts regarding the software licensing model. Recently, while building a small
I am very new to the web development area. I have some doubts regarding

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.