我有一个提交按钮,创建自 - 基本上当点击它时我想要一个组框出现在提交按钮所在的位置....任何建议?
我试图通过此次点击获得请求,但它对我没有帮助。 我认为逻辑与此类似:
<form>
<input type="checkbox" name="group" value="Yes" />Yes
<input type="checkbox" name="group" value="No" /> No
<input type="submit" value="submit" />
</form>
<%
String[] select = request.getParameterValues("group");
/* Add code creation here */
%>
您能想到的任何建议或示例?
非常感谢, Ú
答案 0 :(得分:2)
首先用单选按钮替换复选框。现在可以检查Yes
和No
。这毫无意义。
<form>
<input type="radio" name="group" value="Yes" /> Yes
<input type="radio" name="group" value="No" /> No
<input type="submit" value="submit" />
</form>
然后,使用JSTL <c:if>
标记根据EL中的参数和/或其他范围变量有条件地显示内容。
<c:if test="${param.group == 'Yes'}">
<p>Write here HTML code which you'd like to show when 'Yes' is chosen.</p>
</c:if>
<c:if test="${param.group == 'No'}">
<p>Write here HTML code which you'd like to show when 'No' is chosen.</p>
</c:if>