Re: Using ScopeCache custom tag

Hi, I am quite new to ColdFusion and I have a calendar that
is quite slow due to the cfloops it uses to build the calendar. As
the page does not change very often I wanted to use Raymond
Camden's ScopeCache custom tag. However, for some reason the custom
tag was not getting picked up from the custom tag folder on the
server. I have successfully used components so have tried to
convert the custom tag to a component but get the following error
message:
Routines cannot be declared more than once.
The routine scope_Cache has been declared twice in the same
file.
This is the component:
<!---
Name : scopeCache
Author : Raymond Camden ([email protected])
Created : December 12, 2002
Last Updated : November 6, 2003
History : Allow for clearAll (rkc 11/6/03)
: Added dependancies, timeout, other misc changes (rkc
1/8/04)
Purpose : Allows you to cache content in various scopes.
Documentation:
This tag allows you to cache content and data in various RAM
based scopes.
The tag takes the following attributes:
name/cachename: The name of the data. (required)
scope: The scope where cached data will reside. Must be
either session,
application, or server. (required)
timeout: When the cache will timeout. By default, the year
3999 (i.e., never).
Value must be either a date/time stamp or a number
representing the
number of seconds until the timeout is reached. (optional)
dependancies: This allows you to mark other cache items as
dependant on this item.
When this item is cleared or timesout, any child will also
be cleared.
Also, any children of those children will also be cleared.
(optional)
clear: If passed and if true, will clear out the cached
item. Note that
this option will NOT recreate the cache. In other words, the
rest of
the tag isn't run (well, mostly, but don't worry).
clearAll: Removes all data from this scope. Exits the tag
immidiately.
disabled: Allows for a quick exit out of the tag. How would
this be used? You can
imagine using disabled="#request.disabled#" to allow for a
quick way to
turn on/off caching for the entire site. Of course, all
calls to the tag
would have to use the same value.
License : Use this as you will. If you enjoy it and it helps
your application,
consider sending me something from my Amazon wish list:
http://www.amazon.com/o/registry/2TCL1D08EZEYE
--->
<cfcomponent>
<cffunction name="scope_Cache" access="public"
returntype="string">
<cfargument name="cachename" type="string"
required="yes">
<cfargument name="scope" type="string" required="yes">
<cfargument name="timeout" type="string"
required="yes">
<cfprocessingdirective pageencoding="utf-8">
<!--- allow for quick exit
<cfif isDefined("arguments.disabled") and
arguments.disabled>
<cfexit method="exitTemplate">
</cfif>
<!--- Allow for cachename in case we use cfmodule --->
<cfif isDefined("arguments.cachename")>
<cfset arguments.name = arguments.cachename>
</cfif>--->
<!--- Attribute validation --->
<cfif (not isDefined("arguments.name") or not
isSimpleValue(arguments.name)) and not
isDefined("arguments.clearall")>
<cfthrow message="scopeCache: The name attribute must be
passed as a string.">
</cfif>
<cfif not isDefined("arguments.scope") or not
isSimpleValue(arguments.scope) or not
listFindNoCase("application,session,server",arguments.scope)>
<cfthrow message="scopeCache: The scope attribute must be
passed as one of: application, session, or server.">
</cfif>
<!--- The default timeout is no timeout, so we use the
year 3999. --->
<cfparam name="arguments.timeout"
default="#createDate(3999,1,1)#">
<!--- Default dependancy list --->
<cfparam name="arguments.dependancies" default=""
type="string">
<cfif not isDate(arguments.timeout) and (not
isNumeric(arguments.timeout) or arguments.timeout lte 0)>
<cfthrow message="scopeCache: The timeout attribute must
be either a date/time or a number greather zero.">
<cfelseif isNumeric(arguments.timeout)>
<!--- convert seconds to a time --->
<cfset arguments.timeout =
dateAdd("s",arguments.timeout,now())>
</cfif>
<!--- create pointer to scope --->
<cfset ptr = structGet(arguments.scope)>
<!--- init cache root --->
<cfif not structKeyExists(ptr,"scopeCache")>
<cfset ptr["scopeCache"] = structNew()>
</cfif>
<cfif isDefined("arguments.clearAll")>
<cfset structClear(ptr["scopeCache"])>
<cfexit method="exitTag">
</cfif>
<!--- This variable will store all the guys we need to
update --->
<cfset cleanup = "">
<!--- This variable determines if we run the caching.
This is used when we clear a cache --->
<cfset dontRun = false>
<cfif isDefined("arguments.clear") and arguments.clear
and structKeyExists(ptr.scopeCache,arguments.name) and
thisTag.executionMode is "start">
<cfif
structKeyExists(ptr.scopeCache[arguments.name],"dependancies")>
<cfset cleanup =
ptr.scopeCache[arguments.name].dependancies>
</cfif>
<cfset structDelete(ptr.scopeCache,arguments.name)>
<cfset dontRun = true>
</cfif>
<cfif not dontRun>
<cfif thisTag.executionMode is "start">
<!--- determine if we have the info in cache already
--->
<cfif structKeyExists(ptr.scopeCache,arguments.name)>
<cfif
dateCompare(now(),ptr.scopeCache[arguments.name].timeout) is -1>
<cfif not isDefined("arguments.r_Data")>
<cfoutput>#ptr.scopeCache[arguments.name].value#</cfoutput>
<cfelse>
<cfset caller[arguments.r_Data] =
ptr.scopeCache[arguments.name].value>
</cfif>
<cfexit>
</cfif>
</cfif>
<cfelse>
<!--- It is possible I'm here because I'm refreshing. If
so, check my dependancies --->
<cfif structKeyExists(ptr.scopeCache,arguments.name) and
structKeyExists(ptr.scopeCache[arguments.name],"dependancies")>
<cfif
structKeyExists(ptr.scopeCache[arguments.name],"dependancies")>
<cfset cleanup = listAppend(cleanup,
ptr.scopeCache[arguments.name].dependancies)>
</cfif>
</cfif>
<cfset ptr.scopeCache[arguments.name] = structNew()>
<cfif not isDefined("arguments.data")>
<cfset ptr.scopeCache[arguments.name].value =
thistag.generatedcontent>
<cfelse>
<cfset ptr.scopeCache[arguments.name].value =
arguments.data>
</cfif>
<cfset ptr.scopeCache[arguments.name].timeout =
arguments.timeout>
<cfset ptr.scopeCache[arguments.name].dependancies =
arguments.dependancies>
<cfif isDefined("arguments.r_Data")>
<cfset caller[arguments.r_Data] =
ptr.scopeCache[arguments.name].value>
</cfif>
</cfif>
</cfif>
<!--- Do I need to clean up? --->
<cfset z = 1>
<cfloop condition="listLen(cleanup)">
<cfset z = z+1><cfif z gt 100><cfthrow
message="ack"></cfif>
<cfset toKill = listFirst(cleanup)>
<cfset cleanUp = listRest(cleanup)>
<cfif structKeyExists(ptr.scopeCache, toKill)>
<cfloop index="item"
list="#ptr.scopeCache[toKill].dependancies#">
<cfif not listFindNoCase(cleanup, item)>
<cfset cleanup = listAppend(cleanup, item)>
</cfif>
</cfloop>
<cfset structDelete(ptr.scopeCache,toKill)>
</cfif>
</cfloop>
<cfreturn scope_Cache>
</cffunction>
</cfcomponent>

Hi, thanks to both of you for your help. I reverted back the
custom tag and it was picked up this time - I don't know what
happened before. The functionality works as expected but I have hit
another problem and I am hoping I can tap your combined ColdFusion
wisdom to solve!!
The calendar returns leave records for staff and filters the
records using a querystring variable appended when the user clicks
on a particular month. However, what members of staff the user sees
depends on the data held in the users' session variables based on
their authority. The reason I wanted to use caching is because the
page takes a good ten seconds to run because of the use of cfloops
for the members of staff and the days of the week to dynamically
build the page. Using the custom tag would have worked if all
members of staff saw the same calendar data and could only see one
month. Can you see anyway I can speed up the page and do you think
caching is the way forward here?

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
    Santhosh

    Hi 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

  • Using a custom tag with a 2.3 servlet descriptor BUG?

    Hi,
    I just developed a Custom Tag and I'd like to use in my jsps.
    If I add the jsp in my JDev project with the custom tag when I try to build the project I got this error:
    Error(11): oracle.xml.parser.v2.XMLParseException: Invalid element 'listener' in content of 'web-app', expected elements '[context-param, servlet, servlet-mapping, session-config, mime-mapping, welcome-file-list, error-page, taglib, resource-ref, security-constraint, login-config, security-role, env-entry, ejb-ref]'.
    It seems like when the jsp parser encounters the line with taglib it tries to parse the web.xml against a 2.2 version of the dtd. My web.xml begins with the correct dtd version (2.3). Can anyone tell me if this is a bug and eventually tell me how to solve it?
    thanks,
    Giovanni

    I repost this issue again, now with a simple test case.
    If I wrote a simple custom tag:
    import java.io.IOException;
    import javax.servlet.jsp.tagext.TagSupport;
    public class MyCustomTag extends TagSupport {
    public int doStartTag() {
    try {
    pageContext.getOut().print("FOO");
    } catch (IOException ioe) {
    pageContext.getServletContext().log(ioe.getMessage(),ioe);
    return(SKIP_BODY);
    with the associated tld:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.2</jspversion>
    <shortname>try</shortname>
    <uri>try</uri>
    <info>A short description...</info>
    <tag>
    <name>mytag</name>
    <tagclass>MyCustomTag</tagclass>
    <bodycontent>EMPTY</bodycontent>
    </tag>
    </taglib>
    and a jsp using the custom tag:
    <%@ page contentType="text/html;charset=windows-1252"%>
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
    <TITLE>
    Hello World
    </TITLE>
    </HEAD>
    <BODY>
    <H2>
    The current time is:
    </H2>
    <P>
    <% out.println((new java.util.Date()).toString()); %>
    <%@ taglib uri="try.tld" prefix="try" %>
    <try:mytag />
    </P>
    </BODY>
    </HTML>
    all runs fine if I have a web.xml with the dtd version 2.2
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    but if I use the version 2.3 because I want filters,context listeners and so on:
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <filter>
    <filter-name>FilterRedirector</filter-name>
    <filter-class>org.apache.cactus.server.FilterTestRedirector</filter-class>
    </filter>
    <!-- Filter Redirector URL mapping -->
    <filter-mapping>
    <filter-name>FilterRedirector</filter-name>
    <url-pattern>/FilterRedirector/</url-pattern>
    </filter-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    I get the error I report in my last post. (the jsp doesn't compile) If I remove the custom tag from my jsp all works fine (filters, listeners,etc). In my project settings I use the 2.3 version of servlet.jar instead of the ServletRuntime that comes with JDeveloper.
    Can anyone tell me how to resolve this issue (Using simple custom tag with a web application using the 2.3 servlet specs)?
    Thanks in advance,
    Giovanni
    If I remove the filter secion all

  • Urgent: Unable to run JSP pages(using JRun Custom Tags) in Weblogic 5.1

    Hi,
    I am using JRun Custom tags to bulid JSP pages.
    Could not run the jsp page on Weblogic 5.1.
    I could run the same on JRun Server but not on Weblogic?.
    Had placed JRuntags.jar in the web_inf directory.
    What/where i need to update in properties file?.
    Please reply..
    Best Wishes.
    Satish k.Yalamaddi.

    javax.servlet.ServletException: com/sun/tools/javac/Main (Unsupported major.minor version 49.0)
    This is your problem either your tomcat or eclipse is pointing to a wrong jre
    here the problem is you are trying to run a code that was compiled using j2sdk1.5 in j2sdk1.4

  • Retriving Portlet preference information using a custom tag

    Hi ,
    I am trying to create a custom tag which will be used to retrieve portlet prefrence information (administrative pref, community pref, user pref etc.).
    In the displayTag method i am not able to create the Portlet request object.
    I am getting the IEnvironment reference by calling the method GetEnvironment().
    IEnvironment has methods called currentHTTPRequest() and currentHTTPResponse() which returns IXPRequest and IXPResponse object,
    But to create a portlet context I need HTTPRequest and HTTPresponse.
    If some one is aware of any other method for creating the portlet context from IXPRequest and IXPResponse object. please share as it will be of great help.
    Thanks in advance!!

    Thanks for reply!
    Actualy I am trying to retrieve the Prefernces ( Community Preference, User Preference, Administrative Preference ) values in a custom Tag.
    But I did not find any way in native APIs to retrieve the preferences.
    So I was wondering if somehow I can established a remote session using IDK to retrieve the same.

  • Using a custom tag inside another tag's attribute value?

    Hi all,
    I have a custom tag, mytag:link, whose use currently looks like this:<mytag:link path="/images/logo.gif"/>Nevermind what the tag does. Here's its TLD:<?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.1</tlib-version>
        <jsp-version>1.2</jsp-version>
        <short-name>My custom tags TLD</short-name>
        <tag>
            <name>link</name>
            <tag-class>test.MyLinkTag</tag-class>
            <body-content>empty</body-content>
            <description>...</description>
            <attribute>
                <name>path</name>
                <required>true</required>
                <rtexprvalue>true</rtexprvalue>
            </attribute>
        </tag>
    </taglib>I want to replace the path argument of the mytag:link tag to the result of the evaluation of another tag (a SiteMesh decorator tag) like this:<mytag:link path="<decorator:getProperty property="meta.logo"/>"/>This, of course, doesn't work, as I get the following error:org.apache.jasper.JasperException: /decorator.jsp(34,92) equal symbol expected
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
         org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:193)
         org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:143)
         org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1328)
         org.apache.jasper.compiler.Parser.parseElements(Parser.java:1564)
         org.apache.jasper.compiler.Parser.parse(Parser.java:126)
         org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
         org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.opensymphony.module.sitemesh.filter.PageFilter.applyDecorator(PageFilter.java:156)
         com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:59) If I replace the call to the other tag with
    <mytag:link path="<%=someVariable%>"/>then it all works fine. This behavior seems correct, as the SiteMesh getProperty tag is writing its output to the Writer returned by pageContext.getOut() as it should. As such, this seems to be a design question, then. How are you supposed to do this?
    Thanks in advance,
    Matthew

    Note that I've also posted a question to the SiteMesh user forums about this. It has more information about the motivation of this question.
    See http://forums.opensymphony.com/thread.jspa?threadID=8561
    I'm still looking for an answer, though.
    --matthew                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Cannot use cfx_image custom tag

    While trying to use cfx_image tag I am getting the following error and anyone give me an idea what I am missing?
    Thanks

    Yes there was a problem with bits. I was trying to run a 32bit dll in 64bit CF.
    Fix:
    Rather than reinstalling my CF I gave up using cfx_image tag as I found a better option.
    The builtin CF function ImageResize:
    <!--- This resizes an image to attributes.thumbsize of original size and resize it proportionately to the new width. Notice that the height is blank.--->
            <cfset uploadedImage=ImageNew("#attributes.imagepath#\#photo#")>
            <cfset ImageResize(uploadedImage,"#attributes.thumbsize#","","highestQuality",1)>
    more details about this function can be found at:
    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_h-im_39.html

  • Error using Datalist Custom tag HELP!

    Where can I obtain information for the following error: (IDE is JDeveloper): I have been researching this for 3 weeks without success.
    ERROR: Attribute "source" of tag "DataList" cannot be set with a constant, an expression must be specified.
    CODE WITH PROBLEM
    <!--- *** BEGIN DB CONNECTION --->
    <sql:openConnection driver="com.microsoft.jdbc.sqlserver.SQLServerDriver" url="jdbc:microsoft:sqlserver://SPLSERVER:1433" user="MY_WEB_USERS" password="PASSWORD" id="conn"/>
    <sql:setQuery id="conn" query="select * from schemes order by name" res="colorSchemes"/>
    </sql:setQuery>
    <sql:ifError id="conn">
    <table align="center" width="60%" border="0">
    <tr> <td>
    <br><br> A Connection to the DataBase could not be made!
    </td>
    </tr>
    <tr> <td>
    <br><br> Error Generated: <sql:getError id="conn" />
    </td>
    </tr>
    </table>
    </sql:ifError>
    <sql:ifFound res="colorSchemes">
    <% String Found="OK"; %>
    </sql:ifFound res="colorSchemes">
    <!--- *** END DB CONNECTION --->
    <!--- *** BEGIN TABLE LISTING --->
    <list:DataList source="<%=\"colorSchemes\"%>" type="com.cj.datalist.dbtag">
    <!--- *** DATALIST HEADER SECTION --->
    <list:headerTemplate>
    <TABLE CLASS="TableDouble" border="0" align="center"width="50%">
         <TR>
              <TD BACKGROUND="STYLES/<%= session.getAttribute("MyBkg") %>" ALIGN="center" colspan="5">
         <FONT ALIGN="center" CLASS="<%= session.getAttribute("MyFon") %>16">
    <sql:getCount res="colorSchemes"/>  Available Color Schemes!</FONT>
    </TD>
    </TR>
    <TR>
                   <TD ALIGN="center" WIDTH="25%"     STYLE="border-bottom:solid;border-bottom-width : thin;"
    BACKGROUND="STYLES/<%= session.getAttribute("MyBkg") %>">
         <FONT CLASS="<%= session.getAttribute("MyFon") %>12">Scheme Name</FONT>
                   </TD>
                   <TD ALIGN="center" WIDTH="8%" STYLE="border-bottom:solid;border-bottom-width : thin;"
    BACKGROUND="STYLES/<%= session.getAttribute("MyBkg") %>">
         <FONT CLASS="<%= session.getAttribute("MyFon") %>12">Dark</FONT>
                   </TD>
                   <TD ALIGN="center" WIDTH="8%"     STYLE="border-bottom:solid;border-bottom-width : thin;"
    BACKGROUND="STYLES/<%= session.getAttribute("MyBkg") %>">
         <FONT CLASS="<%= session.getAttribute("MyFon") %>12">Light</FONT>
                   </TD>
                   <TD ALIGN="center" WIDTH="8%" colspan="2"     STYLE="border-bottom:solid;border-bottom-width : thin;"
    BACKGROUND="STYLES/<%= session.getAttribute("MyBkg") %>">
         <FONT CLASS="<%= session.getAttribute("MyFon") %>12">Select </FONT>
                   </TD>
    </TR>
    <FORM ACTION="colors.jsp" METHOD="post" NAME="changecolor">
    </list:headerTemplate>
    <!--- *** DATALIST ITEM SECTION --->
    <list:itemTemplate>
    <TR>
                   <TD CLASS="NoEedge" STYLE="border-bottom:solid;border-bottom-width : thin;">
         <FONT CLASS="F10">
                   <%=CURRENT_OBJECT.getColumn(2)%>
                   </FONT>
         </TD>
                   <TD CLASS="LeftEdge" STYLE="border-bottom:solid;border-bottom-width : thin;"
    bgcolor="<%=CURRENT_OBJECT.getColumn(4)%>">
         <FONT class="F10"> </FONT>
    </TD>
                   <TD CLASS="LeftEdge" STYLE="border-bottom:solid;border-bottom-width : thin;"
    bgcolor="<%=CURRENT_OBJECT.getColumn(5)%>">
         <FONT class="F10"> </FONT>
    </TD>
                   <TD CLASS="LeftEdge" STYLE="border-bottom:solid;border-bottom-width : thin;">
         <input TYPE="Button" NAME="DarkButton" VALUE="Dark" ONCLICK="SetBkg('Dark');">
    </TD>
                   <TD CLASS="LeftEdge" STYLE="border-bottom:solid;border-bottom-width : thin;">
         <input TYPE="Button" NAME="Light" VALUE="Light" ONCLICK="SetBkg('Light');">
    </TD>
    <input TYPE="Hidden" NAME="ccsfile" VALUE="<%=CURRENT_OBJECT.getColumn(3)%>">
    <input TYPE="Hidden" NAME="dark_d" VALUE="<%=CURRENT_OBJECT.getColumn(6)%>">
    <input TYPE="Hidden" NAME="dark_l" VALUE="<%=CURRENT_OBJECT.getColumn(7)%>">
    <input TYPE="Hidden" NAME="DarkValue" VALUE="">
    <input TYPE="Hidden" NAME="LightValue" VALUE="">
    <input TYPE="Hidden" NAME="update" VALUE="1">
    </TR>
    </list:itemTemplate>
    </FORM>
    <!--- *** DATALIST FOOTER SECTION --->
    <list:footerTemplate>
    </TABLE>
    </list:footerTemplate>
    </list:DataList>

    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.
              

  • How do I configure portal desktop to use my own custom tag in template?

    I seem to have tried everything. I want to use a custom tag from a jar file on a template JSP. I keep getting error saying tag library not found. I have the tld in the meta-inf of the jar. I tried putting the jar in the desktop classes, the deployed WEB-INF lib directory for portal, in the web-src directory for the portal. I tried configuring the uri in the web.xml for the portal webapp. None of these have worked. Does someone know how to do this? If someone could help out that would be great. I tries the jar from a web application and it worked fine. I just need to get this working with Portal Server.
    Thanks,
    Frank

    Thank you for the reply Alex. We are using the Dynamics AX 2012 R3 ISO for our installation. In the software requirement documentation for Dynamics AX it says that is able to run on Windows Server 2012 R2. I believe the prerequisites for Dynamics AX and
    Dynamics CRM are different. We received a response from another forum that you can change the .NET version that Sharepoint 2010 uses through IIS in the application pool, but even after setting it to .NET v2.0, we still receive the error in the Dynamics log
    that says it is not compatible with .NET v4.0. So I suppose the question is, where does the Dynamics AX 2012 R3 prerequisite checker look to see which version of .NET Sharepoint is using?
    Thanks again for the reply!

  • How can I use evaluate to get the instance variable in customized tag

    1.
    At first , I create a class called bean,and declared several params in it and do not define any getter function for the param.
    class bean{
    String param = "test";
    SomeClass scObj = new SomeClass();
    2.
    The second ,I use
    request.setAttribute("beanObj",new bean());
    3.
    And then I wanna use the customized tag to show a text box , then initialize it's value.
    <salt:text name="param" value="beanObj.param">
    <salt:text name="obj" value="beanObj.scObj.func()">
    4.
    I tried the evaluator provided by JexlContext ,Struts, JSTL and it seems that if I do not define the getter for the variable ,I can not get the bean's instance variable's value.
    Expression e = ExpressionFactory.createExpression( value );
    JexlContext jc = JexlHelper.createContext();
    jc.getVars().put(strInitBeanName, request.getAttribute("beanObj"));
    Object obj = e.evaluate(jc);
    the result of the obj is null....
    Can anybody recommand some other evaluator can get the value of a instance variable from an object?

    do you have any other suggestion ? Nops, somebody else may have though. AFAIK, all lookups of the type
    beanName.propertyNameuse reflection on the getXXX() methods to access the property.
    Having said that, I guess you could write one though in a custom tag, using the same - reflection (you will ahve to rely on the java.lang.reflect.Field class quite heavily) - but that would be reinventing the wheel for most other functionality that you would have to include (like looking up the bean in scope etc)
    cheers,
    ram.

  • How to use Custom Tags for Theme and Base Map Definitions

    In Mapviewer documentation I've found the following new feature:
    The XML definition of a theme or base map now supports application-specific
    attribute tags. You can use the Custom Tags option in the theme definition in Map
    Builder to specify tags and their values, which can be interpreted by your application
    but are ignored by MapViewer itself.
    I'm able to define a custom tag in Mapbuilder, but how can I use it in my Application?
    Thanks.

    As he said, you have to use as Platform service to create adapter in OIM.
    tcUserOperationsIntf service = Platform.getService(Thor.API.Operations.tcUserOperationsIntf.class);
    HashMap<String,String> searchmap=new HashMap<String,String>();
    searchmap.put("Users.User ID", userID);
    tcResultSet searchset=service.findAllUsers(searchmap);

  • Error Using Custom Tag

    I am trying to use a custom tag but receive an error when I use it on a jsp page.
    I have a tag handler class file, tag library descriptor file, specified the path to the .tld in the web.xml file.
    The error implies that it cannot find the SimpleTag.class file, though I put it in the \webapps\examples\WEB-INF\classes\ directory.
    Here is the error. Does anyone know what else it could be?
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    C:\jakarta-tomcat-4.0.1\work\localhost\examples\jsp\jspVisual\ch10\using_0005ftag$jsp.java:63: Class org.apache.SimpleTag not found.
    SimpleTag_jspx_th_myFirstTag_SimpleTag_0 = new SimpleTag();

    I could not see any obvious mistakes. But what you could try, in order to isolate the problem, is to bypass the web.xml. In other words access the TLD directly by doing this in your JSP
    <%@ taglib uri="/WEB-INF/jsp/tag_library_descriptor.tld" prefix="myFirstTag" %>
    if that does work then move the your TLD out of the jsp folder and into WEB-INF , then try
    <%@ taglib uri="/WEB-INF/tag_library_descriptor.tld" prefix="myFirstTag" %>
    Maybe someone else has better idea.

  • IllegalStateException using custom tag

    I'm receiving the following exception when trying to use a custom tag we are developing to allow us to provide localized content based on the users browser language/country settings:
         java.lang.IllegalStateException: WEB3025: Cannot reset after response has been committedThe thing is - the tag works perfectly when the page is using JSP includes:
         <jsp:include page="/components/headers/global.jsp" />but we get the exception when using our tag:
         <core:localizedInclude page="/components/headers/global.jsp" />and we make a call to our servlet:
         <jsp:forward page='/servlet/MyServlet' />Here is the line in the custom tag Java code that pulls in the file:
         pageContext.include(localizedPage);Any ideas what we can do to fix this? What are the differences between the <jsp:include> and our <core:LocalizedInclude> in this case?
    Bob

    The pagecontext 's include method flushes the buffer before a call to this method. This means the call to your tag from the jsp should be the first line in your jsp as headers have to be set first before writing any html response.
    Here's the relevant javadoc.
    blah..blah..
    The current JspWriter "out" for this JSP is flushed as a side-effect of this call, prior to processing the include.
    blah..blah..You could try the overloaded pageContext.include("path", false) which according to javadoc
    blah..blah..
    If flush is true, The current JspWriter "out" for this JSP is flushed as a side-effect of this call, prior to processing the include. Otherwise, the JspWriter "out" is not flushed.
    blah..blah..cheers,
    ram.

  • Navigate using custom tag

    Hello folks,
    I am trying to navigate to a servlet from a jsp using the navigate() javascript method. Within the method I am using a custom tag to supply the web context root. If I use request.getContextPath() everything is fine, but if I use the custom tag (which is what I want), I get an "Object Expected" error. Code snippet below. Any help would be appreciated.
    <SCRIPT type="text/JavaScript">
       function doSomething() {
          navigate('<context:GetWebContextRoot/>/servlet/framework.components.LogonControllerServlet?command=logoff');
    </SCRIPT>

    If <context:GetWebContextRoot/> is indeed a
    JSP tag , what is it doing inside a javascript
    string? Put it outside the single quotes (and add it
    to the js string), otherwise it won't be processed by
    the server.Tried that already,
    navigate(<context:GetWebContextRoot/> + '/servlet/framework.components.LogonControllerServlet?command=logoff');here is the resulting source:
    navigate(/MyApp  '/servlet/framework.components.LogonControllerServlet?command=logoff');Same error.

  • Connection Pooling and JSP Custom Tag Library - is code (inside) the best way/correc?

    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>
    * &lt;name>connection&lt;/name>
    &lt;tagclass>com.solved.tag.dbtags.connection.ConnectionTag&lt;/t
    agclass>
    * &lt;bodycontent>JSP&lt;/bodycontent>
    &lt;teiclass>com.solved.tag.dbtags.connection.ConnectionTEI&lt;/t
    eiclass>
    * &lt;info>Opens a connection based on a jndiName.&lt;/info>
    * &lt;attribute>
    * &lt;name>id&lt;/name>
    * &lt;required>true&lt;/required>
    * &lt;rtexprvalue>false&lt;/rtexprvalue>
    * &lt;/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>
    * &lt;name>closeConnection&lt;/name>
    &lt;tagclass>com.solved.tag.dbtags.connection.CloseConnectionTag&
    lt;/tagclass>
    * &lt;bodycontent>empty&lt;/bodycontent>
    * &lt;info>Close the specified connection. The "conn"
    attribute is the name of a
    * connection object in the page context.&lt;/info>
    * &lt;attribute>
    * &lt;name>conn&lt;/name>
    * &lt;required>true&lt;/required>
    * &lt;rtexprvalue>false&lt;/rtexprvalue>
    * &lt;/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

Maybe you are looking for