load classes to jsp page
This is my first thread in this forum and i hope to find the answer for my question.
I have a code consistes of one class containing many sub-classes:
public class TstClass
public class tst1
public class tst2
and i want to call one of these classes in jsp page, how could this be done?
I'm using Tomcat 6.0 amd JDK 1.6
Thank you in advance to any one would help me in this issue :)
jsp pages talk to beans. Its not clear if your classes are proper beans.
Do you get the proper Tomcat hello page?
It is done while using Beans
<%@ page language="Java" %>
<jsp:useBean id="test" scope="request" class="TstClass" />
<jsp:setProperty name="test" property="*" />
<%=test.<your method in the TestClass>%>
Yes i got Tomcat hello page
I've tried this way and it doesn't work.
Originally Posted by serjant
what i need is to call the subclasses like "tst1, tst2" and creat objects from these subclasses in my jsp page like:
tst1 obj = new tst1
So what do you think?
Use scriptlet! and don't forget to import the class by :
<%@ page import="package.class" %>
you can use scriptlet this way:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import="package.myclass" %>
<% myclass m=new myclass();