By default, jsp selects radio based on parameters.

Source: Internet
Author: User

Today, we will select radio by default based on the parameter. After finding the data in js for a long time on the Internet and then calling it after loading the page, the result will not work for more than one hour-The js function is not called. Then I changed my mind and determined the checked value of each radio directly based on the parameter in the Servlet. Finally, we can select radio by default. It is difficult to judge the value of each radio based on the parameter. Finally, a usable and simple method is found. The Code is as follows: <% int vol = (Integer) request. getAttribute ("cardtype"); %> <input type = "radio" value = "5" id = "5" <% = vol = 5? "Checked": "" %> name = "appendAmount3"> <input type = "radio" value = "10" id = "10" <% = vol = 10? "Checked": "" %> name = "appendAmount3"> This eliminates the need to use js functions.

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.