You can write a Method in JSP as below if you don't have any concern of
using scriptlets.
<%!
     String toPrint;
     public string function()
       {

           return "Hello World";
       }
%>

...
.....
<%
      toPrint = function();
%>
<TD> <%=toPrint%> </TD>

Thanks and Regards
Maria

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED] On Behalf Of Prat
Sent: Friday, April 08, 2005 11:25 AM
To: JSP-INTEREST@JAVA.SUN.COM
Subject: Spam: Function call using variables

I am trying to call a Java Bean function from my JSP. I need to call
this
dynamically. Would appreciate any inputs.

Here is what I am trying to do :

<%
   String temp = "FunctionName()"; // Ofcourse what I am doing is not
this
straight forward but I would eventually have a string that is a function
name similar to this.
%>
   <TD><%=temp%></TD> -This, I know is wrong since it would print the
string. But what I would like it to do is call the function FunctionName
(). I need it to do something similar to eval. Any inputs on the
approach
please?

Thanks,
Prat

========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly
prohibited and may be unlawful.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to