Unable to test GET POST display interaction

Asked 2 months ago, Updated 2 months ago, 3 views

I'm a beginner in Java.

I set get post to the controller, but the console does not display the results.
How do I display the ID and PASSWORD entered in the form on the console?

@RequestMapping(value="/profile/save", method=RequestMethod.GET)
    public String S161 formList (Model model) {

        model.addAttribute("S100601formList", new S161formList());
        return "S161.html";

    @RequestMapping(value="/profile/save", method=RequestMethod.POST)
    public String form (@ModelAttribute161formList161formList1,Model model1) {

        return "S161.html";

    public class S161 formList {

    private intid; 
    private int password;

Each setter getter
<formth:action="@{/profile/save}" method="post"th:object="${161formList}">
<table class="table table-border table-condensed">
        <col style="width:15%">
        <col style="width:30%">
        <col style="width:15%">
        <col style="width:30%">
            <th>Login ID<span class="">&nbsp;*</span></th>
            <td><input type="text" class="input-sm" value="name="id" required></td>;
            <th>Password </th>
            <td><input type="password"class="name="password"></td> 

java spring-boot

2022-09-30 11:08

1 Answers

The essential issue is

model.addAttribute("S100601formList", new S161formList());

You should be aware of this because you set the attribute name to S100601formList in .

The following sections are official references:

If you search @ModelAttribute, you will find many sites that are explained in Japanese.

One modified example would be like this.

2022-09-30 11:08

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.