Exception jsp custom tag in IBM AIX
Hello, this is the scenario.
WebLogic Server 5.1 sp6 on IB AIX
The WLS is standalone; there is a servlet that make a forward to a frameset with
three frame; each frame has a jsp which take data by an http session object.
The log of weblogic give the following message for each servlet class generated
by jsp:
Root cause of ServletException
javax.servlet.ServletException: runtime failure in custom tag 'getProperty' at......
The same application in NT works fine.
there is the execution of a different thread for each jsp in the frameset?
Could you help me?
Thanks and regards
Fabio
Please post the remainder of the stack trace.
Mike
"Fabio Rossi" <[email protected]> wrote:
>
>Hello, this is the scenario.
>WebLogic Server 5.1 sp6 on IB AIX
>The WLS is standalone; there is a servlet that make a forward to a frameset
>with
>three frame; each frame has a jsp which take data by an http session
>object.
>The log of weblogic give the following message for each servlet class
>generated
>by jsp:
>
>Root cause of ServletException
>javax.servlet.ServletException: runtime failure in custom tag 'getProperty'
>at......
>
>The same application in NT works fine.
>there is the execution of a different thread for each jsp in the frameset?
>
>Could you help me?
>
>Thanks and regards
>Fabio
Similar Messages
-
How to use JSP custom tag lib in PAR file?
Hi All,
I am trying to customize mastheaderpar file. For that I have downloaded relevant par file and making the changes accordingly.
As part of the changes I would require to use JSP custom tag library in my par file.
I have the TLD file and relevant classes in the jar file. I would like to know where and what kind of modifications have to be done to use the jsp custom tag library.
I tried modifying some things in portalapp.xml but was not successful.
Please help me on how to proceed with this? It would be great if you can provide the xml entry to use this tag library
Thanks
SanthoshHi Johny,
Thanks for the reply. Actually I am able to change colors etc. with out any problem.
My requirement is to use XMLTaglib in mastheader par file. This tag lib is from apache tomcat. I have the relevant TLD and class files. I copied TLD file into taglib dir of portal-inf and class file in src api.
And I have added the following line in portalapp.xml under component-profile section of default
<property name="tlxtag" value="/SERVICE/Newmastheader/taglib/taglibs-xtags.tld">
Is this the right way to use tag lib? Actually before adding this line I used to get the error saying "Error parsing taglib", but now the error does not occur and I am getting new error. This is an exception in one of the taglib classes.
Could any one provide me some inputs on how to check this error?
Thanks
Santhosh -
Can I write Design-time for JSP custom tag(not JSF components)
I have some old JSP custom tags(not JSF components), and I want to use them in the IDE through the toolbox.
Now I have already written the BeanInfos for these tags, and they can be drag from the toolbox; but it will throw a Exception when render the tags, and the properties in the Property Editor are not which I describe in the BeanInfos.
How can I write Design-time for these tags? or whether it is possible to write the Design-time for these tags?
the Exception is shown as follow:
java.lang.ClassCastException
at com.sun.rave.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1347)
[catch] at com.sun.rave.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1086)
at com.sun.rave.insync.faces.FacesPageUnit.getFacesRenderTree(FacesPageUnit.java:993)
at com.sun.rave.css2.FacesSupport.getFacesHtml(FacesSupport.java:152)
at com.sun.rave.css2.CssContainerBox.addNode(CssContainerBox.java:373)
at com.sun.rave.css2.CssContainerBox.createChildren(CssContainerBox.java:354)
at com.sun.rave.css2.DocumentBox.createChildren(DocumentBox.java:90)
at com.sun.rave.css2.DocumentBox.relayout(DocumentBox.java:160)
at com.sun.rave.css2.PageBox.layout(PageBox.java:392)
at com.sun.rave.css2.PageBox.relayout(PageBox.java:454)
at com.sun.rave.css2.DocumentBox.redoLayout(DocumentBox.java:313)
at com.sun.rave.css2.PageBox.redoLayout(PageBox.java:460)
at com.sun.rave.css2.DocumentBox.changed(DocumentBox.java:634)
at com.sun.rave.designer.DesignerPaneUI$UpdateHandler.changedUpdate(DesignerPaneUI.java:1012)
at com.sun.rave.text.Document.fireChangedUpdate(Document.java:851)
at com.sun.rave.text.Document$5.run(Document.java:631)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)I have some old JSP custom tags(not JSF components), and I want to use them in the IDE through the toolbox.
Now I have already written the BeanInfos for these tags, and they can be drag from the toolbox; but it will throw a Exception when render the tags, and the properties in the Property Editor are not which I describe in the BeanInfos.
How can I write Design-time for these tags? or whether it is possible to write the Design-time for these tags?
the Exception is shown as follow:
java.lang.ClassCastException
at com.sun.rave.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1347)
[catch] at com.sun.rave.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1086)
at com.sun.rave.insync.faces.FacesPageUnit.getFacesRenderTree(FacesPageUnit.java:993)
at com.sun.rave.css2.FacesSupport.getFacesHtml(FacesSupport.java:152)
at com.sun.rave.css2.CssContainerBox.addNode(CssContainerBox.java:373)
at com.sun.rave.css2.CssContainerBox.createChildren(CssContainerBox.java:354)
at com.sun.rave.css2.DocumentBox.createChildren(DocumentBox.java:90)
at com.sun.rave.css2.DocumentBox.relayout(DocumentBox.java:160)
at com.sun.rave.css2.PageBox.layout(PageBox.java:392)
at com.sun.rave.css2.PageBox.relayout(PageBox.java:454)
at com.sun.rave.css2.DocumentBox.redoLayout(DocumentBox.java:313)
at com.sun.rave.css2.PageBox.redoLayout(PageBox.java:460)
at com.sun.rave.css2.DocumentBox.changed(DocumentBox.java:634)
at com.sun.rave.designer.DesignerPaneUI$UpdateHandler.changedUpdate(DesignerPaneUI.java:1012)
at com.sun.rave.text.Document.fireChangedUpdate(Document.java:851)
at com.sun.rave.text.Document$5.run(Document.java:631)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) -
Error in JSP Custom Tag Program
Hi Dear,
when I compile my JSP Custom tag program on weblogic Its give that Error..
Parsing of JSP File '/Home.jsp' failed: /Home.jsp(-1): cannot load TLD: weblogic.xml.dom.ChildCountException: missing child tagclass in tag
probably occurred due to an error in /Home.jsp line -1:
Tue Sep 09 18:46:56 GMT 2008
My Files are:
Home.jsp:
<%@ taglib uri="/WEB-INF/tlds/taglib.tld" prefix="neeraj" %>
<neeraj:hello name="Vijay">
It is a Tag Body<br>
</neeraj:hello>
taglib.tld:
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<uri>WEB-INF/tlds/taglib.tld</uri>
<tag>
<name>hello</name>
<tag-class>mypack.MyTag</tag-class>
<attribute>
<name>name</name>
<required>true</required>
</attribute>
</tag>
</taglib>
MyTag.java:
package mypack;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class MyTag extends TagSupport
String name;
public void setName(String c)
try
name=c;
catch(Exception e)
count=1;
public int doStartTag()
return EVAL_BODY_INCLUDE;
public int doAfterBody
JspWriter out=pageContext.getOut();
out.print("Good Night "+name);
catch(Exception e)
return EVAL_PAGE;
web.xml:
<web-app>
<welcome-file-list>
<welcome-file>/Home.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>taglib</taglib-uri>
<taglib-location>/WEB-INF/tlds/taglib.tld</taglib-location>
</taglib>
</web-app>
Please resolve my issue..I had the same problem. In your .tld change tagclass to tag-class and bodycontent to body-content and that should do the trick. The names slightly changed for JSP spec 1.2.
-
Aggressive Caching of JSP Custom Tags?
I've just developed my first JSP Custom Tag. I compiled my class and it
worked fine. But subsequent changes to the class source and recompiles
don't affect the JSP output; evidently, these are aggressively cached, so
much so that 12 hours later it still won't change (I was hoping it would be
a 10 minute timeout or something like that.)
Is this the problem? If so, is there a weblogic.properties setting to tell
WL to check for modifications to the class file every so often?
David
Lets say i want to have some user defined exception messages.There
i will say in tag support or body tag support i will use JSPException
and throw my customised exception.
Can any one tell me any practical example.
If someone really have used it somewhere.
thanks
vijendra -
Hi, can anyone advise as to whether my tag library code (based
on Apache Jakarta Project) will actually achieve connection
pooling functionality across my entire JSP based application? I
am slightly concerned that my OracleConnectionCacheImpl object
may exist multiple times, hence rendering my conection pooling
attempt useless.
package com.solved.tag.dbtags.connection;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspTagException;
import javax.sql.DataSource;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import oracle.jdbc.pool.OracleConnectionCacheImpl;
* <p>JSP tag connection, used to get a
* java.sql.Connection object.</p>
* <p>JSP Tag Lib Descriptor
* <pre>
* <name>connection</name>
<tagclass>com.solved.tag.dbtags.connection.ConnectionTag</t
agclass>
* <bodycontent>JSP</bodycontent>
<teiclass>com.solved.tag.dbtags.connection.ConnectionTEI</t
eiclass>
* <info>Opens a connection based on a jndiName.</info>
* <attribute>
* <name>id</name>
* <required>true</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* </pre>
* @author Matt Shannon
public class ConnectionTag extends TagSupport {
static private OracleConnectionCacheImpl cache = null;
public int doStartTag() throws JspTagException {
try {
Connection conn = null;
if (cache == null) {
try {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup
("jdbc/pool/OracleCache");
cache = (OracleConnectionCacheImpl)ds;
catch (NamingException ne) {
throw new JspTagException(ne.toString());
conn = cache.getConnection();
pageContext.setAttribute(getId(),conn);
catch (SQLException e) {
throw new JspTagException(e.toString());
return EVAL_BODY_INCLUDE;
package com.solved.tag.dbtags.connection;
import java.sql.Connection;
import java.sql.SQLException;
import javax.servlet.jsp.tagext.TagSupport;
* <p>JSP tag closeconnection, used to close the
* specified java.sql.Connection.<p>
* <p>JSP Tag Lib Descriptor
* <pre>
* <name>closeConnection</name>
<tagclass>com.solved.tag.dbtags.connection.CloseConnectionTag&
lt;/tagclass>
* <bodycontent>empty</bodycontent>
* <info>Close the specified connection. The "conn"
attribute is the name of a
* connection object in the page context.</info>
* <attribute>
* <name>conn</name>
* <required>true</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* </pre>
* @author Matt Shannon
* @see ConnectionTag
public class CloseConnectionTag extends TagSupport {
private String _connId = null;
* The "conn" attribute is the name of a
* page context object containing a
* java.sql.Connection.
* @param connectionId
* attribute name of the java.sql.Connection to
close.
* @see ConnectionTag
public void setConn(String connectionId) {
_connId = connectionId;
public int doStartTag() {
try {
Connection conn = (Connection)pageContext.getAttribute
(_connId);
conn.close();
} catch (SQLException e) {
// failing to close a connection is not fatal
e.printStackTrace();
return EVAL_BODY_INCLUDE;
public void release() {
_connId = null;
package com.solved.tag.dbtags.connection;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
* TagExtraInfo for the connection tag. This
* TagExtraInfo specifies that the ConnectionTag
* assigns a java.sql.Connection object to the
* "id" attribute at the end tag.
* @author Matt Shannon
* @see ConnectionTag
public class ConnectionTEI extends TagExtraInfo {
public final VariableInfo[] getVariableInfo(TagData data)
return new VariableInfo[]
new VariableInfo(
data.getAttributeString("id"),
"java.sql.Connection",
true,
VariableInfo.AT_END
data-sources.xml:
<?xml version="1.0"?>
<!DOCTYPE data-sources PUBLIC "Orion data-
sources" "http://xmlns.oracle.com/ias/dtds/data-sources.dtd">
<data-sources>
<data-source
class="oracle.jdbc.pool.OracleConnectionCacheImpl"
name="jdbc/pool/OracleCache"
location="jdbc/pool/OracleCache"
url="jdbc:oracle:thin:@oracle1:1521:pdev"
>
<property name="maxLimit" value="15" />
<property name="cacheScheme" value="2" />
<property name="user" value="console" />
<property name="password" value="console" />
<description>
This DataSource is using an Oracle-native DataSource Class so as
to allow Oracle Specific extensions.
A getConnection() call on this DataSource will return
oracle.jdbc.driver.OracleConnection.
The connection returned is a logical connection.
The caching scheme in place is Fixed Wait. Refer below to
possible values.
Dynamic 1
Fixed Wait 2
Fixed Return Null 3
</description>
</data-source>
</data-sources>
many thanks,
Matt.Hi. Show me your pool definition.
Joe
Ramamurthy wrote:
I am using the jsp custom tag library from BEA called sqltags.tld which came with Weblogic 5.1. Currently I am using Weblogic6.1 sp2 on Solaris.
I have created a Connection Pool for Sybase database using the driver com.sybase.jdbc.SybDriver.
When I created jsp page to connect to the connection pool using sqltags custom tag library, I am getting the error
"javax.servlet.jsp.JspException: Failed to write body content
at weblogic.taglib.sql.ConnectionTag.doAfterBody(ConnectionTag.java:43)
at jsp_servlet.__hubwcdata._jspService(__sampletest.java:1014)"
After this message, whenever I try to access the same jsp page I am getting the message
"javax.servlet.jsp.JspException: Failed to load JDBC driver: weblogic.jdbc.pool.D
river
at weblogic.taglib.sql.ConnectionTag.doStartTag(ConnectionTag.java:34)
at jsp_servlet.__hubwcdata._jspService(__sampletest.java:205)".
Can you please help me the reason why this problem is happening and how to fix this ?
This problem doexn't happen consistently. This occurs once in a while.
I tried to increase Login delay Seconds parameter in the Connection Pool to 15 sec. It didn't help me much.
Thanks for your help !!!
Ram -
Data Streaming in JSP custom tag
We have a JSP custom tag which uses a StringBuffer object to store the HTML content. In the doEndTag method, we use the JSPWriter's print method to send the buffer's content to the browser.
Now, there are cases when the HTML content becomes very large,in the order of 1 - 10MB. In such cases, is there a way we can start streaming the data from the custom tag as the buffer is being built, rather than waiting for the entire buffer to be written out in the doEndTag.Yeah, just call the JSPWriter's print method instead of using the StringBuffer, or write your own subclass of StringBuffer (or StringBuilder if Java 5+) which will do this for you automatically when the size is at a certain point, and clear it out)
-
How to call a method repeatedly with JSP custom tag?
This senerio is very similar to the usage of StringBuffer.
I have a problem which can be solved easily with scriptlets:
<% NameValuePair nvp = new NameValuePair(request.getQueryString()); %>
<a href="foo.html?<%=nvp.add(name1", "value1").add("name2", "value2").toString();%">">Foo</a>
<a href="bar.html?<%=new NameValuePair(request.getQueryString()).add("x", 1).add("y", 2).toString()%>">Bar</a>
But I cannot use scriplets because it's turned off. I can only use jsp custom tag / jstl. How would I implement this functionality with a custom tag? How would the JSP code look like? Our container supports JSP 2.0.
Thanks.</a>hi,
you can do within 2 step-
1) use <%@page import="your_java_class"%>
2)use scriptlet code <%...%> and write coding in this tag.
means create instance of your java class .
<% your_java_class obj1=new your_java_class();
obj1.method_of_your_java_class();
%>or
3) you can make javabean to use method of java class.[Best option]
Thanx
Ranvijay -
Hello friends i am planning to learn jsp custom tags but i dont find any proper source or any material.....help me to find the proper URL to get the tutorials.
ThanksDid you look under tutorials on this site? The URL is http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags.html
-
Database access with JSP custom tags
i have created one file in which i am making the connection with mysql data base with con.mysql.jdbc.Driver.and usking J connector and that i'm doing with custom tag.this is the error which i'm getting in tomcat.
and the tag handler class and TLD file and jsp file is below
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.servlet.jsp.JspException: null
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl .java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.j ava:778)
org.apache.jsp.DbTry_jsp._jspService(org.apache.jsp.DbTry_jsp:72)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
Try.Connect.<init>(Connect.java:26)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:116)
org.apache.jsp.DbTry_jsp._jspx_meth_db_connect_0(org.apache.jsp.DbTry_jsp:84)
org.apache.jsp.DbTry_jsp._jspService(org.apache.jsp.DbTry_jsp:62)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
Apache Tomcat/5.5.4
Tag handler class
package Try;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;
import java.sql.*;
public class Connect extends TagSupport {
private String driver = "com.mysql.jdbc.Driver";
private String dbtype = "mysql";
private String host = "localhost";
private String username = "root";
private String password = "203131";
private String database = "compose";
private String scope = "page";
private String id = "";
JspWriter out = pageContext.getOut();
public void setDriver(String str) {
driver = str;
public void setDbtype(String str) {
dbtype = str;
public void setHost(String str) {
host = str;
public void setUsername(String str) {
username = str;
public void setPassword(String str) {
password = str;
public void setDatabase(String str) {
database = str;
public void setScope(String str) {
scope = str;
public void setId(String str) {
id = str;
public int doStartTag() throws JspException {
try {
Class.forName("com.mysql.jdbc.Driver");
String url= "jdbc:" + dbtype + "://" + host + "/" + database;
Connection connection = DriverManager.getConnection(url,username,password);
out.println("right ;;one");
catch (SQLException e1) {
System.out.println("Error in HeadingTagv: " + e1);
catch (Exception e) {
System.out.println("Error in HeadingTag: " + e);
return SKIP_BODY;
TLD is lib.tld
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>db</short-name>
<display-name>Database Tags</display-name>
<description>
A set of tags for working with SQL database access
</description>
<tag>
<name>connect</name>
<tag-class>Try.Connect</tag-class>
<body-content>empty</body-content>
<description>
</description>
<attribute>
<name>driver</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
</description>
</attribute>
<attribute>
<name>dbtype</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
</description>
</attribute>
<attribute>
<name>host</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
Can be given by a run-time expression.
Host name of the computer where database is located.
Default is "localhost".
</description>
</attribute>
<attribute>
<name>username</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
Can be given by a run-time expression.
Username for logging onto the database.
Default is "root".
</description>
</attribute>
<attribute>
<name>password</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
Can be given by a run-time expression.
Password for logging onto the database.
Default is the empty string.
</description>
</attribute>
<attribute>
<name>database</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>
Can be given by a run-time expression.
The name of the database that will be used for
the SQL commands. Default is no database specified.
</description>
</attribute>
<attribute>
<name>id</name>
<required>false</required>
<description>
</description>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<description>
</description>
</attribute>
</tag>
</taglib>
JSP file is
<%@ taglib uri="/WEB-INF/lib.tld" prefix="db" %>
<html>
<body>
<db:connect username="root" password="203131" database="compose" />
</body>
</html>Answered in your other post:
http://forum.java.sun.com/thread.jspa?threadID=608780&tstart=0 -
Handling Exceptions in Custom Tags??
Hi,
what is the preferred way to handle an exception that is thrown from jsp
code in the body of a custom tag? The code below obviously causes a null
pointer exception inside of the custom tag. When the code executes, a
ServletException ( javax.servlet.ServletException: runtime failure in custom
tag 'golfPage' ) is thrown back. Is there any way to structure code so that
you get a better idea of what actually went wrong in the body of the custom
tag?
<golf:golfPage navRoot="admin_overview" title="Admin Overview" >
<br>
<%
Hashtable ht = null;
ht.put("test","test null pointer");
%>
</golf:golfPage>
Never mind... got the answer to my question:
http://www.ajug.org/archive/ajug-members/10306/msg00030.html
The encode methods are executed in the JSP which is why the implicit exception object is available... while the decode methods are executed as part of the Faces Servlet lifecycle and hence the exception object must be gotten from the request attribute...
I guess I need to take Servlet 101 all over again... -
Initial problem with JSP Custom Tag devolopment
Hi ,
I have encountered a problem with my JSP application which utilizes a simple custom tag.
First I created followinng directories.
1. %TOMCAT_HOME%\webapps\testTags
2. %TOMCAT_HOME%\webapps\testTags\META-INF
3. %TOMCAT_HOME%\webapps\testTags\WEB-INF
4. %TOMCAT_HOME%\webapps\testTags\WEB-INF\tlds
5. %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes
6. %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes\com
7. %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes\com\tek271
8. %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes\com\tek271\testTags
I created the essential four files, that is named as follows.
1.TagError.java
2.web.xml
3.testTld.tld
4.testJsp.jsp
Then i put the files under these directories as given below
testJsp.jsp under %TOMCAT_HOME%\webapps\testTags.
web.xml under %TOMCAT_HOME%\webapps\testTags\WEB-INF
TagError.java under %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes
TagError.class under %TOMCAT_HOME%\webapps\testTags\WEB-INF\classes\com\tek271\testTags
testTld.tld %TOMCAT_HOME%\webapps\testTags\WEB-INF\tlds
Here is the content inside the files.
1.TagError.java
package com.tek271.testTags;
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class TagError extends TagSupport {
private String mColor = "red";
public void setColor(String aColor) {
mColor = aColor;
} // setColor
public int doStartTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
out.print("<font color=\"");
out.print(mColor);
out.print("\"><b>Error: ");
} catch (IOException ex) {
throw new JspTagException(ex.getMessage());
return EVAL_BODY_INCLUDE; // other return: SKIP_BODY
} // doStartTag()
public int doEndTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
out.println("</b></font><br>");
} catch (IOException ex) {
throw new JspTagException(ex.getMessage());
return EVAL_PAGE; // other return: SKIP_PAGE
} // doEndTag()
} // TagError
2.web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
<taglib>
<taglib-uri>/testTaglib</taglib-uri>
<taglib-location>/WEB-INF/tlds/testTld.tld</taglib-location>
</taglib>
</web-app>
3.testTld.tld
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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>testTld</shortname>
<info>Testing jsp tags</info>
<tag>
<name>tagError</name>
<tagclass>com.tek271.testTags.TagError</tagclass>
<bodycontent>JSP</bodycontent> <!-- Also: empty, tagdependent -->
<info>Show a string as an error message</info>
<attribute>
<name>color</name>
<required>false</required>
</attribute>
</tag>
</taglib>
4.testJsp.jsp
<%@ taglib uri="/testTaglib" prefix="test" %>
<html>
<head>
<title>Testing Tag Library</title>
</head>
<body>
<test:tagError>Invalid user name</test:tagError>
<test:tagError color="blue">Invalid Password</test:tagError>
</body>
</html>
but i am getting the following error.
Apache Tomcat/4.0.3 - HTTP Status 500 - Internal Server Error
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: File "/testTaglib" not found
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:214)
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:174)
at org.apache.jasper.compiler.JspParseEventListener.processTaglibDirective(JspParseEventListener.java:1162)
at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:758)
at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:121)
at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:255)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1145)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1103)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1099)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:213)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:210)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:552)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:189)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:536)
why is it like this ?please give me a solution.
Thanking in advance.
From
Vinod A.Dear patreck ,
It does not work.
I have replaced the line
<%@ taglib uri="/testTaglib" prefix="test" %>
with
<%@ taglib uri="WEB-INF/tlds/testTaglib" prefix="test" %>
but now it shows the error ,
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: File "/testTags/WEB-INF/tlds/testTaglib" not found
any more suggestion ?
From Vinod A. -
Hi all,
When my JAVA_HOME env variable is pointing to C:\jdk1.3, the JSP below which contains some custom tags fails to compile in Weblogic 5.1. However, when i change my JAVA_HOME env variable to C:\weblogic\jre1_2\jre, the same JSP compiles and deploys with no problems. I was of the opinion that the jre in jdk 1.3 is the same as jre1_2 which is bundled with weblogic 5.1. Does anyone know of any differences btw the Jre's or why the JSP below cannot be compiled when i use JDK1.3. Thanks for the help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import="java.util.Vector" %>
<%@ page import="com.spcs.premiere.common.framework.errorhandling.ErrorUtility" %>
<%@ page import="com.spcs.premiere.common.framework.errorhandling.PremiereLogger" %>
<%@ page import="org.grnds.structural.web.GrndsServletException" %>
<%@ taglib uri="/tlds/profiling/profile.tld" prefix="profile" %>
<%@ page import="com.spcs.premiere.web.common.HTMLListBuilder" %>
<%@ page import="com.spcs.premiere.web.common.ListParametersDomain" %>
<%@ page import="com.spcs.premiere.web.common.PremiereConstants" %>
<%@ page import="com.spcs.premiere.ejb.authentication.LoginDomain" %>
<html>
<head>
<title>Premiere Business...Assign Credit Class</title>
<LINK HREF="<%= request.getContextPath()%>/stylesheets/premiere.css" REL="stylesheet" TYPE="text/css">
<SCRIPT LANGUAGE="javascript">
var winHandle=window.dialogArguments;
function userFocus()
window.document.SupervisorLoginForm.SupervisorUserName.focus();
</SCRIPT>
</head>
<body onload="userFocus();">
<%
try{
%>
<TABLE WIDTH="100%" HEIGHT="100%" CLASS="groupbox">
<TR>
<TABLE WIDTH="100%" HEIGHT="75%" CLASS="groupbox">
<TR HEIGHT="15%"></TR>
<FORM NAME="SupervisorLoginForm" ACTION="<%= request.getContextPath() %>/Premiere/AddAccountConversation/SupervisorLogin" METHOD="post" TARGET="_self">
<TR HEIGHT="15%">
<TD align=center><LABEL NAME="SupervisorUserNameLabel">User ID:</LABEL></TD></TD>
<TD align=left><INPUT TYPE="text" NAME="SupervisorUserName" MAXLENGTH="20" SIZE="20" TABINDEX="1"></TD></TR>
</TR>
<TR>
<TD align=center> <LABEL NAME="SupervisorPasswordLabel">Password:</LABEL></TD></TD>
<TD align=left><INPUT TYPE="password" NAME="SupervisorPassword" TABINDEX="2" MAXLENGTH="20" SIZE="20" ENABLED></TD>
</TR>
<TR>
<TD COLSPAN="2" ALIGN="center"><BUTTON TYPE="submit" NAME="Login" TABINDEX="3" Class="button">Login</BUTTON></TD>
<TD></TD>
</TR></FORM>
<FORM NAME="CreditClassForm" ACTION="<%= request.getContextPath() %>/Premiere/AddAccountConversation/AssignCreditManually" METHOD="post">
<TR HEIGHT="60%">
<TD align=center> <LABEL NAME="SupervisorCreditClassLabel">Credit Class:</LABEL></TD></TD>
<TD align=left>
<profile:user WidgetName="CreditClass" Context="JSP" SubContext="SupervisorLogin" Evaluate="SUPERVISOR">
<%= HTMLListBuilder.buildHTMLList((ListParametersDomain)session.getAttribute("CreditClassCodes")) %></TD>
</profile:user>
<TD></TD>
</TR>
<TR></TR>
</TR></TBODY></TABLE>
</TR>
<TR>
<TABLE WIDTH="100%" HEIGHT="25%" CLASS="groupbox">
<TD></TD>
<TD align=right><BUTTON NAME="Cancel" Class="button" TABINDEX="4" ONCLICK="window.close()">Cancel</BUTTON>
<profile:user WidgetName="Save" Context="JSP" SubContext="SupervisorLogin" Evaluate="SUPERVISOR">
<BUTTON TYPE="submit" NAME="Save" TABINDEX="6" Class="button">Save</BUTTON>
</profile:user>
</TD>
</TR></TBODY></TABLE>
</TR></TBODY></TABLE>
</FORM>
<%
catch (Exception e)
LoginDomain loginDomain = (LoginDomain)session.getAttribute(PremiereConstants.LOGIN_DOMAIN);
PremiereLogger.log( "ERROR", loginDomain.getUserName()+" General Exception Error: ", e );
request.setAttribute(ErrorUtility.ERROR_CONDITION, ErrorUtility.getMessage(PremiereConstants.GENERIC_JSP_EXCEPTION_ERROR_ID) );
throw new GrndsServletException();
%>
</body>
</html>UUh, interesting.
Try to use the last Service Pack for 5.1 - i think it is sp9.
Hope it'll work. I've had some problems with XML parsing but they resolved when I installed the last SP... -
Initialization of parameter values in JSP Custom Tag Handlers
Hi - I have a tag handler for a custom tag that has no body, but accepts
some parameters.
If the parameters are optional and are passed with the tag in the source jsp
page, then all is fine.
However, for subsequent uses of the same tag in the same page if the
optional parameters are omitted, the previous values remain in the instance
of the tag handler class, as the attributes for the tag handler are declared
as instance variables (with corresponding getters and setters) as per the
tag handler specs.
eg:
<abc:sometag attrib1="a" attrib2="b"/>
if attrib1 and attrib2 are optional, then a subsequent use of this tag, eg:
<abc:sometag/>
attrib1 and attrib2 still have their previously assigned values of "a" and
"b".
Is there a method I can call to get the actual values of the attributes that
were passed on a particular call to the tag handler, or is there a way to
initialize the attributes before the tag handler processing method, eg
doBeforeBody(), doAfterBody(), is called?
Thanks,
Kevin Hooke
Yeah, just call the JSPWriter's print method instead of using the StringBuffer, or write your own subclass of StringBuffer (or StringBuilder if Java 5+) which will do this for you automatically when the size is at a certain point, and clear it out)
-
Design view for jsp custom tags.
when we drag-and-drop custom tag control in the source of jsp page, when we switch to the design view of jsp we should be able to view controls as desired.
Observation: 1) Eclipse 3.2 doesn't have design view for jsp pages.
2) which software uses the design view. we need to extend eclipse core framework and we do not find any technical approach document to proceed further on this.
3) RAD 6.0 we can see a JSP in design view.
I'm searching for any technical approach document to create plugin that can intercept the custom tags and provide a design view.
Will any one suggest the plugin for that.Jeff,
I have checked with engineering and found that JSP Design View support on
Linux is a planned feature for the next release. I don't think we will have
this feature as part of a Service Pack for 8.1
Regards,
Raj Alagumalai
WebLogic Workshop Support
"Jeff Cassanvoa" <[email protected]> wrote in message
news:3f4df04e$[email protected]..
>
Raj,
Thanks for the information!! Any timeframe when it might be supportedon Linux
Thanks,
Jeff
"Raj Alagumalai" <[email protected]> wrote:
Jess,
Unfortunately, the JSP design view is currently not supported on Linux.
Workshop does allow to do remote development where the IDE is running
on a
Windows machine and connects to a server running on Linux/Solaris.
Regards,
Raj Alagumalai
WebLogic Workshop Support
"Jeff Cassanova" <[email protected]> wrote in message
news:[email protected]..
Does anybody else who is running the Linux version of Workshop 8.1have
troubling
getting the Design View of JSP files to come up. All I see is thesource,
with
no tabs at the bottom to switch to/from the Design View. When I bootover
to
Windows and run 8.1 Workshop, I see both tabs and I am able to useboth
views.
Is it something I have set in Preferences somewhere that disablesthe
Design
View ???
Thanks,
Jeff
Maybe you are looking for
-
I live out in the sticks and am unable to get any type of high speed internet. I have two telephone lines, one is connected to my iBook and the other is connected to my windows machine. I would like to know if I can use the dial-up connection on my w
-
Budget Exceeded Issue - Activated budget profile for existing project
Dear Experts, I have a Project and not using any budget profile, already actual data exist only in CJI3 no data in CJI5. Now I assigned Budget Profile in that project. While entering Budget in T-code CJ30, I can see values in assigned values for a wb
-
Hi Friends, We have maintained tax code in VK11 for CST having the follwoing paraters. Country Country IN Region of dlv.plant Region of dlv.plant 10 Region Region
-
Double Images when copied to CD
I have an album of photos which I copied to CD in the following manner. I made a folder on my desktop and dragged (I may have exported them from iPhoto instead of dragging but at the moment I am not sure which I used) 68 photos to the folder. I then
-
Error 103 installing Itunes update.
I get an error trying to install Itunes update on my iMac during system update. I am running Mountain Lion. What can I do?