我也是通过春天创建了项目。之后我添加了一个表并创建了模型,控制器和视图。在视图show.jspx
中,当我运行它时,我在浏览器控制台中遇到错误"Empty string passed to getElementById()"
。
这是我的show.jspx
:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div class="mainbar" xmlns:spform="http://www.springframework.org/tags/form" xmlns:form="urn:jsptagdir:/WEB-INF/tags/form" xmlns:util="urn:jsptagdir:/WEB-INF/tags/util" xmlns:table="urn:jsptagdir:/WEB-INF/tags/form/fields" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:spring="http://www.springframework.org/tags" xmlns:field="urn:jsptagdir:/WEB-INF/tags/form/fields" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:page="urn:jsptagdir:/WEB-INF/tags/form" version="2.0">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<jsp:output omit-xml-declaration="yes"/>
<c:set var="canCreate" value="false" />
<c:set var="canUpdate" value="false" />
<c:set var="canDelete" value="false" />
<c:set var="canList" value="true" />
<c:if test="${not empty privilege and privilege eq 'ROLE_ADMIN'}">
<c:set var="canCreate" value="true" />
<c:set var="canDelete" value="true" />
<c:set var="canUpdate" value="true" />
</c:if>
<c:set var="tab" value="${param.tab}"/>
<page:tabs id="i_selectaccount_list">
<field:tabitem tabId="selectAccountDetails" isActive="${empty tab or tab eq 0}" id="t_selectaccount_selectaccounts_new_label">
<page:show_in_list id="ps_com_softtrends_mboutique_model_selectaccount" object="${selectaccounts}" path="/selectaccounts" z=""
create="${canCreate}" update="${canUpdate}" delete="${canDelete}" list="${canList}"
displayTitle="false">
<c:if test="${not empty privilege and privilege eq 'ROLE_ADMIN'}">
<field:display_in_table field="selectAccountName"
id="ps_com_softtrends_mboutique_model_selectaccount_selectaccountname"
object="${Selectaccount.selectAccountId}" z=""/>
</c:if>
<field:display_in_table field="selectAccountName"
id="ps_com_softtrends_mboutique_model_selectaccount_selectaccountid"
object="${selectaccount.selectAccountId}" z=""/>
</page:show_in_list>
</field:tabitem>
<spring:message code="label_com_softtrends_mboutique_model_selectaccount_selectaccountname" var=""/>
<util:panel id="" title="" openPane="false"/>
<div class="widget-content">
<table:table data="${existingselectaccount}" id="l_com_softtrends_mboutique_model_selectaccount" path="/selectaccounts/deleteSelectAccount/${selectAccountId}" typeIdFieldName="SelectAccountId"
create="false" update="true" delete="true" show="false"
addParamPage="tab" addParamValPage="0">
<table:column id="c_com_softtrends_mboutique_model_selectaccount_selectaccountname" property="selectaccount" maxLength="-1"/>
</table:table>
</div>
</page:tabs>
</div>
这是我的控制器显示方法:
@RequestMapping(value = "/{selectAccountId}", method = RequestMethod.GET)
public String show(@PathVariable("selectAccountId") Integer selectAccountId, Model uiModel) {
uiModel.addAttribute("selectaccount", Selectaccount.findSelectaccount(selectAccountId)/*.getSelectAccountName()*/);
uiModel.addAttribute("itemId", selectAccountId);
return "selectaccounts/show";
}
这是模型类方法:
public static long countSelectaccounts() {
return entityManager().createQuery("SELECT COUNT(o) FROM Selectaccount o", Long.class).getSingleResult();
}
答案 0 :(得分:1)
在行中:
<util:panel id="" title="" openPane="false"/>
填充空属性:id
和title
是必需的。