I want to get the hierarchical value that POSTs from the form as a parameter.

Asked 2 years ago, Updated 2 years ago, 126 views

Thank you for your help.

Environment
Eclipse 4.4
GAE/J 1.9.30
Servlet 2.5
Ser I am using ServletFileUpload

<form action="/test" method="post" enctype="multipart/form-data">
  <input type="text" name="name">
  <input type="text" name="age">
  <fieldset name="child">
    <input type="text" name="name">
    <input type="text" name="age">
  </fieldset>
  <input type="submit">
</form>

Servlet receives parameters when sending such forms

on Servlet
public class Parent{
    private String name;
    private age;
    private child;
}
public class Child {
   private String name;
   private age;
}

We have two data classes like this.

Therefore, the form name and age are used in the Parent field, and the name and age in the fieldset are used in
I would like to put it in the Child field and put it in the Parent Child.

Servlet extracts the request parameters in order and uses reflection to create Parent's
The setting is set in the field.
However, how do I set the request parameters in the Child field?

Unable to retrieve Child field from Parent & if possible, it has the same name attribute, so which one is child
I don't know if it's an input value with the name attribute.

I hope we can determine the name or age in the fieldset when we take out the parameters one by one.

Tiering is described as
name,age,child: {name,age}
This is because I would like to obtain an image similar to .
Also, it is not defined here, but it should be multipart because it also sends images.

Thank you for your cooperation.

java html http google-app-engine servlet

2022-09-30 17:01

1 Answers

As you can see from the actual data sent, grouping by fieldset elements is not reflected in the data structure.Modify the name attribute to be unique for each input element.


2022-09-30 17:01

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.