• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1617
  • Last Modified:

resin2.1.x not support jstl???

hi,experts,i want use jstl in resin2.1.x,but it will show some error in my page.
test.jsp

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
<title></title>
</head>
 it's test
</table>
</body>
</html>

when i use resin 2.1.5,it will show some error:

500 Servlet Exception
java.lang.NoClassDefFoundError: javax/servlet/jsp/el/VariableResolver
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
      at java.lang.Class.getDeclaredMethods(Class.java:1131)
      at java.beans.Introspector$1.run(Introspector.java:1126)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1124)
      at java.beans.Introspector.getTargetMethodInfo(Introspector.java:989)
      at java.beans.Introspector.getBeanInfo(Introspector.java:370)
      at java.beans.Introspector.getBeanInfo(Introspector.java:144)
      at java.beans.Introspector.getBeanInfo(Introspector.java:205)
      at java.beans.Introspector.<init>(Introspector.java:351)
      at java.beans.Introspector.getBeanInfo(Introspector.java:144)
      at com.caucho.jsp.Taglib.fillTag(Taglib.java:429)
      at com.caucho.jsp.Taglib.fillTagLibraryInfo(Taglib.java:377)
      at com.caucho.jsp.Taglib.<init>(Taglib.java:185)
      at com.caucho.jsp.JspParser.processTaglib(JspParser.java:1779)
      at com.caucho.jsp.JspParser.parseTaglibDirective(JspParser.java:1764)
      at com.caucho.jsp.JspParser.parseDirective(JspParser.java:1435)
      at com.caucho.jsp.JspParser.parseScriptlet(JspParser.java:1293)
      at com.caucho.jsp.JspParser.parseNode(JspParser.java:540)
      at com.caucho.jsp.JspParser.parseJsp(JspParser.java:453)
      at com.caucho.jsp.JspParser.parse(JspParser.java:284)
      at com.caucho.jsp.JspParser.parse(JspParser.java:232)
      at com.caucho.jsp.JspManager.createPage(JspManager.java:175)
      at com.caucho.jsp.PageManager.getPage(PageManager.java:346)
      at com.caucho.jsp.PageManager.getPage(PageManager.java:201)
      at com.caucho.jsp.QServlet.getPage(QServlet.java:220)
      at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:129)
      at com.caucho.server.http.Invocation.service(Invocation.java:312)
      at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
      at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:221)
      at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163)
      at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
      at java.lang.Thread.run(Thread.java:534)


--------------------------------------------------------------------------------
Resin 2.1.5 (built Fri Oct 4 12:10:31 PDT 2002)

but when i use resin3.0.8 ,it will show  "it's test",not erorr!

resin2.1.X not support jstl???
0
hgbdelphi
Asked:
hgbdelphi
  • 3
  • 3
1 Solution
 
sompol_kiatkamolchaiCommented:
javax/servlet/jsp/el/VariableResolver

This is JSP2.0 library class. you need to download and set to classpath or put in WEB-INF/lib
0
 
sompol_kiatkamolchaiCommented:
You can get that library by download this and install to hard drive.
http://www.signal42.com/mirrors/apache/jakarta/tomcat-5/v5.0.27/bin/jakarta-tomcat-5.0.27.exe
The library located in

C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\jsp-api.jar

0
 
hgbdelphiAuthor Commented:
thanks to sompol_kiatkamolchai ,i copy jsp-api.jar in  G:\resin-2.1.9\lib
so it can work well,thanks very much.

Best Regard!
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
hgbdelphiAuthor Commented:
hi,sompol_kiatkamolchai
  i am sorry to interrput you,when i use resin2.1.9,and copy tomcat\common\lib|*.jar in resin2.1.9\lib,it can work ,but
<c:out value="${idCommunity.communityName}"/>
can work,but ${idCommunity.communityName} can not work,
and when i use myself taglib it will say:
/communitmedical/webapp/system/UserManage.jsp:4: `http://beltino.com/util/js'
has no matching taglib-uri.  The taglib uri must match a taglib-uri for
a taglib specified in the web.xml or implicitly in a taglib.tld in the
tag jar.

or some error like this

beltUtil.tld:6 unknown element `xsi:schemaLocation' in `taglib'

this is my taglib tld:

<?xml version="1.0" encoding="UTF-8" ?>

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
    version="2.0">
   
  <description>com.beltino.tags</description>
  <display-name>beltino tags</display-name>
  <tlib-version>1.1</tlib-version>
  <short-name>utiltag</short-name>
  <uri>http://beltino.com/util</uri>
 
  <tag>
    <description>javascript select</description>
    <name>jselect</name>
    <tag-class>com.beltino.tags.js.JsSelectTag</tag-class>
    <body-content>empty</body-content>
    <attribute>      
            <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <name>type</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
    <attribute>
        <name>name</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
     </attribute>
  </tag>


  <tag>
    <description>javascript msg</description>
    <name>jmsg</name>
    <tag-class>com.beltino.tags.js.JsMsgTag</tag-class>
    <body-content>empty</body-content>
    <attribute>      
            <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
  </tag>
 
  <tag>
    <description>javascript util</description>
    <name>jdate</name>
    <tag-class>com.beltino.tags.str.StrTag</tag-class>
    <body-content>tagdependent</body-content>
    <attribute>      
            <name>type</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
    </attribute>
  </tag>

</taglib>


and this is my taglib class like this:

/*
 * Created on 2004-8-4
 *  
 */
package com.beltino.tags.js;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;

public class JsSelectTag extends SimpleTagSupport {
    private String type;
    private String name;
    private String value;
    JspWriter out = null;
    /**
     * @return Returns the name.
     */
    public String getName() {
        return name;
    }
    /**
     * @param name
     *            The name to set.
     */
    public void setName(String name) {
        this.name = name;
    }
    /**
     * @return Returns the type.
     */
    public String getType() {
        return type;
    }
    /**
     * @param type
     *            The type to set.
     */
    public void setType(String type) {
        this.type = type;
    }
    /**
     * @return Returns the value.
     */
    public String getValue() {
        return value;
    }
    /**
     * @param value
     *            The value to set.
     */
    public void setValue(String value) {
        this.value = value;
    }
    public void doTag() throws JspException, IOException {
        out = getJspContext().getOut();
    /**
     * &#36873;&#20013;&#26694;&#30340;&#20195;&#30721;
     */    
        if ("select".equals(type)) {
            getSelectBoxItem();
        } else if ("check".equals(type)) {
            getCheckBoxItem();
        } else if ("radio".equals(type)) {
            getRadioBoxItem();
        }
             
    }
    /**
     * &#36873;&#20013;select&#26694;&#20013;&#30340;&#20540;
     *
     * @param objName
     *            select&#26694;&#30340;&#21517;&#23383;
     * @param value
     *            select&#26694;&#30340;&#20540;
     * @return
     */
    private void getSelectBoxItem() {
        String retStr = "";
        retStr = "<script language='JavaScript'>" + "\n";
        retStr = retStr + "      document.all." + name + ".value = '" + value + "'"
                + "\n";
        retStr = retStr + "</script>";
        try {
            out.println(retStr);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * &#36873;&#20013;radioBox&#26694;&#20013;&#30340;&#20540;
     *
     * @param objName
     *            radioBox&#26694;&#30340;&#21517;&#23383;
     * @param value
     *            radioBox&#26694;&#30340;&#20540;
     * @return
     */
    private void getRadioBoxItem() {
        String retStr = "";
        retStr = "<script language='JavaScript'>" + "\n";
        retStr = retStr + "var obj = document.all;" + "\n";
        retStr = retStr + "try {" + "\n";
        retStr = retStr + "      obj." + name + "[1].checked;" + "\n";
        retStr = retStr + "      for(i = 0; i < obj." + name + ".length; i++) {"
                + "\n";
        retStr = retStr + "            if(obj." + name + "[i].value == '" + value
                + "') {" + "\n";
        retStr = retStr + "                  obj." + name + "[i].checked = true;" + "\n";
        retStr = retStr + "            }" + "\n";
        retStr = retStr + "      }" + "\n";
        retStr = retStr + "}" + "\n";
        retStr = retStr + "catch(e) {" + "\n";
        retStr = retStr + "      obj." + name + ".checked = true;" + "\n";
        retStr = retStr + "}" + "\n";
        retStr = retStr + "</script>";
        try {
            out.println(retStr);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * &#36873;&#20013;CheckBox&#26694;&#20013;&#30340;&#20540;
     *
     * @param objName
     *            CheckBox&#26694;&#30340;&#21517;&#23383;
     * @param value
     *            CheckBox&#26694;&#30340;&#20540;
     * @return
     */
    private void getCheckBoxItem() {
        String retStr = "";
        value = "," + value + ",";
        retStr = "<script language='JavaScript'>" + "\n";
        retStr = retStr + "var obj = document.all;" + "\n";
        retStr = retStr + "try {" + "\n";
        retStr = retStr + "      obj." + name + "[1].checked;" + "\n";
        retStr = retStr + "      for(i = 0; i < obj." + name + ".length; i++) {"
                + "\n";
        retStr = retStr + "            if('" + value + "'.indexOf(',' + obj." + name
                + "[i].value + ',') > -1) {" + "\n";
        retStr = retStr + "                  obj." + name + "[i].checked = true;" + "\n";
        retStr = retStr + "            }" + "\n";
        retStr = retStr + "      }" + "\n";
        retStr = retStr + "}" + "\n";
        retStr = retStr + "catch(e) {" + "\n";
        retStr = retStr + "      if('" + value + "'.indexOf(',' + obj." + name
                + ".value + ',') > -1) {" + "\n";
        retStr = retStr + "            obj." + name + ".checked = true;" + "\n";
        retStr = retStr + "      }" + "\n";
        retStr = retStr + "}" + "\n";
        retStr = retStr + "</script>";
        try {
            out.println(retStr);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}



but when i use resin3.0.8 it can not error,and all is right,resin2.1.X not support jsp2.0????


thanks!
0
 
sompol_kiatkamolchaiCommented:
Yes resin 2.xxx support JSP 1.2 spec, resin 3.xx support JSP 2.0

refer to http://www.caucho.com/resin-2.1/index.xtp
0
 
hgbdelphiAuthor Commented:
thanks for your help!

happy!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now