2010-04-14 105 views
1

我试图用jcaptcha-1.0来介绍一个struts 1.3.8应用程序;我加入了JCaptcha的罐子应用lib和添加jcaptcha与struts集成

<%@ taglib uri="jcaptcha" prefix="jcaptcha"%> 

到我的形式

应用无法找到文件,所以我增加了以下的web.xml文件

<taglib-uri>jcaptcha</taglib-uri> 
<taglib-location>/WEB-INF/lib/jcaptcha-1.0-all.jar</taglib-location> 
</taglib> 

现在我得到空指针异常:

org.apache.jasper.JasperException: Unable to read TLD "META-INF/taglib.tld" from JAR file 

任何线索?欢迎使用支持struts的其他验证码的建议。

感谢

回答

2

尝试<%@ taglib uri="http://jcaptcha.sourceforge.net" prefix="jcaptcha" %>

如果失败,请尝试<%@ taglib uri="/WEB-INF/jcaptcha.tld" prefix="jcaptcha"%>以及与此内容创建jcaptcha.tld文件中WEB-INF

<?xml version="1.0" encoding="ISO-8859-1" ?> 
<!-- 
    ~ JCaptcha, the open source java framework for captcha definition and integration 
    ~ Copyright (c) 2007 jcaptcha.net. All Rights Reserved. 
    ~ See the LICENSE.txt file distributed with this package. 
    --> 

<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, 
Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> 

<taglib> 
    <tlibversion>1.0</tlibversion> 
    <jspversion>1.1</jspversion> 
    <shortname>jcaptcha-struts-taglib</shortname> 
    <uri>http://jcaptcha.sourceforge.net</uri> 
    <info>JCAPTCHA Taglib for the base module</info> 

    <tag> 
     <name>question</name> 
     <tagclass>com.octo.captcha.module.struts.taglib.QuestionTag</tagclass> 
     <bodycontent>empty</bodycontent> 
     <info>Display the jcaptcha question for this session</info> 
    </tag> 
    <tag> 
     <name>message</name> 
     <tagclass>com.octo.captcha.module.taglib.MessageTag</tagclass> 
     <bodycontent>empty</bodycontent> 
     <info>Display the jcaptcha failure message for this session</info> 
    </tag> 
</taglib>