我正在尝试从自定义jsp标记传递一个java变量(我在这里使用struts2来从java类中获取变量).这是我得到的错误.
javax.servlet.ServletException: /pages/editBidForm.jsp(51,8) According to TLD or attribute directive in tag file, attribute parentId does not accept any expressions
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
....
Run Code Online (Sandbox Code Playgroud)
这是我的jsp页面(部分)
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="/WEB-INF/taglib.tld" prefix="custom" %>
...
...
<table>
<tr>
<%
String bidformoid=null;
bidFormOid=request.getParameter("bidFormOid");
%>
<td> <custom:zorancustomtag parentType = "BIDFORM" parentId = "<%= pageContext.getAttribute("bidFormOid") %>" /></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我无法正确传递parentId参数.我能够正确传递parentType参数,因为它只涉及传递字符串
这是taglib文件.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag
Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>custom</shortname>
<tag>
<name>zorancustomtag</name>
<tagclass>com.zoran.action.CustomizedTag</tagclass>
<bodycontent>JSP</bodycontent> …Run Code Online (Sandbox Code Playgroud) 我有一个PostgreSQL表,其中我有一个inv_seq声明为的列serial.
我有一个Hibernate bean类来映射表.除此列外,所有其他列都已正确读取.这是Hibernate bean类中的声明:
....
....
@GeneratedValue(strategy=javax.persistence.GenerationType.AUTO)
@Column(name = "inv_seq")
public Integer getInvoiceSeq() {
return invoiceSeq;
}
public void setInvoiceSeq(Integer invoiceSeq) {
this.invoiceSeq = invoiceSeq;
}
....
....
Run Code Online (Sandbox Code Playgroud)
声明是否正确?
我能够看到数据库中列生成的序列号,但我无法在java类中访问它们.
请帮忙.