Stuct2 receiving Request Parameters

Source: Internet
Author: User

Receiving Request Parameters
1:
Http: // MAID: 8080/struct2341/test/helloworld. do? Id = 123
In this way, the action class will get the id name matching through the reflection mechanism; you can also use the form to submit
Public class HelloWorldAction {
Private Integer id;
Private String message;
Private Person person;


2: Composite Type

1. submit the form to the corresponding controller.


2. action has the get and set methods corresponding to person.
Import cn. itcast. bean. Person;
Public class HelloWorldAction {
Private Integer id;
Private String message;
Private Person person;

3. Define the Person class under the corresponding package
Package cn. itcast. bean;
Public class Person {
Private Integer id;
Public Integer getId () {return id ;}
Public void setId (Integer id) {this. id = id ;}
}

4. View id =$ {person. id}

Related Article

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.