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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:10:47+00:00 2026-06-15T20:10:47+00:00

In this period I am studying the Sping MVC showcase example dowlodable form STS

  • 0

In this period I am studying the Sping MVC showcase example dowlodable form STS dashboard.

In the Request Data section is shown how to bind the parameter of an HTTP GET Request to the homonymous variables of a JavaBean.

In practice I have the following link:

 <a id="group" class="textLink" 
    href="<c:url value="/data/group?param1=foo&param2=bar&param3=baz" />">
       Group of query parameters
 </a>

This link generate a GET HTTP Request towards the “/data/group” URL. This request carries 3 parameter named param1, param2, param3.

This request is handled by the following method of my controller class:

@RequestMapping(value="group", method=RequestMethod.GET)
public @ResponseBody String withParamGroup(JavaBean bean) {
    return "Obtained parameter group " + bean;
}

The withParamGroup() method thake a JavaBean object that is only an object that contains 3 variables and getters/setters methods, something like this:

public class JavaBean {

    private String param1;
    private String param2;
    private String param3;

        // GETTER & SETTER method
}

So the param1 parameter in the HTTP Request is stored in the param1 variable of the JavaBean Object, and the same thing for param2 and param3.

Ok…I think that this is clear for me…but…who does this operation? Is it automatically made by Spring framework?

Why I have not to use something like @RequestParam annotation as I do when I bind a single HTTP Request parameter with a single variable in the controller method?

Another doubt is: the HTTP parameters names have to be the same of the JavaBean variables or simply the first parameter value is stored in the first variable of the JavaBean object?

Thanks

Andrea

  • 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-15T20:10:48+00:00Added an answer on June 15, 2026 at 8:10 pm

    Interestingly the Spring documentation appears to be somewhat short on details about this feature, but there are some points in the Spring MVC documentation which seems to indicate that Spring is responsible for applying this behavior during the request mapping process. There is a reference to this ability in a section in the documentation on using the @RequestParam attribute to bind request parameters to method parameters (located here):

    Type conversion is applied automatically if the target method parameter type is not String. See Section 16.3.3.14, “Method Parameters And Type Conversion”.

    If you then go to the section referenced, the documentation suggests that primitive object types are converted automatically by Spring (here):

    String-based values extracted from the request including request
    parameters, path variables, request headers, and cookie values may
    need to be converted to the target type of the method parameter or
    field (e.g., binding a request parameter to a field in an
    @ModelAttribute parameter) they’re bound to. If the target type is not
    String, Spring automatically converts to the appropriate type. All
    simple types such as int, long, Date, etc. are supported. You can
    further customize the conversion process through a WebDataBinder (see
    Section 16.3.3.15, “Customizing WebDataBinder initialization”) or by
    registering Formatters with the FormattingConversionService (see
    Section 6.6, “Spring 3 Field Formatting”).

    Unfortunately this does not seem to give an adequate explanation for why non-primitive object types are being converted, but perhaps the documentation is not current with the capabilities.

    To your final point on whether or not the attribute names must match the parameters – this is conjecture as I cannot find any documentation to support it, but I would guess based on the behavior your are experiencing with this “feature” that Spring will look to match the parameters to attributes by name rather than order of parameters on the request.

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

Sidebar

Related Questions

In this period I am studing the Spring MVC Showcase example dowlodable from the
In this period I am studing the Spring MVC showcase example (downloadable from STS
I inherited a horribly-designed table where data is stored like this: Period | Identifier
My IQueryable line is: // find all timesheets for this period - from db
It does not seem straighforward. I am trying this: @Override public int compare(Period o1,
I need to store a set of data structures that are defined by period
For example,the input parameters are 2011-01-01 and 2012-01-01, and I want to parse this
I tied to cause an object wait for a period. In this period, the
If PHP does cache a permanent redirect: For how long? Can this period be
I have several data series plotted on a chart. This is logged data spanning

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.