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
<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. I can't understand where is my mistake
The reason your flag is always true
is because in your if-statement
you say:
if(flag_outlook = true)
That should be:
if(flag outlook == true)
Your problem is you're assigning in stead of comparing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.