简体   繁体   English

是否可以避免使用 JSTL 提交空表单?

[英]Is it possible to avoid submitting empty forms with JSTL?

I have a form with a bunch of radio buttons, and a submit button.我有一个带有一堆单选按钮和一个提交按钮的表单。 When a radio button is selected, I'm passing a query string to the servlet for further processing.选择单选按钮时,我将查询字符串传递给servlet以进行进一步处理。 But when none is selected and the Submit button is pressed, I get an exception, obviously.但是当没有选择并按下提交按钮时,显然我会得到一个例外。 Is there anyway to avoid this?有没有办法避免这种情况? As in, avoid submitting empty forms using JSTL?如,避免使用 JSTL 提交空表单?

You can disable the submit button until a selection is made.您可以禁用提交按钮,直到做出选择。 Try using JavaScript or Jquery尝试使用 JavaScript 或 Jquery

see JQuery Onselect?看到JQuery Onselect?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM