Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8219291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:06:17+00:00 2026-06-07T13:06:17+00:00

I feel like a complete idiot, for the last 5 hours at work I’m

  • 0

I feel like a complete idiot, for the last 5 hours at work I’m trying to figure out Spring and how to do this.

I have a form inside “checklist.jsp” and I want to take the data that the user puts into the form. I will use that data later, but I just want to capture it now…

I have checklist.jsp which has a controller called “ChecklistController.java”.
Here is my form in checklist.jsp

<form method="POST" action="checklist.jsp">
    <table>
    <tr>
        <td>FQDN:</td>
        <td colspan="2"><input type='text' id="FQDN" /></td>
        <td><input type="radio" id="rdoScript" /></td>
        <td>Script 1 </td>
        <td><input type="radio" id="rdoScript" /></td>
        <td>Script 2</td>
    </tr>
    </table>
    <input type="submit" value="Run" id="selectionSubmit" />
 </form>

Please note: I was using tags but I changed it so I could actually see the page. I’ve been playing with it back and forth.

This is my ChecklistController.java

@Controller
// handling methods are relative to this controller
public class ChecklistController {
    private ChecklistService service;
    private static final Log LOG = LogFactory.getLog(ChecklistController.class);

    @RequestMapping("/checklist")
    public ModelAndView checklist() throws Exception{
        ModelAndView mavChecklist = new ModelAndView("checklist");
        mavChecklist.addObject("test",service.simpleTest());
        mavChecklist.addObject("date",service.getDateTime());
        return mavChecklist;
    }


    @Autowired
    public void setService(ChecklistService service){
        this.service = service;
    }
}

My idea was to get the data into a bean, so I made this class. UserSel.java

public class UserSel implements java.io.Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private String script;
    private String FQDN;

    public UserSel(){
    }

    public String getFQDN() {
        return FQDN;
    }

    public void setFQDN(String fqdn) {
        FQDN = fqdn;
    }

    public String getScript() {
        return script;
    }

    public void setScript(String script) {
        this.script = script;
    }
}

I hope I provided enough information.
I want to take the FQDN and the Script selection and be able to use those selections from the user (to run remote scripts).

Please let me know if additional information is required — I’m frustrated with Spring at the moment 🙁

EDIT:
Adding current ChecklistController.java

@Controller
// handling methods are relative to this controller
public class ChecklistController {
private ChecklistService service;
private static final Log LOG = LogFactory.getLog(ChecklistController.class);


@RequestMapping("/checklist")
public ModelAndView checklist(@ModelAttribute(value="UserSel")UserSel userSel) throws Exception{
    ModelAndView mav = viewRender();
    String FQDN = userSel.getFQDN();
    String getScript = userSel.getScript();
    mav.addObject("FQDN", FQDN);
    mav.addObject("script",getScript);
    return mav; 
}

@RequestMapping("/newchecklist")
public ModelAndView viewRender() {
    ModelAndView mav=new ModelAndView();
    mav.addObject("UserSel ", new UserSel ());
    mav.setViewName("checklist");
    return mav;
}

@Autowired
public void setService(ChecklistService service){
    this.service = service;
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:06:19+00:00Added an answer on June 7, 2026 at 1:06 pm

    1) add spring’s form tld. and rewrite your form like this

    <form:form commandName="UserInfo" method="POST" action="/web/checklist">
      <tr>
            <td>FQDN:</td>
            <td colspan="2"><input path="FQDN" /></td>
            <td><form:radiobutton path="script" value="1"/></td>
            <td><form:radiobutton path="script" value="2"/></td>
        </tr>
        <input type="submit" value="Save Changes" />
    </form:form>
    

    2.Modify you controller to get the submited values.

    @Controller
    // handling methods are relative to this controller
    public class ChecklistController {
        private ChecklistService service;
        private static final Log LOG = LogFactory.getLog(ChecklistController.class);
    
        //Called when you submit data and access it like this.
        @RequestMapping("/checklist")
        public ModelAndView checklist(@ModelAttribute(value="UserSel")UserSel userSel) throws Exception{
    
            //userSel.get..... you will get submited values like this here. Use your service class here. And return appropriate ModelAndView
    
            return mavChecklist;
        }
    
        //Call this method first to get blank jsp. This will bind your dataclass to jsp, in which you will get data once you submit.
         @RequestMapping("/newcheklist")
        public ModelAndView viewRender() {
            ModelAndView mav=new ModelAndView();
            mav.addObject("UserSel ", new UserSel ());
            mav.setViewName("checklist");
            return mav;
        }
        @Autowired
        public void setService(ChecklistService service){
            this.service = service;
        }
    }
    

    As you didn’t provide more code like context files, i need to take certain assumptions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so I feel like a complete idiot asking this, but I've been looking
I feel like I'm missing something obvious, but I can't work out why my
Feel like this should be something easy that I'm missing. I have a table
I feel like this must have been asked, but I'm unable to find it
I feel like a complete tool for posting this, it is so basic and
I feel like this question must have been asked before but I must not
I feel like I am not writing this correctly and this is my first
I feel like such a noob asking this but, for some reason a horizontal
I feel like I've only ever seen this here on SO, but I can't
I feel like there's a pretty simple way to do this, but I'm not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.