tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kin-man Chung <Kin-Man.Ch...@Sun.COM>
Subject Re: tag plugin
Date Tue, 23 Aug 2005 21:30:20 GMT
The method generateBody() is meant to "continue to generate
codes for body of the tag, as usual".  What you want is a method
to "generate codes to get the body content", which is certainly
doable, but is not currently available.  You are welcome to have
the first crack at extending the plugin framework if you like.  It'll
require invoking pushBody(), generateBody(), then popBody() to get the
body content, similar to the codes that are being generated for
fragments.  But I don't think you really need it though.

Attributes are much simpler, they are just expressions.

BTW, your English is just fine: no apologies needed.  :-)

-Kin-man

On Tue, 2005-08-23 at 02:33, wing lee wrote:
> Thanks for all your help.
>  
> But I still have questions :-). I know that the body content of the tag is the runtime
entity. I think the value of some attributes is also runtime entity, if its value can be EL.
The method generateAttribute can generate the code in the generated x_jsp.java file which
returns the dynamic value of the attribute. So I can write such code to get the dynamic value
in the x_jsp.java file:
>  
>     //in jsp file
>     <c:out value="${xxx}/">
>     //in the tag plugin file
>     ctxt.generateJavaSource("String s = (String)");
>     ctxt.generateAttribute("value");
>     ctxt.generateJavaSource(";");
>  
> The generated code is:
>  
>     String s = (String) (Object)
>              org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate
>              ("${xxx}", java.lang.Object.class, (PageContext)
>              _jspx_page_context, null, false);
>  
> But if I write such code:(just for example)
>  
>     //the jsp file
>     <c:out value="asd">${xxx}</c:out>
>     //in the tag plugin file
>     ctxt.generateJavaSource("String s = (String)");
>     ctxt.generateBody();
>     ctxt.generateJavaSource(";");
>  
> the generated code is:
>  
>     String s = (String) out.write((Object)
>              org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate
>              ("${xxx}", java.lang.Object.class, (PageContext)
>              _jspx_page_context, null, false));
>  
> and this code's syntax is wrong.
>  
> I think that there should be a method to provide the functionality similar to the one
of the generateAttribute which doesn't output the "out.write" source code, so that I can use
the body content in the generated file x_jsp.java.
>  
> I am not so good at English so perhaps my expression is not very clear. Sorry about that.

> 
> 
> 		
> ---------------------------------
> DO YOU YAHOO!?
>   雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message