Anyone one with 1,000+ JSPs with custom tags?
We're having some interesting memory problems with Sun JVMs, I'd like to hear how
your app is working out (misery loves company).
Mike
What are you seeing?
What WL version, what JVM, what OS/ver?
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"Mike Reiche" <[email protected]> wrote in message
news:3a80feac$[email protected]..
>
> We're having some interesting memory problems with Sun JVMs, I'd like to
hear how
> your app is working out (misery loves company).
>
> Mike
Similar Messages
-
Anyone worked with customizing the requisition account generator workflow?
Has anyone worked with customizing the requisition account generator workflow?
please let me know
I need help asap.
thanksHi Malla,
Solution here:
http://garethroberts.blogspot.com/2007/08/gl-account-code-combinations-on-fly-key.html
Regards,
Gareth -
JSP with Custom tags error during verify.
Hi, i am new to JSP and Custom tag Library. The tools that i am using to deploy is "Sun Deploy Tool 8.2" with Sun Application Server. When i try to verify my JSP page i get this error message
tests.web.AllJSPsMustBeCompilable . I guess there is nothing wrong for my code, will it be path problem, because
i already check that i had included all the path that i need. Any idea what might cause this problem? Thank You.
Assertion:All the JSPs that are bundled inside a web application must be compilable using a J2EE compliant JSP compiler that does not have any proprietary or optional features in it.
For [ /tag/tag.war ]
Error: Some JSPs bundled inside [ tag ] could not be compiled. See details below.
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 12 in the jsp file: /currentTime.jsp
Here are my class file :
Custom lib java Class timetag.java
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.text.SimpleDateFormat;
public class timetag extends TagSupport{
public int doEndTag() throws JspException
SimpleDateFormat sdf;
sdf = new SimpleDateFormat("HH:mm:ss");
String time = sdf.format(new java.util.Date());
try {
pageContext.getOut().print(time);
}catch(Exception ex)
throw new JspException(ex.toString());
return EVAL_PAGE;
Tag file *.tld : examplesTag.tld
<?xml version="1.0" encoding="ISO-8859-1" ?>
<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">
<tlib-version>1.0</tlib-version>
<jsp-version>2.0</jsp-version>
<short-name>ExamplesTags</short-name>
<description>A set of example tag handlers.</description>
<tag>
<name>time</name>
<tag-class>timetag</tag-class>
</tag>
</taglib>
JSP File : currentTime.jsp
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib prefix="examples" uri="/WEB-INF/examplesTags.tld" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<examples:time /> //If i remove this it will be fine.
</body>
</html>I am sorry for the double post because the format mess up..Please ignore this POST..Apologies again..Thanks
-
Error while running JSP with custom tag
I am trying to run a jsp with a tag and I am getting the following error when I run the jsp:
"Unable to open taglibrary /WEB-INF/jsp/mytaglib.tld : Parse Error in the tag library descriptor: External parameter entity "%(DOCTYPE);" has characters after markup."
I have no idea what this is, can anyone help me here?
tx
-ABIts difficult to tell without looking at your TLD file i.e. mytaglib.tld
However, a guess is that you may be refering to an invalid or otherwise corrupted DTD from your TLD.
Check that out.
The official DTD for TLDs in JSP 1.1 is http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd
and the official DTD for TLDs in JSP 1.2 is http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd -
JSPs using Custom Tag with Boolean attribute cannot compile
Hi,
In Oracle9iAS(9.0.3), a jsp using a tag extension, which has a Boolean attribute, caused the following compile error, although the jsp is valid in other web containers.
ERROR:
/opt/oracle/j2ee/home/application-deployments/simple/simple/persistence/_pages/_test.java:56: Method toBoolean(java.lang.Boolean) not found in class _test.
__jsp_taghandler_1.setExists( OracleJspRuntime.toBooleanObject( toBoolean( b)));
JSP:
<%@ page language="java" %>
<%@ page errorPage="error.jsp" %>
<%@ taglib prefix="jnpr" uri="/WEB-INF/testtag.tld" %>
<%
Boolean b = Boolean.valueOf("true");
%>
<jnpr:TestTag exists="<%= b%>"/>
The boolean value is <%= b %>
Tag Handler:
package defaultpak;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
public class TestTag extends TagSupport{
private Boolean exists = null;
private java.lang.Boolean getExists() {
return exists;
public void setExists(java.lang.Boolean newExists) {
exists = newExists;
public int doStartTag() throws JspException {
return super.doStartTag();
Is this a known problem? Is there a way to get around this?
Thanks in advance.
FredThis is a known issue with 903, fixed in coming 904.
In 903 the workaround is to use primitive type "boolean" instead of Object type "java.lang.Boolean" in user's getter and setter code for the taglib.
-Prasad -
JDev 9.0.3 - Working with Custom Tags Hangs JDev Repeatedly!
All,
I recently upgraded from JDev 9.0.2 to 9.0.3 because of the new support for JSP 1.2 and Servlets 2.3. As you probably know, JSP 1.2 includes additional support for custom tag development. Unfortunately, JDev 9.0.3 keeps hanging repeatedly when trying to work with a custom tag library. I have seen a couple other postings on this forum that indicate the fact that I'm not alone in this experience.
It seems that I am able to open a taglib and make a modification, and then save the taglib without a problem. However, if I attempt to make any further changes to that taglib again without restarting JDev, it just hangs JDev and I have to kill the JDev process and restart JDev. This has made JDev extremely frustrating and unusable developing custom tags. I do not have this problem with JDev 9.0.2, but that version does not support the additionally tag library functionality of JSP 1.2, which is supported by 9.0.3.
Is this a bug with 9.0.3? Does anyone know of a workaround I can try?
Thanks in advance,
Kyle CorleyHi,
Logged as bug 2725712.
Thanks,
Brian
JDev Team -
Problem with custom tag attribute types
Hi,
I try to figure out how to pass an attribute to a custom tag that is of a type other than "String"?
In my case, I should pass an attribute with a type of "java.util.ResourceBundle".
My tag looks like this:
<tt:cs sel="ab" ce="<%= java.util.ResourceBundle.getBundle("de", Application.getApp().getLocale())%>" />
I always get the message that the attribute ce is empty.
Isn't it possible to have attirbutes that are of an other type than string? How could I solve this problem?
Thanks a lot!
Regards PatrickIn JSP 1.2, in the Tag Library Descriptor, you can specify a tagt attribute as
<attribute>
<name>attr1</name>
<required>true|false|yes|no</required>
<rtexprvalue>true|false|yes|no</rtexprvalue>
<type>fully-qualified_type</type>
</attribute> Notice the XML element <type>fully-qualified_type</type>
Not sure if you can do this in JSP 1.1 -
Exception Handling with Custom Tags/Exceptions
Hello all --
I'm looking for some guidance in handling Custom errors in my app. I can't
seem to find the message string of my custom exception when trying to call
my JSP Error page. I'm consistently getting:
javax.servlet.jsp.JspTagException: runtime failure in custom tag
'CalendarHandler' .
I am using custom JSP tag libraries to process logic on my EJBs. When I
reach an error in business logic I raise a custom exception and propogate
this back up to doStartTag:
public int doStartTag() throws JspException {
CalendarProcessor cp = new CalendarProcessor();
try {
String eventAction = getEventID();
// pageContext contains information for the JSP;
// Initialize the page with the current context and session
cp.init(pageContext.getServletContext(), pageContext.getSession());
HttpServletRequest req = (HttpServletRequest)pageContext.getRequest();
cp.processRequest(req, eventAction );
} catch (CalendarException ce) {
throw new JspException(ce.getMessage());
return SKIP_BODY;
Then, in my JSP, I am enclosing the TagHandler in a try...catch block; I
can't catch CalendarException because it is Throwable and conflicts with
JspException.
<% try { %>
<gtc:CalendarHandler eventID="updatecal"/>
<% } catch (Exception e) {
throw e instanceof JspException ? (JspException) e : new
JspTagException(e.getMessage());
%>
many thanks in advance!
s.
I could not tell what the problem was that you were describing. Could you
clarify?
Cameron Purdy
[email protected]
http://www.tangosol.com
WebLogic Consulting Available
"Shari" <[email protected]> wrote in message
news:[email protected]...
> Hello all --
>
> I'm looking for some guidance in handling Custom errors in my app. I can't
> seem to find the message string of my custom exception when trying to call
> my JSP Error page. I'm consistently getting:
> javax.servlet.jsp.JspTagException: runtime failure in custom tag
> 'CalendarHandler' .
>
> I am using custom JSP tag libraries to process logic on my EJBs. When I
> reach an error in business logic I raise a custom exception and propogate
> this back up to doStartTag:
>
> public int doStartTag() throws JspException {
>
> CalendarProcessor cp = new CalendarProcessor();
>
> try {
>
> String eventAction = getEventID();
>
> // pageContext contains information for the JSP;
>
> // Initialize the page with the current context and session
>
> cp.init(pageContext.getServletContext(), pageContext.getSession());
>
> HttpServletRequest req = (HttpServletRequest)pageContext.getRequest();
>
> cp.processRequest(req, eventAction );
>
> } catch (CalendarException ce) {
>
> throw new JspException(ce.getMessage());
>
> }
>
> return SKIP_BODY;
>
> }
>
> Then, in my JSP, I am enclosing the TagHandler in a try...catch block; I
> can't catch CalendarException because it is Throwable and conflicts with
> JspException.
>
> <% try { %>
>
> <gtc:CalendarHandler eventID="updatecal"/>
>
> <% } catch (Exception e) {
>
> throw e instanceof JspException ? (JspException) e : new
> JspTagException(e.getMessage());
>
> }
>
> %>
>
> many thanks in advance!
>
> s.
>
>
>
>
>
>
>
-
I have written a custom tag that I am having problems with. It works on some machines, but not on others. I have a page that uses many 'standard' tags. I have correctly set the URI etc, because all of my other tags work. However, on some machines, my custom tag gives me an error:
attribute does not support request time values
I'm assuming that I have the correct versions of standard.jar etc because all of the regular jstl 1.1 tags work. It is just my custom tag that throws an error.
here is the .tld for my tag:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.1.2</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>My custom tag</short-name>
<uri>http://my.custom/tags</uri>
<tag>
<name>breadcrumb</name>
<tag-class>tag.BreadcrumbTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>breadcrumbs</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
<description>Pass in the list of Breadcrumbs containing the actual information
about what tags need to be rendered on the page.</description>
</attribute>
</tag>
</taglib>
Any thoughts/help greatly appreciated...I encountered the same problem in our environment. I did the same thing as
James. Simply re-initialize all variables in the do end tag.
Also, with the nested tags you use you may also need to implement cloneable
in the inner tag if the outer tag keeps references to all the inner tag
instances.
For instance if the outer tag kept a vector of references to the inner tag,
then you would need to use clone() on the inner tag before adding it to the
vector.
"James Lynn" <[email protected]> wrote in message
news:3af05d29$[email protected]..
> > But
> > with WL 6.0, the cell tag handler reuse the same instance each time the
> cell tag
> > is called and the member field is not reset
>
> I had the same problem. As a work around, I reinitialize everything in my
> doEndTag() method and it works.
>
>
> --
> James Lynn - Lead Software Architect
> Oakscape - Java Powered eBusiness Solutions <http://www.oakscape.com/>
>
>
-
Problems with custom tags (Tomcat 4.1)
I have been trying to set up an existing web application to use a custom tag library. I have these tag-related files:
/photodb/WEB-INF/photodb.tld
/photodb/WEB-INF/classes/PhotoListTag.class
/photodb/photolist.jsp
This is how i have the photoList tag configured in photodb.tld
<tag>
<name>photoList</name>
<tag-class>PhotoListTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>startIndex</name>
</attribute>
</tag>
When i try to view photolist.jsp, i get this error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\photodb\photolist_jsp.java:73: cannot resolve symbol
symbol : class PhotoListTag
location: class org.apache.jsp.photolist_jsp
PhotoListTag jspxth_photodb_photoList_0 = (PhotoListTag) jspxtagPool_photodb_photoList.get(PhotoListTag.class);
^
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\photodb\photolist_jsp.java:73: cannot resolve symbol
symbol : class PhotoListTag
location: class org.apache.jsp.photolist_jsp
PhotoListTag jspxth_photodb_photoList_0 = (PhotoListTag) jspxtagPool_photodb_photoList.get(PhotoListTag.class);
^
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\photodb\photolist_jsp.java:73: cannot resolve symbol
symbol : class PhotoListTag
location: class org.apache.jsp.photolist_jsp
PhotoListTag jspxth_photodb_photoList_0 = (PhotoListTag) jspxtagPool_photodb_photoList.get(PhotoListTag.class);
^
3 errors
I have tried many ideas, such as packaging the tag handler class, and putting the class file in other loctions, but nothing has helped.
I know that Tomcat is recognizing PhotoListTag at some point (when it parses the TLD file, but not when compiling the JSP, I think), because if i change the <tag-class> to an invalid class, i get an "Unable to load class photoList" (which is a confusing error message btw, as photoList is not a class, but a tag name).
Does anyone know how to fix this problem? I've been going in circles for hours, and i'm thinking this problem has a simple solution.Thank you for your quick replies. Unfortunately, they do not solve my problem. If I put PhotoListTag in the com.yourdomain package (and move it to classes/com/yourdomain), the error changes to reflect the different package (e.g. package com.yourdomain does not exist). Also, deleting the class files and restarting Tomcat did not cause any changes.
Although my knowledge of how Tomcat works is limited, it seems to me that something like this is happening:
When a request for /photodb/photolist.jsp is recieved, tomcat processes that file, processes the tld file, and checks for that any classes called using a tag--in this case <photodb:photoList>--exist. If the class is invalid, the error message "Unable to load class photoList" is given.
Otherwise, it translates the jsp into java, and attempts to compile it. This is where the problem occurs. It seems that the jasper compiler does not know where to look for the PhotoListTag class. Is there a way that this can be changed, or is could the problem be caused by something else? -
Build-time errors with custom tags in wkshop sp3
We have custom tags which create tag variables declared in the .tld file as follows:
<tag>
<name>contentsIterator</name>
<tag-class>org.cap.documentaccess.taglibs.ContentsIteratorTag</tag-class> <tei-class>org.cap.documentaccess.taglibs.ContentsIteratorTEI</tei-class>
<body-content>JSP</body-content>
<display-name>Contents Iterator</display-name>
<description>
</description>
<variable> <name-from-attribute>id</name-from-attribute> <variable-class>org.cap.documentaccess.Content</variable-class>
<declare>true</declare>
<scope>NESTED</scope>
</variable>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description>
</description>
</attribute>
The calling jsp contains the following:
<cap:contentsIterator id="content">
The app built fine in wkshop(sp2) but in sp3 we get the following:
A name-from-attribute variable cannot reference a tag attribute that is request time or is not required.
Has the sp3 compiler become less forgiving or was this an oversight in sp2?if u are using weblogic workshop for ur application import c.tld into WEB-INF
and just import standard.jar, jstl.jar to WEB-INF/lib.
if u are using other than weblogic work shop like tomcat
1.just copy c.tld to WEB-INF.
2.create a 'lib' directoty inside WEB-INF copy standard.jar,jstl.jar files to that lib directory.
i think it should work. -
Is Binary tree traversal possibe using custom tags?. The scriptiong variable need to be set in the JSP page on traversal of each node. Any suggestions will be appreciated.
thanks
sprasadthanks for suggestion.but the issue here is not actually traversing the binary tree(which is major focus in XML). It would be possible to do that using recursive method in tag. But the problem is that how to assign them to the scripting variables in the JSP.
While using the recursion , how to set the variables in the bodycontent. -
Hello..
I have created custom tags and she gives an error me.
The code is:
<%@ taglib uri="mitaglib.tld" prefix="ejemplos" %>
<HTML>
<HEAD>
<TITLE>Tag Hola Mundo</TITLE>
</HEAD>
<ejemplos:holamundo/><br>
<ejemplos:SumaTag num1="2" num2="6" />
</BODY>
</HTML>
The class:
package helperClasses;
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class hm extends TagSupport{
public int doStartTag() throws JspException
try
pageContext.getOut().print("Hola Mundo");
catch (IOException e)
throw new JspException("Error: IOException" + e.getMessage());
return SKIP_BODY;
public int doEndTag() throws JspException
return EVAL_PAGE;
package helperClasses;
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class SumaTag extends TagSupport{
private int num1,num2;
public void setNum1(int num1){
this.num1 = num1;
public void setNum2(int num2){
this.num2 = num2;
public int doStartTag() throws JspException {
try{
pageContext.getOut().print("Suma: " + (num1+num2));
} catch (IOException e) {
throw new JspException ("Error: IOException" +
e.getMessage());
return SKIP_BODY;
public int doEndTag() throws JspException {
return SKIP_PAGE;
The file mitaglib.tld is:
<?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>ejemplos</shortname>
<uri></uri>
<info>Etiquetas de ejemplo</info>
<tag>
<name>holamundo</name>
<tagclass>helperClasses.hm</tagclass>
<bodycontent>empty</bodycontent>
<info>Saludo</info>
</tag>
<tag>
<name>suma</name>
<tagclass>helperClasses.SumaTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Saludo</info>
<attribute>
<name>num1</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>num2</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>[22/Dec/2003:09:43:47] failure (11848): Internal error: Unexpected error condition thrown (unknown exception,no description), stack: java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;Z)V
at org.apache.jasper.compiler.TagLibraryInfoImpl.createAttribute(TagLibraryInfoImpl.java:518)
at org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:426)
at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:379)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:227)
at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:701)
at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:110)
at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1077)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1042)
at org.apache.jasper.compiler.Parser.parse(Parser.java:1038)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:218)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadJSP(JspServlet.java:193)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.access$4(JspServlet.java:167)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:477)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:589)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:897)
at com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1065)
at com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp(NSServletRunner.java:959) -
JSP in custom tag attributes...
Sirs,
A very nice feature from a development perspective, would be the ability
to use JSP code within custom tags. Say I have a page on which I wish
to give all the information on a widget. Say further that I have
implemented a tag that writes out all the info of a widget as HTML
table. I would like to write something like this:
<mytaglib:widgetTag widgetID="<%=request.getParameter("widget_id")%>"
/>
As far as I know, in the current implementation of custom taglibs this
does not seem to be possible. Instead you end up writing something like
this:
<mytaglib:widgetTag>
<mytaglib:getWidget><%=request.getParameter("widget_id")%>"</mytaglib:getWidget>
<mytaglib:displayWidget />
</mytaglib:widgetTag>
Which is much more like a scripting language than a heirarchical XML .
Now, I could always just use the request object within the tag helper
classes, but this gives up flexibility and can introduce security
issues, and it also makes the tags much more difficult to work with...
In short, we should push for JSP evaluation of tag attributes. Weblogic
could leap ahead of other app servers in this area (making up for the
custom tag performance issues, to be solve in sp6) and Sun would, once
again, follow Weblogic's lead and rewrite the standard to include this
functionality.
Regards,
Carson Gross
Carson,
Perhaps the problem is that you are treating custom tags like one would
construct an imperative language. I have never had to put Java or use beans
or %= or even parameters to tags into a JSP because of custom tags.
The real problem is writing/packaging/maintaining all those tags; sure could
use a tool that did just that ;-)
Peace,
Cameron Purdy
[email protected]
http://www.tangosol.com
WebLogic Consulting Available
"Carson Gross" <[email protected]> wrote in message
news:[email protected]...
> Sirs,
>
> A very nice feature from a development perspective, would be the ability
> to use JSP code within custom tags. Say I have a page on which I wish
> to give all the information on a widget. Say further that I have
> implemented a tag that writes out all the info of a widget as HTML
> table. I would like to write something like this:
>
> <mytaglib:widgetTag widgetID="<%=request.getParameter("widget_id")%>"
> />
>
> As far as I know, in the current implementation of custom taglibs this
> does not seem to be possible. Instead you end up writing something like
> this:
>
> <mytaglib:widgetTag>
>
>
<mytaglib:getWidget><%=request.getParameter("widget_id")%>"</mytaglib:getWid
get>
>
> <mytaglib:displayWidget />
> </mytaglib:widgetTag>
>
> Which is much more like a scripting language than a heirarchical XML .
> Now, I could always just use the request object within the tag helper
> classes, but this gives up flexibility and can introduce security
> issues, and it also makes the tags much more difficult to work with...
>
> In short, we should push for JSP evaluation of tag attributes. Weblogic
> could leap ahead of other app servers in this area (making up for the
> custom tag performance issues, to be solve in sp6) and Sun would, once
> again, follow Weblogic's lead and rewrite the standard to include this
> functionality.
>
> Regards,
> Carson Gross
>
-
Creating drop down menus in JSP using custom tags
Hi, i am working on a JSP which has custom tags for displaying menubar and menus, now i want to have these menus converted into drop down menus, and the submenus displayed onmouseover event. I am getting solutions with pure html page calling javascript functions.But i dont need this, i want the work done by my TagHandler class which sends the output to output stream, which in turn is transformed in to actual HTML by a XSLT embedded in my JSP.
Please help as i am new to custom tags, and desperately in need of help.
If possible give some sample code or useful links.
I will be highly grateful.
Thankx in advancethat's fine, but the tag has to, ultimately, generate the HTML/Javascript stuff like you've already seen.
-
Composing mail from email web application using jsp and custom tags
here is the send.jsp file
<%@ page language="java" %>
<%@ page errorPage="errorpage.jsp" %>
<%@ taglib uri="http://java.sun.com/products/javamail/demo/webapp"
prefix="javamail" %>
<html>
<head>
<title>JavaMail send</title>
</head>
<body bgcolor="white">
hi
<javamail:sendmail
recipients="<%= request.getParameter(\"to\") %>"
sender="<%= request.getParameter(\"from\") %>"
subject="<%= request.getParameter(\"subject\") %>">
<%= request.getParameter("text") %>
</javamail:sendmail>
<h1>Message sent successfully</h1>
</body>
</html>
Here is the java file i.e used to refer to this custom tag
package taglib;
import java.util.*;
import java.net.*;
import javax.mail.*;
import javax.mail.Authenticator;
import javax.mail.internet.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
* Custom tag for sending messages.
public class SendTag extends BodyTagSupport {
private String body;
private String cc;
private String host;
private String recipients;
private String sender;
private String subject;
* host attribute setter method.
public void setHost(String host) {
this.host = host;
System.out.println("Host is : " +host);
* recipient attribute setter method.
public void setRecipients(String recipients) {
this.recipients = recipients;
System.out.println("recipients is " +recipients );
* sender attribute setter method.
public void setSender(String sender) {
this.sender = sender;
System.out.println("Sender is : " +sender);
* cc attribute setter method.
public void setCc(String cc) {
this.cc = cc;
* subject attribute setter method.
public void setSubject(String subject) {
this.subject = subject;
System.out.println("subject is : " +subject);
* Method for processing the end of the tag.
public int doEndTag() throws JspException {
System.out.println(" ** In do end tag");
Properties props = System.getProperties();
try {
if (host != null)
props.put("mail.smtp.host", host);
else if (props.getProperty("mail.smtp.host") == null)
props.put("mail.smtp.host", InetAddress.getLocalHost().
getHostName());
} catch (Exception ex) {
throw new JspException(ex.getMessage());
Session session = Session.getDefaultInstance(props,null);
Message msg = new MimeMessage(session);
InternetAddress[] toAddrs = null, ccAddrs = null;
try {
if (recipients != null) {
toAddrs = InternetAddress.parse(recipients, false);
msg.setRecipients(Message.RecipientType.TO, toAddrs);
} else
throw new JspException("No recipient address specified");
if (sender != null)
msg.setFrom(new InternetAddress(sender));
else
throw new JspException("No sender address specified");
if (cc != null) {
ccAddrs = InternetAddress.parse(cc, false);
msg.setRecipients(Message.RecipientType.CC, ccAddrs);
if (subject != null)
msg.setSubject(subject);
if ((body = getBodyContent().getString()) != null)
msg.setText(body);
else
msg.setText("");
Transport.send(msg);
} catch (Exception ex) {
throw new JspException(ex.getMessage());
return(EVAL_PAGE);
all the entries in taglib.tld and web.xml are correct.
It is one of the article given at this url:
http://java.sun.com/developer/technicalArticles/javaserverpages/emailapps/First, you should not take copyrighted code and post it without a copyright.
The code you posted is copyright Sun Microsystems.
Second, why did you post it? Did you have a question?
Maybe you are looking for
-
ALSO, used itunes to reinstall ios. Same issue.
-
Planning detail report in ASCP
Hi Experts, I want to confirm planning output. so best way to view all data in concentrated manner is - use planning detail report. I have used the same in case of MRP in my last project. Now this report is available in ASCP, but not able to use it.
-
ICloud won't work on mac after apple ID changed
I just updated my apple ID today. The same ID seemed to work on the mac Apps and iTunes store and my ipad iTunes and apps after I restarted them (restarting and updating the new ID to be the same). But this evening my mac iCloud said it can't/ isn't
-
Updating Records of Container Managed Relationships in OC4J
I have been able to implement the example give on Oracle website for container managed relationship i.e. Departments and their Employees. It works well to get the employees of a particular department. But I am unable to update all the relations corre
-
Report on client account status
I would like to know how to run a report that will tell me whether the users on our network are using 'Standard' or 'Administrator' accounts. Can't seem to find any details on this?