Beanutils. getproperty

Source: Internet
Author: User

1. Obtain attributes of a composite object

For example, the ticket object has the property lotterytype, but the lotterytype is the lotterytype object type, and the lotterytype has the property name and value.

You can use beanutils. getproperty (ticket, "lotterytype. Name"); to obtain the name of the lotterytype corresponding to the value.

2. format the date obtained by beanutils. getproperty.

Beanutils. getproperty () is an American date such as "Sun Nov 04 17:10:26 cst2007 ",

If you use the default locale to parse, an exception occurs. Therefore, you need to specify the format and language environment and then format it.

Simpledateformat format = new simpledateformat ("e Mmm dd hh: mm: ss z yyyy", locale. US );

Format. parse () to Java. util. date type

And then formatted as the date we want to format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.