Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html JSP使用数据库影响checbox变量_Html_Oracle_Jsp - Fatal编程技术网

Html JSP使用数据库影响checbox变量

Html JSP使用数据库影响checbox变量,html,oracle,jsp,Html,Oracle,Jsp,所以我试图从数据库中获取要显示的值。目前,我可以得到任何文本值,但我不能让复选框工作,我不明白为什么。使用以下代码 <td>Street: <input type="text" name="Address1" value="<% out.print(MyProperties.getString(3)); %>" disabled="true"></td> <td>No. of Bedrooms: <input type="text

所以我试图从数据库中获取要显示的值。目前,我可以得到任何文本值,但我不能让复选框工作,我不明白为什么。使用以下代码

<td>Street: <input type="text" name="Address1" value="<% out.print(MyProperties.getString(3)); %>" disabled="true"></td>
<td>No. of Bedrooms: <input type="text" name="Bedrooms" value="<% out.print(MyProperties.getString(9)); %>" disabled="true"></td>
<td>Garden: <input type="checkbox" name="Garden" disabled="true" <% if(MyProperties.getString(10) == "1"){ out.print("checked='checked'");} %>></td>
确实有效

请记住,我的两个表都在while循环中

<% while (MyProperties.next()){ %> TABLE <% } %>
表格
试试这段代码

<%=MyProperties.getInt(10) == 1?"checked":""%>


希望这有帮助

添加了“MyProperties.”(并将getInt中的数字从9改为10,正如我最初所说的那样),它可以工作。现在我需要知道。。。为什么?你的代码与我的代码有什么不同?你没有选中复选框。对于jsp,您的值没有任何意义,除非它是“选中”字符串。很明显,您的值为1,这就是为什么它不选中复选框的原因
<%=MyProperties.getInt(10) == 1?"checked":""%>