lundi 6 septembre 2021

store state of a checkbox (selected or not) in a boolean variable in a java application

I have a website, that has a checkbox that I want to use in the backend in order to decide which kind of database search I want to make. Ergo I need the state of the checkbox and assign it to a variable in my java code.

@RequestMapping("/delisted")
public void methodName(@RequestParam("name")boolean checkboxValue) {
    setterMethodInBackendUtilsClass(checkboxValue);
}

So my thought process was, that I was calling a setter method, that sets the variable, which is a member of my utils class. I don't know if this is good practice or anything. If not I'm more than happy to get input. Thanks in advance :)




Aucun commentaire:

Enregistrer un commentaire