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
Similar Messages
-
Using a custom Viewstack inside another gives an error
Hi, can anybody tell me why using two custom ViewStacks components inside one another I get this (workspace log) error?
"Custom component model has recursive definition: components.ViewStack"
My component ViewStack.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:ViewStack xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%">
</mx:ViewStack>
MyApplication.mxml
<c:ViewStack id="views" >
<c:ViewStack id="mainViews2" >
</c:ViewStack>
</c:ViewStack>
Any combination involving the real mx:ViewStack works fine.
Using FlashBuilder 4.5
ThanksThank you. This did the trick
package components {
import mx.containers.ViewStack;
public class ViewStack extends mx.containers.ViewStack {
public function ViewStack() {
super();
percentWidth = 100;
percentHeight = 100; -
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? -
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 -
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,
GiovanniI 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 -
Use jsp tag output as another tag's attribute value
I don't know anyone has ever tried this, one tag's attribute value needs to be dynamically set using another tag's output. Something like
<layout:grid cols="<layout:write name="element" property="value"/>'' space='false'>
</layout:grid>
I want the cols attribute of grid tag to be the output of <layout:write name="element" property="value"/>
The way I wrote is of course not working.
But I know PHP can do things similar to this, JSP should be able to achieve something like this too.
If anyone knows how to do this or using any alternative way to do this, please let me know.
Shanesomething like this...
OuterTag qParent = null;
try {
Tag myParent = getParent();
while (myParent != null ) {
// loop up through tags until you find the one you want
if (myParent instanceof OuterTag) {
qParent = (OuterTag) myParent;
data = qParent.getSomeData();
} else {
myParent = myParent.getParent();
} -
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. -
Assigning bean property to custom tag's attribute
1. The #{beanName.property} notation can only be used inside JSF tags.
2. The attributes of custom tags does not accept embedded tags.
e.g. <prefix:tagName attrib1="<jsftag>">
I need to assign a bean's property to the attrib1 attribute. how do I do this?Alternatively, how can I assign the value of a bean property to a variable?
e.g.
<%
int var=<bean.property>
%>
I can use the variable on the custom tag like this:
<prefix:tagName attrib1="<%=var%>"> OR
But this may not be the best solution though because I have to use scriptlets... -
Custom Tag and Attribute Not Found
Hi,
I've been getting an error with the following code in a JSP called cardDeclined.jsp...
<gwps:log level="ERROR" message="<%= request.getAttribute("errorMessage") %>" />gwps:log is a custom tag and errorMessage is a request attribute set in a servlet that includes my JSP. When I execute the program, I get a message from the servlet container (Tomcat 3.2.3) stating that "attribute 'errorMessage' has no value".
I wrote some test code that dumps out "errorMessage"; that seemed to work. The JSP request object has a value for "errorMessage." So, I now use the following workaround...
<% String message = (String)request.getAttribute("errorMessage"); %>
<gwps:log level="ERROR" message="<%= message %>" />I'm looking for a reference describing how request and session variables can be passed to the custom tag
Thanks,
CWI think you might be having a problem with the quotes. Try this instead:
<gwps:log level="ERROR" message='<%= request.getAttribute("errorMessage") %>' />
Notice the single quotes around the scriptlet. -
Custom tag losing onchange value when page is refreshed
Hi all,
I'm still using JSF 1.1 and I have an issue with a custom tag. When my page is first displayed, the onchange attribute contains my script but, when I refresh the page it's not there anymore. The custom tag if an input for dates. It can have of to 4 dropdown list, year, month, day and time.
Any idea what I might be doing wrong?
ThanksVerify that the custom component saves the value of the onchange attribute in its state (see UIComponent.saveState() and UIComponent.restoreState()).
-
How to use one hash table inside another hash table
Hi everyone,
Any example of hash table inside another hash table.
Can one here help me how to write one hash table inside another with repeating keys for the first hash table.
Thanks,
kanty.Do you mean you want the 'value' entries in a hash table to themselves be hash tables? Easy but this often indicates a design flaw.
Hashtable<String,<Hashtable<String,Value>> fred = new Hashtable<String,<Hashtable<String,Value>> ();But what do you mean by "with repeating keys for the first hash table"?
Edited by: sabre150 on Jul 2, 2010 10:11 PM
Looks like you have already handled the declaration side in your other thread. I suspect you should be writing your own beans that hold the information and these beans would then be stored in a Map. The problem I have is that your description is too vague so I can't be certain. -
UIX table tag's attribute VALUE is missing in jdev 10g production
In JDeveloper 10g preview, I handled my table's navigation manually and need to set the table's tag attribute VALUE in order to keep the record range.
However, when i convert my project to JDeveloper 10g Production, eventhought the page is still working fine, but in the design windows will show that the uix page is in invalid state and I found that the attribute VALUE is no more supported.
Could anyone please help me and let me know how do i set back my record range? Thanks!It turns out that you're running into a bug that will be fixed in the soon to be released version of JDev 10g. The good news is that it's a design time bug, so your pages will still work at runtime. You can even fix the bug yourself if you want. In JDEV_HOME\jlib there is uix2-schemas.zip. Inside of that is ui/table.xsd.
Add the below attribute definition inside of the complex type for the table, and you should be all set.
<attribute name="value" type="ui:unsignedIntExpressionType" default="1"/>
Hope this helps,
Ryan Pollock
UIX Team -
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?
ThanksYes 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.
Maybe you are looking for
-
Songs don't show up in Windows Live Messenger after itunes 7.0.1 update
The topic line pretty much says it all. I've checked the settings in Messenger. I'm not sure the songs are supposed to show up in Messenger from itunes, but they always have and I like that feature. Since updating itunes from 7.0 to 7.0.1 this featur
-
Tried all the suggestions but still aint working PLEASE HELP!!
I got my nano in january but it hasnt been turning on for about a month. Its fully charged and sometimes makes a beeping noise when it plugged into the computer. Two icons keep appearing a folder with a ! mark and a black and white battery. Ive tried
-
I have adobe acrobat pro xi and im doing encrypting end same pdf after encrypt has damege
i have adobe acrobat pro xi and im doing encrypting end same pdf after encrypt has damege / i re install the adobe acrobat but it's not help / i up date to and it's not help . what to do?
-
Hi, I have a JInternalFrame and I want to display a list of objects (eg. Member) and a checkbox next to them. Members are drawn dinamically from db. The format must be something like this: member.toString() <checkbox> member.toString() <checkbox> mem
-
Ios 5 notifications - does it work on iphone 4?
I've managed to download ios5 on to my iPad1 and iPhone 4. Dos the Notification feature only work on the new iPhone 4S?