You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by ffffffffffb8ffffffffffdf ffffffffffb5ffffffffffc f?= <ja...@yahoo.com.cn> on 2004/08/06 08:30:10 UTC

can i call a java class in jstl?

in fact i want to execute some java code automaticly
when i open the jsp page.but i don't want to write the
code in the jsp and i wrap it in a class,can i use
jstl to call this class in the jsp page and execute
the code automaticly?

_________________________________________________________
Do You Yahoo!?
美女明星应有尽有,"一搜"搜遍美图、艳图和酷图
http://image.yisou.com
 
100兆邮箱够不够用?雅虎电邮自助扩容!
http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/

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


Re: can i call a java class in jstl?

Posted by Helios Alonso <ha...@atg.com.uy>.
Sorry, myMethod only executes if it's some bean property accesor, otherwise 
it's an error (EL is for bean evaluation, only, at least in a <c:out>).  So 
the bean constructor approach is the working one.

At 10:27 11/08/2004 +0800, you wrote:
>  --- Helios Alonso <ha...@atg.com.uy> µÄÕýÎÄ£º
> > In the first case, the code must be in "myMethod",
> > in the second the code
> > must be in the constructor (or in a static block
> > inside the class ;-) but
> > constructor would be nicer)
> >
> > At 15:32 09/08/2004 +0800, you wrote:
> > >if i use ${myUseBean.myMethod} or
> > ><jsp:useBean id="aux" scope="page"
> > >class="MyCallingBean" />,is the code in class will
> > >execute automaticly when i open the page?
> >
> >
> >
> >
>---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > taglibs-user-help@jakarta.apache.org
> >
> >
>
>thx,that's just what i want to know,hehe.
>
>_________________________________________________________
>Do You Yahoo!?
>150ÍòÇúMP3·è¿ñËÑ£¬´øÄú´³ÈëÒôÀÖµîÌÃ
>http://music.yisou.com/
>ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ
>http://image.yisou.com
>1G¾ÍÊÇ1000Õ×£¬ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡
>http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org



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


Re: can i call a java class in jstl?

Posted by ffffffffffb8ffffffffffdf ffffffffffb5ffffffffffc f?= <ja...@yahoo.com.cn>.
 --- Helios Alonso <ha...@atg.com.uy> 的正文:
> In the first case, the code must be in "myMethod",
> in the second the code 
> must be in the constructor (or in a static block
> inside the class ;-) but 
> constructor would be nicer)
> 
> At 15:32 09/08/2004 +0800, you wrote:
> >if i use ${myUseBean.myMethod} or
> ><jsp:useBean id="aux" scope="page"
> >class="MyCallingBean" />,is the code in class will
> >execute automaticly when i open the page?
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 
>  

thx,that's just what i want to know,hehe.

_________________________________________________________
Do You Yahoo!?
150万曲MP3疯狂搜,带您闯入音乐殿堂
http://music.yisou.com/
美女明星应有尽有,搜遍美图、艳图和酷图
http://image.yisou.com
1G就是1000兆,雅虎电邮自助扩容!
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/

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


Re: can i call a java class in jstl?

Posted by Helios Alonso <ha...@atg.com.uy>.
In the first case, the code must be in "myMethod", in the second the code 
must be in the constructor (or in a static block inside the class ;-) but 
constructor would be nicer)

At 15:32 09/08/2004 +0800, you wrote:
>if i use ${myUseBean.myMethod} or
><jsp:useBean id="aux" scope="page"
>class="MyCallingBean" />,is the code in class will
>execute automaticly when i open the page?



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


Re: can i call a java class in jstl?

Posted by michael <mi...@michaelmcgrady.com>.
At 06:46 AM 8/6/2004, you wrote:
>i use
>jstl to call this class in the jsp page and execute
>the code automaticly?


Just make your own tag.




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


Re: can i call a java class in jstl?

Posted by ffffffffffb8ffffffffffdf ffffffffffb5ffffffffffc f?= <ja...@yahoo.com.cn>.
if i use ${myUseBean.myMethod} or 
<jsp:useBean id="aux" scope="page"
class="MyCallingBean" />,is the code in class will
execute automaticly when i open the page?

 --- Steve Lewis <sm...@lordjoe.com> �����ģ�
> 
> I thing the modern approach is a custom tag -
> Custum functions are OK but are restricted to static
> methods. It is not 
> easy to give these functions access to the page
> context. Custom tags have 
> access to  this data.
> 
> At 05:29 AM 8/6/2004, you wrote:
> 
> >Or make a bean that calls the code on its creation
> and
> ><jsp:useBean id="aux" scope="page"
> class="MyCallingBean" />
> >
> >At 08:05 06/08/2004 -0400, you wrote:
> >>Another option is to put the code into a servlet
> and use
> >><jsp:include page="whatever_the_servlet_URL_is"/>
> >>
> >>
> >>
> >>
> >>Thai DANG wrote:
> >>>Hi
> >>>This is my suggestion : you put all your code in
> a method of your bean 
> >>>MyUseBean.java (for example public void
> getMyMethod() {})
> >>>Then, simply put in your JSP :
> ${myUseBean.myMethod}
> >>>
> >>>On Fri, 6 Aug 2004 14:30:10 +0800 (CST)
> >>>�ffffffffffb8�ffffffffffdf
> �ffffffffffb5�ffffffffffc f?= 
> >>><ja...@yahoo.com.cn> wrote:
> >>>
> >>>>in fact i want to execute some java code
> automaticly
> >>>>when i open the jsp page.but i don't want to
> write the
> >>>>code in the jsp and i wrap it in a class,can i
> use
> >>>>jstl to call this class in the jsp page and
> execute
> >>>>the code automaticly?
> >>>>
>
>>>>_________________________________________________________
> >>>>Do You Yahoo!?
> >>>>��Ů����Ӧ�о��У�"һ��"�ѱ���ͼ����ͼ�Ϳ�ͼ
> >>>>http://image.yisou.com
> >>>>100�����乻�����ã��Ż������������ݣ�
>
>>>>http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/
> >>>>
>
>>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> >>>>For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> >>>
>
>>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> >>
> >>
>
>>---------------------------------------------------------------------
> >>To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> >
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 
>  

_________________________________________________________
Do You Yahoo!?
150����MP3����ѣ������������ֵ���
http://music.yisou.com/
��Ů����Ӧ�о��У��ѱ���ͼ����ͼ�Ϳ�ͼ
http://image.yisou.com
1G����1000�ף��Ż������������ݣ�
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/

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


Re: can i call a java class in jstl?

Posted by Steve Lewis <sm...@lordjoe.com>.
I thing the modern approach is a custom tag -
Custum functions are OK but are restricted to static methods. It is not 
easy to give these functions access to the page context. Custom tags have 
access to  this data.

At 05:29 AM 8/6/2004, you wrote:

>Or make a bean that calls the code on its creation and
><jsp:useBean id="aux" scope="page" class="MyCallingBean" />
>
>At 08:05 06/08/2004 -0400, you wrote:
>>Another option is to put the code into a servlet and use
>><jsp:include page="whatever_the_servlet_URL_is"/>
>>
>>
>>
>>
>>Thai DANG wrote:
>>>Hi
>>>This is my suggestion : you put all your code in a method of your bean 
>>>MyUseBean.java (for example public void getMyMethod() {})
>>>Then, simply put in your JSP : ${myUseBean.myMethod}
>>>
>>>On Fri, 6 Aug 2004 14:30:10 +0800 (CST)
>>>ÿffffffffffb8ÿffffffffffdf ÿffffffffffb5ÿffffffffffc f?= 
>>><ja...@yahoo.com.cn> wrote:
>>>
>>>>in fact i want to execute some java code automaticly
>>>>when i open the jsp page.but i don't want to write the
>>>>code in the jsp and i wrap it in a class,can i use
>>>>jstl to call this class in the jsp page and execute
>>>>the code automaticly?
>>>>
>>>>_________________________________________________________
>>>>Do You Yahoo!?
>>>>ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬"Ò»ËÑ"ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ
>>>>http://image.yisou.com
>>>>100Õ×ÓÊÏä¹»²»¹»Óã¿ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡
>>>>http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>


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


Re: can i call a java class in jstl?

Posted by Helios Alonso <ha...@atg.com.uy>.
Or make a bean that calls the code on its creation and
<jsp:useBean id="aux" scope="page" class="MyCallingBean" />

At 08:05 06/08/2004 -0400, you wrote:
>Another option is to put the code into a servlet and use
><jsp:include page="whatever_the_servlet_URL_is"/>
>
>
>
>
>Thai DANG wrote:
>>Hi
>>This is my suggestion : you put all your code in a method of your bean 
>>MyUseBean.java (for example public void getMyMethod() {})
>>Then, simply put in your JSP : ${myUseBean.myMethod}
>>
>>On Fri, 6 Aug 2004 14:30:10 +0800 (CST)
>>ÿffffffffffb8ÿffffffffffdf ÿffffffffffb5ÿffffffffffc f?= 
>><ja...@yahoo.com.cn> wrote:
>>
>>>in fact i want to execute some java code automaticly
>>>when i open the jsp page.but i don't want to write the
>>>code in the jsp and i wrap it in a class,can i use
>>>jstl to call this class in the jsp page and execute
>>>the code automaticly?
>>>
>>>_________________________________________________________
>>>Do You Yahoo!?
>>>ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬"Ò»ËÑ"ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ
>>>http://image.yisou.com
>>>100Õ×ÓÊÏä¹»²»¹»Óã¿ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡
>>>http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org



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


Re: can i call a java class in jstl?

Posted by Don Albertson <da...@pennswoods.net>.
Another option is to put the code into a servlet and use
<jsp:include page="whatever_the_servlet_URL_is"/>




Thai DANG wrote:
> Hi
> 
> This is my suggestion : you put all your code in a method of your bean MyUseBean.java (for example public void getMyMethod() {})
> Then, simply put in your JSP : ${myUseBean.myMethod}
> 
> 
> On Fri, 6 Aug 2004 14:30:10 +0800 (CST)
> ÿffffffffffb8ÿffffffffffdf ÿffffffffffb5ÿffffffffffc f?= <ja...@yahoo.com.cn> wrote:
> 
> 
>>in fact i want to execute some java code automaticly
>>when i open the jsp page.but i don't want to write the
>>code in the jsp and i wrap it in a class,can i use
>>jstl to call this class in the jsp page and execute
>>the code automaticly?
>>
>>_________________________________________________________
>>Do You Yahoo!?
>>ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬"Ò»ËÑ"ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ
>>http://image.yisou.com
>> 
>>100Õ×ÓÊÏä¹»²»¹»Óã¿ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡
>>http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 


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


Re: can i call a java class in jstl?

Posted by Thai DANG <th...@goochi.net>.
Hi

This is my suggestion : you put all your code in a method of your bean MyUseBean.java (for example public void getMyMethod() {})
Then, simply put in your JSP : ${myUseBean.myMethod}


On Fri, 6 Aug 2004 14:30:10 +0800 (CST)
ÿffffffffffb8ÿffffffffffdf ÿffffffffffb5ÿffffffffffc f?= <ja...@yahoo.com.cn> wrote:

> in fact i want to execute some java code automaticly
> when i open the jsp page.but i don't want to write the
> code in the jsp and i wrap it in a class,can i use
> jstl to call this class in the jsp page and execute
> the code automaticly?
> 
> _________________________________________________________
> Do You Yahoo!?
> ÃÀÅ®Ã÷ÐÇÓ¦Óо¡ÓУ¬"Ò»ËÑ"ËѱéÃÀͼ¡¢ÑÞͼºÍ¿áͼ
> http://image.yisou.com
>  
> 100Õ×ÓÊÏä¹»²»¹»Óã¿ÑÅ»¢µçÓÊ×ÔÖúÀ©ÈÝ£¡
> http://cn.rd.yahoo.com/mail_cn/tag/100m/*http://cn.promo.yahoo.com/minisite/100m/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 

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