JSP自定义关闭窗体标签显示错误点
问题描述:
请帮我看一下:我们使用的是JSP自定义窗体标签,我们发现关闭标签总是显示在错误的位置,这对我们造成很多问题:因为下面的动态生成html元素不会嵌套在...内,提交表单后,这些元素数据将丢失。 下面是一些示例代码:JSP自定义关闭窗体标签显示错误点
<ct:table>
<ct:form name="form1" >
<ct:addFromRequest prefix="<%= AP.CSA_PREFIX %>" />
<ct:add name="<%= AP.ACTION %>" value=" " />
<tr>
.....some dynamically generated code here
</tr>
</ct:form>
</ct:table>
在IE浏览器,它按预期工作:
<table>
<form name="form1" >
<tr>
...
</tr>
</form>
</table>
但在Firefox和Chrome,它总是表现出像:
<table>
<form name="form1" ></form> *******the closing </form> tag appears here
<tr>
... dynamically generated html controls here
</tr>
</table>
为什么这种情况发生?请帮忙给支票,谢谢!
答
整个页面的代码是在这里:
<%
CCtFormValidation ct_form = new CCtFormValidation(jsp_input);
CCtHelperFunctions ct_helper = new CCtHelperFunctions(jsp_input);
%>
<%@ include file="../../generic_gui/template/general_head.jsp" %>
<ct:script>
function CheckForm (form_to_check)
{
if (form_to_check.<%=AP.MANAGE_GROUP%>[0].checked
&& form_to_check.<%=AP.GROUP_ID%>.selectedIndex < 1)
{
<%= ct_form.printErrorJavascriptAlert (CFrontEndErrorCodes.FRONTEND_ERROR_CODE_MISSING_MANDATORY_PARAMS) %>
form_to_check.<%=AP.GROUP_ID%>.focus();
return false;
}
return true;
}
function BeforeSubmit(form_to_submit)
{
form_to_submit.<%=AP.ACTION%>.value = "<%=AP.ACTION_SUBMIT%>";
}
function BeforeCancel(form_to_cancel)
{
form_to_cancel.<%=AP.ACTION%>.value = "<%=AP.ACTION_CANCEL%>";
}
function OnLoad()
{
}
</ct:script>
<%@ include file="../../generic_gui/template/general_body_start.jsp" %>
<ct:table width="75%">
<tr>
<td>
<ct:form name="form1">
<ct:addFromRequest prefix="<%= AP.CSA_PREFIX %>" />
<ct:add name="<%= AP.ACTION %>" value=" " />
<span class="PageHeader">
<%= rc.getStr ("s_page_title") %>
</span>
</td>
</tr>
<tr>
<td colspan="3"><br><br></td>
</tr>
<tr>
<td colspan="3">
<span class="BodyText">
<%= rc.getStr ("s_text_1") %>
</span>
</td>
</tr>
<tr>
<td colspan="3"><br></td>
</tr>
<tr>
<td colspan="2">
<input type="radio" name="<%=AP.MANAGE_GROUP%>" value="<%=AP.MODIFY_GROUP%>" checked>
<span class="BodyText">
<%= rc.getStr("s_modify_group_text")%>
</span>
</td>
<td>
<span class="BodyText">
<select id="<%=AP.GROUP_ID%>" name="<%=AP.GROUP_ID%>" size="1" class="textBoxNoSize" onFocus="document.form1.<%=AP.MANAGE_GROUP%>[0].checked=true;">
<OPTION value="<%=rc.getStr("s_select_group")%>"><%=rc.getStr("s_select_group")%></OPTION>
<%
CCSAGroupDetails current_group;
for (int counter = 0 ; counter < group_list.size() ; ++counter)
{
current_group = (CCSAGroupDetails) group_list.get (counter);
%>
<OPTION value="<%=current_group.getGroupId()%>"><%=current_group.getGroupName()%></OPTION>
<% } %>
</select>
</span>
</td>
</tr>
<tr>
<td colspan="3">
<input type="radio" name="<%=AP.MANAGE_GROUP%>" value = "<%=AP.CREATE_GROUP%>">
<span class="BodyText">
<%= rc.getStr("s_create_group_text")%>
</span>
</td>
</tr>
<tr>
<td colspan="3">
<br>
</td>
</tr>
<tr height="50" valign="bottom">
<td align="center">
<ct:button param="button_next" javascript="SubmitForm(document.form1);"/></td>
<td></td>
<td align="center">
<ct:button param="button_cancel" javascript="CancelForm(document.form1);"/></td>
</tr>
</ct:form>
</ct:table>
<%@ include file="../../generic_gui/template/general_body_end.jsp" %>
<%@ include file="../../generic_gui/template/general_footer.jsp" %>
呈现在IE浏览器右标签启动和关闭......,然而,FF和Chrome页面呈现为页面....
代码的任何问题?
你的自定义标签是做什么的?像大多数其他人一样,您在IE的页面上是否有任何例外?你可以显示整个页面,而不仅仅是一个剪辑。至少在标题中,我们可以看到标签与什么关联。 – 2014-08-28 05:07:10