Java: easiest way to populate bean with servlet options

without using any large web structure (just servlets), did you know that you are ready to use a small library that can populate my bean properties from http request parameters?

+3
source share
2 answers

You can take a look at Commons Beanutils, it has a whole bunch of methods for filling beans (including nested beans):

http://commons.apache.org/beanutils/

The method in particular that you want to see is populated in BeanUtilsBean:

public void populate(Object bean,
                     Map properties)

More details here:

http://commons.apache.org/beanutils/api/org/apache/commons/beanutils/BeanUtilsBean.html#populate%28java.lang.Object,%20java.util.Map%29

+5

- , , * - < jsp: setProperty name= "mybean" properties = "*" >

http://java.sun.com/products/jsp/tags/11/syntaxref11.fm13.html:

" , JSP ( ) Bean. Bean , HTML-. Bean getter setter"

+2

Source: https://habr.com/ru/post/1713683/


All Articles