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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:44:06+00:00 2026-06-13T19:44:06+00:00

I am developing a Java web project and not applying Spring MVC, Spring web-flow

  • 0

I am developing a Java web project and not applying Spring MVC, Spring web-flow to it (because it is quite simple). I have a small problem when attaching value from HTTP request to Java object. Is there any standalone library or utility support us to bind data from client request to a server object automatically (matched by property name) without using Spring? Assume that parameters in client request had already built to a map.
When I work with Grails (a web framework for Groovy), it has a very awesome way to fill data in request parameter to object by using: object.properties=parameters, but I do not know that in Java, do we have a similar mechanism to implement it?
Thank you so much.

  • 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-13T19:44:08+00:00Added an answer on June 13, 2026 at 7:44 pm

    Apache Commons might help with BeanUtilsBean. It has cool methods like getProperty() and setProperty(), which might help if you wanna try to code it by hand using reflection. There’s also the populate(Object bean, Map properties) method, which, i believe, is the closest to what you want.

    Dozer is a java library specialized in mapping stuff from one structure to other. It might help.

    This guy posted a similar question on coderanch and, after some discussion, he came up with the following:

    public static <T extends Object> T setFromMap(Class<T> beanClazz, HashMap<String, String> propValues) throws Exception  
    {  
        T bean = (T) beanClazz.newInstance();  
        Object obj = new Object();  
        PropertyDescriptor[] pdescriptors = null;  
        BeanInfo beanInfo = Introspector.getBeanInfo(beanClazz);  
        pdescriptors = beanInfo.getPropertyDescriptors();  
        for(int i=0; i<pdescriptors.length; i++)  
        {  
            String descriptorName = pdescriptors[i].getName();  
            if(!(descriptorName.equals("class")))  
            {  
                String propName = descriptorName;  
                String value = (String) propValues.get(propName);  
                if(value != null)  
                {  
                    Object[] objArray = new Object[1];  
                    objArray[0] = value;  
                    Method writeMethod = pdescriptors[i].getWriteMethod();  
                    writeMethod.invoke(bean, objArray);  
                }  
            }  
        }
        return bean;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I using MVC for developing a web project in Java. My problem is that
I am developing a Java Web application with Spring MVC and I am having
I'm developing one web application project using java for education industry.In this Admin have
I have a Java web application I’m developing for a school project. There’s a
I am developing a Java Web Application using JSF, Spring and Hibernate. I need
The last months I have tried to get started with web developing using Java.
I am developing a dynamic web project j2ee web application using eclipse. I have
I am developing an application in Spring Web MVC where i need to execute
I am developing a Java Application (not a web app, no server etc) using
I have a project this year. It is about developing a Java application with

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.