[英]Check if a checkbox is checked from JPS file
boolean flag_outlook ;
String stringoutlook = request.getParameter("Send_outlook");
if (stringoutlook != null)
flag_outlook = true;
else
flag_outlook = false;
String dataStartAppoiment = connect.timeFormatForDatabase(dayformat,Integer.parseInt( timefromedit));
String dataEndAppoiment = connect.timeFormatForDatabase(dayformat, Integer.parseInt(timefromedit)+1);
if(flag_outlook=true)
{
Apppoiment send = new Apppoiment();
send.Appoiment(dataStartAppoiment, dataEndAppoiment,ContentCell);
}
Checkbox from JSP look like this 来自JSP的复选框如下所示
<input type="checkbox" name="Send_outlook" >
I try to execut a piece of code, if a checkbox is checked (up is my code) but is not working properly, every time my flag is true. 每当我的标志为true时,如果选中一个复选框(是我的代码),但无法正常工作,我会尝试执行一段代码。 I can't understand where is my mistake
我不明白我的错误在哪里
The reason your flag is always true
is because in your if-statement
you say: 您的标志始终为
true
原因是,在您的if-statement
您说:
if(flag_outlook = true)
That should be: 应该是:
if(flag outlook == true)
Your problem is you're assigning in stead of comparing. 您的问题是您要分配而不是进行比较。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.