Click to See Complete Forum and Search --> : Function defining in jsp
QuickSilver002
01-04-2005, 04:27 PM
I'm trying to program a recursive function into my web page using jsp, but I can't figure it out. I guess I could make a utilities class with a function that returns a string of HTML and put the class in the classpath of Tomcat, but I'd like the function to be defined in the same jsp file. Does anyone know how to define a function is jsp? If so, could you post a simple example?
Khalid Ali
01-04-2005, 04:36 PM
a function in jsp should be as simple as writing one in a class you just have to insert the function in between the tags
<%
%>
now from your question it seems like you want this function to ouput html...if thats the case then you will have to make sure that you don't have to take input from user at any stage.
Now there is an even bigger concern here, that is using scriptlets in JSP pages is not a recomended practice in Java programming at all.
QuickSilver002
01-04-2005, 05:11 PM
My end goal is to make a collapsable menu that reflects a heirarchy of folders on the server drive. The recursion is for the creation of the menu. I had planned on using a scriplet to handle the expanding and collapsing of the menu. Is there a better way?
Khalid Ali
01-04-2005, 06:01 PM
what you can do with a scriptlet you can just as well do with a server side class...