请教一个spring:bind的问题
这是JSP页面
<%@ include file= "/WEB-INF/jsp/include.jsp " %>
<%@ taglib prefix= "spring " uri= "/spring " %>
<html>
<head> <title> <fmt:message key= "title "/> </title> </head>
<body>
<h1> <fmt:message key= "postbookmark.heading "/> </h1>
<form method= "post " action= "postbookmark.htm ">
<spring:bind path= "bookmarkCommand.url ">
<input type= "text " name= "url " value= "${status.value} " />
<c:if test= "${status.error} "> <p> There was an error with your previous input. </p> </c:if>
</spring:bind>
<spring:bind path= "bookmarkCommand.name ">
<input type= "text " name= "name " value= "${status.value} " />
<c:if test= "${status.error} "> <p> There was an error with your previous input. </p> </c:if>
</spring:bind>
<spring:bind path= "bookmarkCommand.owner ">
<input type= "text " name= "owner " value= "${status.value} " />
<c:if test= "${status.error} "> <p> There was an error with your previous input. </p> </c:if>
</spring:bind>
<spring:hasBindErrors name= "bookmarkCommand ">
<p> There were ${errors.errorCount} error(s) in total: </p>
<ul>
<c:forEach var= "errMsgObj " items= "${errors.allErrors} ">
<li>
<spring:message code= "${errMsgObj.code} " text= "${errMsgObj.defaultMessage} "/>
</li>
</c:forEach>
</ul>
</spring:hasBindErrors>
<input type= "submit " value= "Update " />
</form>
<a href= " <c:url value= "bookmark.htm "/> "> Bookmark </a>
</body>
</html>
这是我sevlet.xml的相关配置
<bean id= "postBookmarkValidator " class= "src.java.fun.PostBookmarkValidator "/>
<bean id= "postBookmarkController " class= "src.java.web.PostBookmarkController ">
<property name= "sessionForm "> <value> true </value> </property>
<property name= "commandName "> <value> bookmarkCommand </value> </property>
<property name= "commandClass "> <value> src.java.fun.Bookmark </value> </property>
<property name= "validator "> <ref bean= "postBookmarkValidator "/> </property>
<property name= "formView "> <value> postbookmark </value> </property>
<property name= "successView "> <value> bookmark.htm </value> </property>
<property name= "bookmarkManager ">
<ref bean= "bookMan "/>
</property>
</bean>
这个是我的class
package src.java.fun;
import java.io.Serializable;
public class Bookmark implements Serializable {
private long id;
private String url;
private String name;
private String owner;
private void setId(long i) {
id = i;
}
public long getId() {
return id;
}
public void setUrl(String s) {
url = s;
}
public String getUrl() {
return url;
}
public void setName(String s) {
name = s;
}
public String getName() {
return name;
}
public void setOwner(String s) {
owner = s;
}
public String getOwner() {
return owner;
}
}
这个是我的controller
public class PostBookmarkController extends SimpleFormController {
/** Logger for this class and subclasses */
protected final Log logger = LogFactory.getLog(getClass());
private BookmarkManager bookmarkManager;
public ModelAndView onSubmit(Object command)
throws ServletException {
Bookmark bookmark = (Bookmark) command;
logger.info( "New bookmark is added ");
bookmarkManager.addBookmark(bookmark);
String now = (new java.util.Date()).toString();
logger.info( "returning from postbookmark view to bookmark.htm ");
return new ModelAndView(new RedirectView(getSuccessView()));
}
protected Object formBackingObject(HttpServletRequest request) throws ServletException {
Bookmark bookmark = new Bookmark();
bookmark.setUrl( "http:// ");
bookmark.setName( "Website ");
bookmark.setOwner( "Huisan ");
return bookmark;
}
public void setBookmarkManager(BookmarkManager bm) {
bookmarkManager = bm;
}
public BookmarkManager getBookmarkManager() {
return bookmarkManager;
}
}
访问 postbookmark.jsp的时候提示错误
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /WEB-INF/jsp/postbookmark.jsp
Generated servlet error:
/usr/jakarta-tomcat-5.0.28/work/Catalina/localhost/bookmark/org/apache/jsp/WEB_002dINF/jsp/postbookmark_jsp.java:101: 找不到符号
符号: 类 BindStatus
位置: 软件包 org.springframework.web.servlet.tags
org.springframework.web.servlet.tags.BindStatus status = null;
^
所有带 <spring:bind > 的行都提示这个错误
请教大家
我的spring.tld是1.0.2版 spring是1.2.6 tomcat 5.0.28
如果还需要其他信息继续提供
会不会是spring.tld 和 spring版本问题?
[解决办法]
我们的高手,先驱啊,相当有价值的经验!
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html