You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Richa Oberoi <ri...@newgen.co.in> on 2000/03/03 06:06:52 UTC

Problem assigning values to attributes in Tag !!!

hi !
    i am having a problem here while trying to make my own tag 
this tag is similar to the example FooTag given, now the tag i made works fine if i give constant values in all the scripting variables that is the values of the attributes which i supply in my JSP

now how to i send value of any variable in those attributes ??????
if i write something like this
<eg:FolderSearch folderName="<%= folderName %>">

where folderName is any variable then it compiles ok but does not take the value of variable folderName instead it takes a null value 

and if i specify something like this

<eg:FolderSearch folderName=folderName >

it gives a compilation error saying 

org.apache.jasper.compiler.ParseException: /Orionwebscreens/FolderSearchRes_Sessionless.jsp(517,35) Attribute value should be quoted
	at org.apache.jasper.compiler.JspReader.parseToken(Compiled Code)
	at org.apache.jasper.compiler.JspReader.parseAttributeValue(Compiled Code)
	at org.apache.jasper.compiler.JspReader.parseTagAttributes(Compiled Code)
	at org.apache.jasper.compiler.Parser$Tag.accept(Compiled Code)
	at org.apache.jasper.compiler.Parser.parse(Compiled Code)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:1002)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:998)
	at org.apache.jasper.compiler.Compiler.compile(Compiled Code)
	at org.apache.jasper.runtime.JspLoader.loadJSP(Compiled Code)
	at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(Compiled Code)
	at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(Compiled Code)
	at org.apache.jasper.runtime.JspServlet.serviceJspFile(Compiled Code)
	at org.apache.jasper.runtime.JspServlet.service(Compiled Code)
	at javax.servlet.http.HttpServlet.service(Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.handleInvocation(Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(Compiled Code)
	at org.apache.tomcat.core.ContextManager.service(Compiled Code)
	at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Compiled Code)
	at org.apache.tomcat.service.TcpConnectionThread.run(Compiled Code)
	at java.lang.Thread.run(Compiled Code)

so how do i send values to attributes ???? 


RE: Problem assigning values to attributes in Tag !!!

Posted by Kevin Jones <ke...@develop.com>.
Richa,


the tag has to be marked as rtexprvalue in the tld file, so - 

<attribute>
    <name>foo</name>
    <required>true</required>
    <rtexprvalue>true<rtexprvalue/>
</attribute>

Kevin Jones
DevelopMentor

> -----Original Message-----
> From: Richa Oberoi [mailto:richa@newgen.co.in]
> Sent: 03 March 2000 05:07
> To: Tomcat
> Subject: Problem assigning values to attributes in Tag !!!
> 
> 
> hi !
>     i am having a problem here while trying to make my own tag 
> this tag is similar to the example FooTag given, now the tag i made
> works fine if i give constant values in all the scripting variables that
> is the values of the attributes which i supply in my JSP
> 
> now how to i send value of any variable in those attributes ??????
> if i write something like this
> <eg:FolderSearch folderName="<%= folderName %>">
> 
> where folderName is any variable then it compiles ok but does not take
> the value of variable folderName instead it takes a null value 
> 
> and if i specify something like this
> 
> <eg:FolderSearch folderName=folderName >
> 
> it gives a compilation error saying 
> 
> org.apache.jasper.compiler.ParseException:
> /Orionwebscreens/FolderSearchRes_Sessionless.jsp(517,35) Attribute value
> should be quoted
> 	at org.apache.jasper.compiler.JspReader.parseToken(Compiled
> Code)
> 	at
> org.apache.jasper.compiler.JspReader.parseAttributeValue(Compiled Code)
> 	at
> org.apache.jasper.compiler.JspReader.parseTagAttributes(Compiled Code)
> 	at org.apache.jasper.compiler.Parser$Tag.accept(Compiled Code)
> 	at org.apache.jasper.compiler.Parser.parse(Compiled Code)
> 	at org.apache.jasper.compiler.Parser.parse(Parser.java:1002)
> 	at org.apache.jasper.compiler.Parser.parse(Parser.java:998)
> 	at org.apache.jasper.compiler.Compiler.compile(Compiled Code)
> 	at org.apache.jasper.runtime.JspLoader.loadJSP(Compiled Code)
> 	at
> org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(C
> ompiled Code)
> 	at
> org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(Compiled
> Code)
> 	at org.apache.jasper.runtime.JspServlet.serviceJspFile(Compiled
> Code)
> 	at org.apache.jasper.runtime.JspServlet.service(Compiled Code)
> 	at javax.servlet.http.HttpServlet.service(Compiled Code)
> 	at
> org.apache.tomcat.core.ServletWrapper.handleInvocation(Compiled Code)
> 	at org.apache.tomcat.core.ServletWrapper.handleRequest(Compiled
> Code)
> 	at org.apache.tomcat.core.ContextManager.service(Compiled Code)
> 	at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(C
> ompiled Code)
> 	at org.apache.tomcat.service.TcpConnectionThread.run(Compiled
> Code)
> 	at java.lang.Thread.run(Compiled Code)
> 
> so how do i send values to attributes ???? 
> 
>