2012-02-21 9 views
1

jspページでカスタムタグを使用しようとしていますが、これまでコンパイルエラーが発生しています。 カスタムjspタグ・コードとそれを使用しようとしているJSPページがあります。コンパイラがJava Beanに基づいてカスタムJSPタグを作成しようとしたときのエラー

address.tag

<%-- 
    Document : address 
    Created on : Feb 21, 2012, 1:47:19 PM 
    Author  : skiabox 
--%> 

<%@tag description="Address Input Field" pageEncoding="UTF-8"%> 
<jsp:useBean id="addressBean" scope="session" class="com.ensode.netbeansbook.AddressBean" /> 

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 

<%-- The list of normal or fragment attributes can be specified here: --%> 
<%@attribute name="addressType" required="true"%> 

<%-- any content can be specified here e.g.: --%> 
<table border="0"> 


     <tr> 
      <td>Line 1:&nbsp;</td> 
      <td> 
       <input type="text" size="20" name="${addressType}_line1" id="${addressType}_line1" value="${addressBean.line1}" /> 
      </td> 
     </tr> 

     <tr> 
      <td>Line 2:&nbsp;</td> 
      <td> 
       <input type="text" size="20" name="${addressType}_line2" id="${addressType}_line2" value="${addressBean.line2}" /> 
      </td> 
     </tr> 

     <tr> 
      <td>City:&nbsp;</td> 
      <td> 
       <input type="text" size="20" name="${addressType}_city" id="${addressType}_city" value="${addressBean.city}" /> 
      </td> 
     </tr> 

     <tr> 

      <td>State:&nbsp;</td> 
      <td> 
       <select name="${addressType}_state" id="${addressType}_state"> 

        <option value=""></option> 
        <option value="AL" 
         <c:if test="${addressBean.state == 'AL'}">selected</c:if> > 
         Alabama 
        </option> 
        <option value="AK" 
         <c:if test="${addressBean.state == 'AK'}">selected</c:if> > 
         Alaska 
        </option> 
        <option value="AZ" 
         <c:if test="${addressBean.state == 'AZ'}">selected</c:if> > 
         Arizona 
        </option> 
        <option value="AR" 
         <c:if test="${addressBean.state == 'AR'}">selected</c:if> > 
         Arkansas 
        </option> 
        <option value="CA" 
         <c:if test="${addressBean.state == 'CA'}">selected</c:if> > 
         California 
        </option> 

       </select> 
      </td> 
     </tr> 

     <tr> 
      <td>Zip:&nbsp;</td> 
      <td> 
       <input type="text" name="${addressType}_zip" id="${addressType}_zip" value="${addressBean.zip}" /> 
      </td> 
     </tr> 

</table> 

index6.jsp

<%-- 
    Document : index6 
    Created on : Feb 21, 2012, 3:25:43 PM 
    Author  : skiabox 
--%> 


<%@page contentType="text/html" pageEncoding="UTF-8"%> 
<!DOCTYPE html> 

<%@taglib prefix="ct" tagdir="/WEB-INF/tags/" %> 
<%@page import="com.ensode.netbeansbook.AddressBean" %> 

<% 
    AddressBean addressBean = new AddressBean(); 
    addressBean.setAddressType("home"); 
    addressBean.setLine1("123 Tennis Ct"); 
    addressBean.setCity("Phoenix"); 
    addressBean.setState("AZ"); 
    addressBean.setZip("85001"); 

    session.setAttribute("addressBean", addressBean); 
%> 
<html> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
     <title>JSP Page</title> 
    </head> 
    <body> 
     <form> 
      <ct:address addressType="home"/> 
      <table cellpadding="0" cellspacing="0" border="0"> 
       <tr> 
        <td style="width: 65px;"></td> 
        <td> 
         <input type="submit" value="Submit" /> 
        </td> 
       </tr> 
      </table> 
     </form> 
    </body> 
</html> 

AddressBean.java

/* 
* To change this template, choose Tools | Templates 
* and open the template in the editor. 
*/ 
package com.ensode.netbeansbook; 

/** 
* 
* @author skiabox 
*/ 
public class AddressBean { 

    private String addressType; 
    private String line1; 
    private String line2; 
    private String city; 
    private String state; 
    private String zip; 

    public String getAddressType() { 
     return addressType; 
    } 

    public void setAddressType(String addressType) { 
     this.addressType = addressType; 
    } 

    public String getCity() { 
     return city; 
    } 

    public void setCity(String city) { 
     this.city = city; 
    } 

    public String getLine1() { 
     return line1; 
    } 

    public void setLine1(String line1) { 
     this.line1 = line1; 
    } 

    public String getLine2() { 
     return line2; 
    } 

    public void setLine2(String line2) { 
     this.line2 = line2; 
    } 

    public String getState() { 
     return state; 
    } 

    public void setState(String state) { 
     this.state = state; 
    } 

    public String getZip() { 
     return zip; 
    } 

    public void setZip(String zip) { 
     this.zip = zip; 
    } 
} 

そして、ここではそれをコンパイルしようとするとNetBeansは私を与えることをエラーログですカスタムタグ:

org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP

PWC6197: An error occurred at line: 48 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:215: cannot access javax.servlet.jsp.jstl.core.ConditionalTagSupport class file for javax.servlet.jsp.jstl.core.ConditionalTagSupport not found

PWC6197: An error occurred at line: 48 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:216: cannot find symbol symbol : method setPageContext(javax.servlet.jsp.PageContext) location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 48 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:217: cannot find symbol symbol : method setParent() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 48 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:219: cannot find symbol symbol : method doStartTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:223: cannot find symbol symbol : method doAfterBody() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:228: cannot find symbol symbol : method doEndTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:229: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

PWC6199: Generated servlet error: string:///address_tag.java:232: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

PWC6197: An error occurred at line: 52 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:241: cannot find symbol symbol : method setPageContext(javax.servlet.jsp.PageContext) location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 52 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:242: cannot find symbol symbol : method setParent() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 52 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:244: cannot find symbol symbol : method doStartTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:248: cannot find symbol symbol : method doAfterBody() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:253: cannot find symbol symbol : method doEndTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:254: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

PWC6199: Generated servlet error: string:///address_tag.java:257: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

PWC6197: An error occurred at line: 56 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:266: cannot find symbol symbol : method setPageContext(javax.servlet.jsp.PageContext) location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 56 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:267: cannot find symbol symbol : method setParent() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 56 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:269: cannot find symbol symbol : method doStartTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:273: cannot find symbol symbol : method doAfterBody() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:278: cannot find symbol symbol : method doEndTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:279: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

PWC6199: Generated servlet error: string:///address_tag.java:282: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

PWC6197: An error occurred at line: 60 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:291: cannot find symbol symbol : method setPageContext(javax.servlet.jsp.PageContext) location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 60 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:292: cannot find symbol symbol : method setParent() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 60 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:294: cannot find symbol symbol : method doStartTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:298: cannot find symbol symbol : method doAfterBody() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:303: cannot find symbol symbol : method doEndTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:304: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

PWC6199: Generated servlet error: string:///address_tag.java:307: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

PWC6197: An error occurred at line: 64 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:316: cannot find symbol symbol : method setPageContext(javax.servlet.jsp.PageContext) location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 64 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:317: cannot find symbol symbol : method setParent() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6197: An error occurred at line: 64 in the jsp file: /WEB-INF/tags/address.tag PWC6199: Generated servlet error: string:///address_tag.java:319: cannot find symbol symbol : method doStartTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:323: cannot find symbol symbol : method doAfterBody() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:328: cannot find symbol symbol : method doEndTag() location: class org.apache.taglibs.standard.tag.rt.core.IfTag

PWC6199: Generated servlet error: string:///address_tag.java:329: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

PWC6199: Generated servlet error: string:///address_tag.java:332: reuse(javax.servlet.jsp.tagext.Tag) in org.apache.jasper.runtime.TagHandlerPool cannot be applied to (org.apache.taglibs.standard.tag.rt.core.IfTag)

/Users/skiabox/NetBeansProjects/simplewebapp2/nbproject/build-impl.xml:612: Java returned: 1 BUILD FAILED (total time: 2 seconds)

コードがaddressBean.stateにアクセスしようとしているときに最初のエラーが発生する これを修正する方法や何が間違っているのですか? ありがとうございます。

答えて

0

私はこの質問に答えるのが非常に遅い(3年以上)ことを知っています。私もこの問題を抱えていました。どうやら、ソリューションは "Clean and Build Project"であるか、SHIFT + F11を押してプロジェクトを再度実行することです。