开发环境 eclipse3.0+lomboz3.0.1 +jboss3.2.3
我要加入自定义的标签 tag我的jsp放在和index.jsp同一目录下就是web的根目录下
<%@ taglib uri="/myTag" prefix="myTag" %>
<%@ page contentType="text/html;charset=GB2312" %>
<html>
<head>
<title>一个简单的自定义标签</title>
</head>
<body>
下面是应用这个简单的自定义标签的结果:<br>
<myTag:helloTag/>
</body>
</html>我的HelloTag.java
package hnkj.hello;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;public class HelloTag extends TagSupport {
public HelloTag() {
}
public int doStartTag() throws JspTagException{
try{
JspWriter out=pageContext.getOut();
out.print("标签开始了。<font color=\"red\">hello!</font>");
}catch(Exception e) {
System.out.println(e);
}
return EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspTagException{
try {
JspWriter out=pageContext.getOut();
out.print("标签结束了。");
}
catch (Exception e) {
System.out.println(e);
}
return EVAL_PAGE;
}
}我的myTag.tld 放在WEB-INF下和web.xml同一目录<?xml version="1.0" encoding="ISO-8859-1"?>
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version><tag>
<!-- 标签库名称-->
<short-name>myTag</short-name>
<!-- 标签库URI-->
<uri>/myTag</uri>
<!-- 标签库中的标签-->
<!-- helloTag-->
<tag>
<!-- 标签名称-->
<name>HelloTag</name>
<!-- 标签对应的处理类-->
<tag-class>hnkj.hello.HelloTag</tag-class>
<!-- 标签体内容,没有标签体则设为empty-->
<body-content>empty</body-content>
</tag>
</taglib>我的web.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by Williams (501) --><!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<web-app> <jsp-config>
<taglib>
<taglib-uri>/myTag</taglib-uri>
<taglib-location>/WEB-INF/myTag.tld</taglib-location>
</taglib>
</jsp-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list> <error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
</web-app>
/////////////////////////////////////////////////////////////////////////////////////////////////////
主要的错误提示
15:38:21,439 INFO [EmbeddedTomcatService] undeploy, ctxPath=/kcgzglWeb, warUrl=file:/D:/jboss-3.2.3/server/default/tmp/deploy/tmp11094kcgzglWeb.war/
15:38:21,439 INFO [Engine] StandardHost[localhost]: Removing web application at context path /kcgzglWeb
15:38:21,479 ERROR [Engine] StandardHost[localhost]: ContainerBase.removeChild: stop:
LifecycleException: Container StandardContext[/kcgzglWeb] has not been started15:38:22,110 INFO [MainDeployer] Starting deployment of package: file:/D:/jboss-3.2.3/server/default/deploy/kcgzglWeb.war
15:38:23,121 INFO [EmbeddedTomcatService] deploy, ctxPath=/kcgzglWeb, warUrl=file:/D:/jboss-3.2.3/server/default/tmp/deploy/tmp11095kcgzglWeb.war/
15:38:23,992 ERROR [Digester] Parse Error at line 25 column 14: Element type "jsp-config" must be declared.
org.xml.sax.SAXParseException: Element type "jsp-config" must be declared.
15:38:24,003 ERROR [Digester] Parse Error at line 29 column 12: The content of element type "taglib" must match "(taglib-uri,taglib-location)".
org.xml.sax.SAXParseException: The content of element type "taglib" must match "(taglib-uri,taglib-location)".
15:38:24,033 ERROR [Digester] Parse Error at line 60 column 11: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".15:38:24,093 ERROR [Digester] Parse Fatal Error at line 2 column 6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.15:38:24,093 ERROR [Engine] SingleSignOnContextConfig[/kcgzglWeb] Exception processing TLD at resource path /WEB-INF/myTag.tld
javax.servlet.ServletException: Exception processing TLD at resource path /WEB-INF/myTag.tld15:38:24,093 ERROR [Engine] ----- Root Cause -----
org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
等等。麻烦各位给解决一下
解决方案 »
- jsp向JS中传值问题
- javamail的错误
- Eclipse开发JSP很多未解析错误??
- <jsp:setProperty name="birthBean" property="*" />是什么意思
- 在struts练习中,调试时页面数据正确,运行时页面数据不更新,怎么回事?
- web程序员应该看看这个问题
- 我都不要意思问--菜鸟发问
- 大家快来看看我该怎么改!!!马上就要用了!!!!
- [推荐]基于weblogic 的EJB 学习笔记。
- 请问谁知道jbuilder7.0的注册码?
- http://xxx/login.htm?_lang=ja_JP%3Autf8,请问这里为什么要加个%3Autf8啊?
- 我在提交用jsp+javabean做的注册页面时,出现对不起,你提交的参数有错误???请教高手!急!
<%@ taglib uri="/WEB-INFO/myTag.tld" prefix="myTag" % >
<%@ taglib uri="/WEB-INF/myTag.tld" prefix="myTag" % >
主要的错误提示:
16:25:40,211 ERROR [Engine] StandardHost[localhost]: ContainerBase.removeChild: stop:
LifecycleException: Container StandardContext[/kcgzglWeb] has not been started
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3658)16:25:41,443 INFO [MainDeployer] Starting deployment of package: file:/D:/jboss-3.2.3/server/default/deploy/kcgzglWeb.war
16:25:42,384 INFO [EmbeddedTomcatService] deploy, ctxPath=/kcgzglWeb, warUrl=file:/D:/jboss-3.2.3/server/default/tmp/deploy/tmp11096kcgzglWeb.war/
16:25:43,125 ERROR [Digester] Parse Error at line 25 column 14: Element type "jsp-config" must be declared.
org.xml.sax.SAXParseException: Element type "jsp-config" must be declared.16:25:43,125 ERROR [Digester] Parse Error at line 29 column 12: The content of element type "taglib" must match "(taglib-uri,taglib-location)".
org.xml.sax.SAXParseException: The content of element type "taglib" must match "(taglib-uri,taglib-location)".
16:25:43,165 ERROR [Digester] Parse Error at line 60 column 11: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".16:25:43,225 ERROR [Digester] Parse Fatal Error at line 2 column 6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.麻烦再给看看
<taglib-uri >/myTag </taglib-uri> <jsp-config >和 </jsp-config >去掉试试,中间的内容留下