aspose file tools*
The moose likes Servlets and the fly likes urgent help in jsp taglib Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "urgent help in jsp taglib" Watch "urgent help in jsp taglib" New topic
Author

urgent help in jsp taglib

deepak62002
Greenhorn

Joined: Aug 17, 2001
Posts: 9
hi,
i am using taglib in jsp but when i am calling taglib is is showing this error
"/pager-demo.jsp(3): Error in using tag library uri='/taglib.tld' prefix='pg': description in TLD defines element multiple times
probably occurred due to an error in /pager-demo.jsp line 3:
<%@ taglib uri="/taglib.tld" prefix="pg" %> "
i am unable to understand this error.
pls help me out
deepak
------------------
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
It looks like a problem with your taglib.tld file. Could you paste it in for us?
Cheers
Simon
deepak62002
Greenhorn

Joined: Aug 17, 2001
Posts: 9
now it is showing this error
"/pager-demo.jsp(80): extra info class com.jsptags.navigation.pager.PagerTagExtraInfo rejected the attributes for this instance of tag pager
probably occurred due to an error in /pager-demo.jsp line 80:
<pg ager maxIndexPages="<%=20%>"> "
"---------------------this is my taglib------------------------"
<?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>pg</shortname>
<uri>http://jsptags.com/tags/navigation/pager</uri>
<info>
The Pager Tag Library helps generate Google[sm] and AltaVista�
style search result navigators. It will take multiple pages worth of
information, dynamically split it up into page sized pieces and generate
a browsable index. It does this in a flexible way that allows designers
to give the index just about any look desired.
</info>
<tag>
<name>pager</name>
<tagclass>com.jsptags.navigation.pager.PagerTag</tagclass>
<teiclass>com.jsptags.navigation.pager.PagerTagExtraInfo</teiclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>maxItems</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>maxPageItems</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>maxIndexPages</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>isOffset</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>param</name>
<tagclass>com.jsptags.navigation.pager.ParamTag</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>item</name>
<tagclass>com.jsptags.navigation.pager.ItemTag</tagclass>
<bodycontent>JSP</bodycontent>
</tag>
<tag>
<name>index</name>
<tagclass>com.jsptags.navigation.pager.IndexTag</tagclass>
<bodycontent>JSP</bodycontent>
</tag>
<tag>
<name>prev</name>
<tagclass>com.jsptags.navigation.pager.PrevTag</tagclass>
<teiclass>com.jsptags.navigation.pager.IndexTagExtraInfo</teiclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>ifnull</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>pages</name>
<tagclass>com.jsptags.navigation.pager.PagesTag</tagclass>
<teiclass>com.jsptags.navigation.pager.IndexTagExtraInfo</teiclass>
<bodycontent>JSP</bodycontent>
</tag>
<tag>
<name>next</name>
<tagclass>com.jsptags.navigation.pager.NextTag</tagclass>
<teiclass>com.jsptags.navigation.pager.IndexTagExtraInfo</teiclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>ifnull</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
"--------------------this is my jsp---------------------------"
<%@ page session="false" %>
<%@ taglib uri="/taglib.tld" prefix="pg" %>
<html>
<head>
<title>Pager Tag Library Demo</title>
<%
/*
* Pager Tag Library
*
* Copyright (C) 2000 James Klicman <james@jsptags.com>
*
* The latest release of this tag library can be found at
* http://jsptags.com/tags/navigation/pager/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
%>
<style type="text/css">
A.nodec { text-decoration: none; }
</style>
</head>
<body bgcolor="#ffffff">
<table bgcolor="#ffcc00" width="100%" border="0"
cellspacing="0" cellpadding="2">
<tr>
<td><table bgcolor="#3366cc" width="100%" border="0"
cellspacing="0" cellpadding="4">
<tr>
<td width="379"><a href="http://jsptags.com/"><img src="jsptags.gif"
alt="<jsptags.com> logo" width="379" height="65" border="0"></a></td>
<td width="100%" align="center"><a href="http://jsptags.com/tags/navigation/pager/" class="nodec"><font color="#ffffff" size="+2"><b>
Pager Tag Library v1.1</b></font></a></td>
</tr>
</table></td>
</tr>
</table>
<%
String requestUri = request.getRequestURI();
int indexOfqm = requestUri.indexOf('?');
if (indexOfqm != -1)
requestUri = requestUri.substring(0, indexOfqm);
String style = request.getParameter("style");
%>
<center>
<table width="90%" cellpadding="4">
<tr>
<td>
<ul>
<b>Style</b><br>
<li><a href="<%= requestUri %>?style=simple">Simple</a>
<li><a href="<%= requestUri %>?style=jsptags">JSPTags.com</a>
<li><a href="<%= requestUri %>?style=altavista">AltaVista®</a>
<li><a href="<%= requestUri %>?style=google"><font color="#0000cc">G</font><font color="#cccc00">oo</font><font color="#0000cc">g</font><font color="#00cc00">l</font><font color="#cc0000">e</font><small><sup>SM</sup></small></a>
</ul>
</td>
<td width="100%">
This demo of the Pager Tag Library displays the web safe color palette as
its data source. You can choose among the different sample index styles
by clicking on the style name.
</td>
</tr>
</table>
<pg ager maxIndexPages="<%=20%>">
<pg aram name="style"/> <% /* keep track of style */ %>
<hr>
<table width="90%" cellspacing="4" cellpadding="4">
<%
for (int i = 0; i < webPalette.length; i++) {
%><pg:item>
<tr><th bgcolor="<%= webPalette[i][0] %>"><font color="<%= webPalette[i][1] %>"><%= i + 1 %></font></th></tr></pg:item><%
}
%>
</table>
<hr>
<pg:index>
<% if ("jsptags".equals(style)) { %>
<table bgcolor="#ffcc00" border="0" cellspacing="0"
cellpadding="2"><tr><td><table bgcolor="#003399" width="100%"
border="0" cellspacing="0" cellpadding="6"><tr><td
align="center"><table border="0" cellspacing="0"
cellpadding="0"><tr><td width="15" height="21"><img
src="http://jsptags.com/images/pager/left.gif" width="15" height="21"
border="0"></td>
<th height="21" bgcolor="#3366cc"
background="http://jsptags.com/images/pager/bg.gif"
nowrap><font face="Lucida,San-Serif,Arial,Helvetica">
<pg rev>taglib
<a href="<%= pageUrl %>" class="nodec"><font
color="#ffcc00"><<</font></a>
</pg rev>
<pg ages> <%
if (pageNumber == pagerPageNumber) {
%><font color="#ffffff"><%= pageNumber %></font><%
} else {
%><a href="<%= pageUrl %>" class="nodec"><font
color="#ffcc00"><%= pageNumber %></font></a><%
}
%> </pg ages>
<pg:next>
<a href="<%= pageUrl %>" class="nodec"><font
color="#ffcc00">>></font></a>
</pg:next>
</font></th><td width="17" height="21"><img
src="http://jsptags.com/images/pager/right.gif" width="17" height="21"
border="0"></td></tr></table></td></tr></table></td></tr>
</table>
<% } else if ("google".equals(style)) { %>
<table border=0 cellpadding=0 width=10% cellspacing=0>
<tr align=center valign=top>
<td valign=bottom><font face=arial,sans-serif
size=-1>Result Page: </font></td>
<pg rev ifnull="<%= true %>">
<% if (pageUrl != null) { %>
<td align=right><A HREF="<%= pageUrl %>"><IMG
SRC=http://www.google.com/nav_previous.gif alt="" border=0><br>
<b>Previous</b></A></td>
<% } else { %>
<td><IMG SRC=http://www.google.com/nav_first.gif alt="" border=0></td>
<% } %>
</pg rev>
<pg ages>
<% if (pageNumber == pagerPageNumber) { %>
<td><IMG SRC=http://www.google.com/nav_current.gif alt=""><br>
<font color=#A90A08><%= pageNumber %></font></td>
<% } else { %>
<td><A HREF="<%= pageUrl %>"><IMG
SRC=http://www.google.com/nav_page.gif alt="" border=0><br>
<%= pageNumber %></A></td>
<% } %>
</pg ages>
<pg:next ifnull="<%= true %>">
<% if (pageUrl != null) { %>
<td><A HREF="<%= pageUrl %>"><IMG
SRC=http://www.google.com/nav_next.gif alt="" border=0><br>
<b>Next</b></A></td>
<% } else { %>
<td><IMG SRC=http://www.google.com/nav_last.gif alt="" border=0></td>
<% } %>
</pg:next>
</tr>
</table>

<% } else if ("altavista".equals(style)) { %>
<font face=Helvetica size=-1>Result Pages:
<pg rev> <a href="<%= pageUrl %>">[<< Prev]</a></pg rev>
<pg ages><%
if (pageNumber.intValue() < 10) {
%> <%
}
if (pageNumber == pagerPageNumber) {
%><b><%= pageNumber %></b><%
} else {
%><a href="<%= pageUrl %>"><%= pageNumber %></a><%
}
%>
</pg ages>
<pg:next> <a href="<%= pageUrl %>">[Next >>]</a></pg:next>
<br></font>

<% } else { %>
<pg rev>
<a href="<%= pageUrl %>">[ (<%= pageNumber %> ) << Previous ]</a>
</pg rev>
<pg ages>
<a href="<%= pageUrl %>"><%= pageNumber %></a>
</pg ages>
<pg:next>
<a href="<%= pageUrl %>">[ Next >> (<%= pageNumber %> ) ]</a>
</pg:next>
<% } %>
</pg:index>
</pg ager>
</center>
</body>
</html>
<%!
static final String[][] webPalette = {
{"#ffffff","#000000"},
{"#cccccc","#000000"},
{"#999999","#000000"},
{"#666666","#ffffff"},
{"#333333","#ffffff"},
{"#000000","#ffffff"},
{"#ffcc00","#000000"},
{"#ff9900","#000000"},
{"#ff6600","#000000"},
{"#ff3300","#ffffff"},
{"#99cc00","#000000"},
{"#cc9900","#000000"},
{"#ffcc33","#000000"},
{"#ffcc66","#000000"},
{"#ff9966","#000000"},
{"#ff6633","#000000"},
{"#cc3300","#ffffff"},
{"#cc0033","#ffffff"},
{"#ccff00","#000000"},
{"#ccff33","#000000"},
{"#333300","#ffffff"},
{"#666600","#ffffff"},
{"#999900","#000000"},
{"#cccc00","#000000"},
{"#ffff00","#000000"},
{"#cc9933","#000000"},
{"#cc6633","#ffffff"},
{"#330000","#ffffff"},
{"#660000","#ffffff"},
{"#990000","#ffffff"},
{"#cc0000","#ffffff"},
{"#ff0000","#ffffff"},
{"#ff3366","#ffffff"},
{"#ff0033","#ffffff"},
{"#99ff00","#000000"},
{"#ccff66","#000000"},
{"#99cc33","#000000"},
{"#666633","#ffffff"},
{"#999933","#000000"},
{"#cccc33","#000000"},
{"#ffff33","#000000"},
{"#996600","#ffffff"},
{"#993300","#ffffff"},
{"#663333","#ffffff"},
{"#993333","#ffffff"},
{"#cc3333","#ffffff"},
{"#ff3333","#ffffff"},
{"#cc3366","#ffffff"},
{"#ff6699","#000000"},
{"#ff0066","#ffffff"},
{"#66ff00","#000000"},
{"#99ff66","#000000"},
{"#66cc33","#000000"},
{"#669900","#ffffff"},
{"#999966","#000000"},
{"#cccc66","#000000"},
{"#ffff66","#000000"},
{"#996633","#ffffff"},
{"#663300","#ffffff"},
{"#996666","#ffffff"},
{"#cc6666","#000000"},
{"#ff6666","#000000"},
{"#990033","#ffffff"},
{"#cc3399","#ffffff"},
{"#ff66cc","#000000"},
{"#ff0099","#ffffff"},
{"#33ff00","#000000"},
{"#66ff33","#000000"},
{"#339900","#ffffff"},
{"#66cc00","#000000"},
{"#99ff33","#000000"},
{"#cccc99","#000000"},
{"#ffff99","#000000"},
{"#cc9966","#000000"},
{"#cc6600","#ffffff"},
{"#cc9999","#000000"},
{"#ff9999","#000000"},
{"#ff3399","#ffffff"},
{"#cc0066","#ffffff"},
{"#990066","#ffffff"},
{"#ff33cc","#000000"},
{"#ff00cc","#ffffff"},
{"#00cc00","#ffffff"},
{"#33cc00","#000000"},
{"#336600","#ffffff"},
{"#669933","#ffffff"},
{"#99cc66","#000000"},
{"#ccff99","#000000"},
{"#ffffcc","#000000"},
{"#ffcc99","#000000"},
{"#ff9933","#000000"},
{"#ffcccc","#000000"},
{"#ff99cc","#000000"},
{"#cc6699","#000000"},
{"#993366","#ffffff"},
{"#660033","#ffffff"},
{"#cc0099","#ffffff"},
{"#330033","#ffffff"},
{"#33cc33","#000000"},
{"#66cc66","#000000"},
{"#00ff00","#000000"},
{"#33ff33","#000000"},
{"#66ff66","#000000"},
{"#99ff99","#000000"},
{"#ccffcc","#000000"},
{"#cc99cc","#000000"},
{"#996699","#ffffff"},
{"#993399","#ffffff"},
{"#990099","#ffffff"},
{"#663366","#ffffff"},
{"#660066","#ffffff"},
{"#006600","#ffffff"},
{"#336633","#ffffff"},
{"#009900","#ffffff"},
{"#339933","#ffffff"},
{"#669966","#000000"},
{"#99cc99","#000000"},
{"#ffccff","#000000"},
{"#ff99ff","#000000"},
{"#ff66ff","#000000"},
{"#ff33ff","#000000"},
{"#ff00ff","#ffffff"},
{"#cc66cc","#000000"},
{"#cc33cc","#ffffff"},
{"#003300","#ffffff"},
{"#00cc33","#ffffff"},
{"#006633","#ffffff"},
{"#339966","#ffffff"},
{"#66cc99","#000000"},
{"#99ffcc","#000000"},
{"#ccffff","#000000"},
{"#3399ff","#000000"},
{"#99ccff","#000000"},
{"#ccccff","#000000"},
{"#cc99ff","#000000"},
{"#9966cc","#000000"},
{"#663399","#ffffff"},
{"#330066","#ffffff"},
{"#9900cc","#ffffff"},
{"#cc00cc","#ffffff"},
{"#00ff33","#000000"},
{"#33ff66","#000000"},
{"#009933","#ffffff"},
{"#00cc66","#000000"},
{"#33ff99","#000000"},
{"#99ffff","#000000"},
{"#99cccc","#000000"},
{"#0066cc","#ffffff"},
{"#6699cc","#000000"},
{"#9999ff","#000000"},
{"#9999cc","#000000"},
{"#9933ff","#ffffff"},
{"#6600cc","#ffffff"},
{"#660099","#ffffff"},
{"#cc33ff","#ffffff"},
{"#cc00ff","#ffffff"},
{"#00ff66","#000000"},
{"#66ff99","#000000"},
{"#33cc66","#000000"},
{"#009966","#ffffff"},
{"#66ffff","#000000"},
{"#66cccc","#000000"},
{"#669999","#000000"},
{"#003366","#ffffff"},
{"#336699","#ffffff"},
{"#6666ff","#ffffff"},
{"#6666cc","#ffffff"},
{"#666699","#ffffff"},
{"#330099","#ffffff"},
{"#9933cc","#ffffff"},
{"#cc66ff","#000000"},
{"#9900ff","#ffffff"},
{"#00ff99","#000000"},
{"#66ffcc","#000000"},
{"#33cc99","#000000"},
{"#33ffff","#000000"},
{"#33cccc","#000000"},
{"#339999","#ffffff"},
{"#336666","#ffffff"},
{"#006699","#ffffff"},
{"#003399","#ffffff"},
{"#3333ff","#ffffff"},
{"#3333cc","#ffffff"},
{"#333399","#ffffff"},
{"#333366","#ffffff"},
{"#6633cc","#ffffff"},
{"#9966ff","#000000"},
{"#6600ff","#ffffff"},
{"#00ffcc","#000000"},
{"#33ffcc","#000000"},
{"#00ffff","#000000"},
{"#00cccc","#000000"},
{"#009999","#ffffff"},
{"#006666","#ffffff"},
{"#003333","#ffffff"},
{"#3399cc","#000000"},
{"#3366cc","#ffffff"},
{"#0000ff","#ffffff"},
{"#0000cc","#ffffff"},
{"#000099","#ffffff"},
{"#000066","#ffffff"},
{"#000033","#ffffff"},
{"#6633ff","#ffffff"},
{"#3300ff","#ffffff"},
{"#00cc99","#000000"},
{"#0099cc","#ffffff"},
{"#33ccff","#000000"},
{"#66ccff","#000000"},
{"#6699ff","#000000"},
{"#3366ff","#ffffff"},
{"#0033cc","#ffffff"},
{"#3300cc","#ffffff"},
{"#00ccff","#000000"},
{"#0099ff","#ffffff"},
{"#0066ff","#ffffff"},
{"#0033ff","#ffffff"}
};
%>
"--------------------IN this bean it is showing problem---------"
package com.jsptags.navigation.pager;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class PagerTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData tagData) {
try{
String id = tagData.getId();
if (id == null)
id = PagerTag.DEFAULT_ID;
return new VariableInfo[] {
new VariableInfo(id+PagerTag.PAGE_NUMBER,
"java.lang.Integer",
true, VariableInfo.NESTED),
new VariableInfo(id+PagerTag.OFFSET,
"java.lang.Integer",
true, VariableInfo.NESTED),
new VariableInfo(id+PagerTag.MAX_ITEMS,
"java.lang.Integer",
true, VariableInfo.NESTED)
};
}catch(exception ex)
{
System.out.println("exception "+ex);
}
}

public boolean isValid(TagData tagData) {
return (validInt(tagData, "maxItems") &&
validInt(tagData, "maxPageItems") &&
validInt(tagData, "maxIndexPages"));
}

static boolean validInt(TagData tagData, String name) {
Object val = tagData.getAttribute(name);
if (val != null && val != TagData.REQUEST_TIME_VALUE &&
val instanceof String)
{
try {
if (Integer.parseInt((String)val) < 0)
return false;
} catch (NumberFormatException e) {
return false;
}
}
return true;
}
}
"pls help me "
deepak62002
Greenhorn

Joined: Aug 17, 2001
Posts: 9
hi,Simon Brown
this example is from site http://jsptags.com/tags/navigation/pager
if u r able to run this code in weblogic pls
intimate me
i will thank ful to u
deepak

------------------
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
What this means is that the PagerTagExtraInfo class is validating the attributes and returning false.

Check the values that you are using against those expected by the tag itself, and also that they are positive integers (as tested by the validInt method).
Hope that helps
Simon
[This message has been edited by Simon Brown (edited September 03, 2001).]
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1850
"deepak62002"

The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
deepak62002
Greenhorn

Joined: Aug 17, 2001
Posts: 9
hi Simon Brown,
in jsp i am passing
"<pg ager maxIndexPages="<%=20 %>">"
u mean to say that this value is returing false.
simon,just try to deploy this code ,as all this code is avalible in site i have mention above .
pls deploy in weblogic6.0 and let me know that whether u have sorted the problem.
i will helpful if u will be help me out.as i have wasted my
10 day's in this example.as this is one of most important module of my project.

thanx
deepak
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: urgent help in jsp taglib