f



JSP page access regular Java class (non-Java bean)

I am new to JSP. But most of the time people say JSP page access Java
Bean classes.
I want to know what if I want to access regular Java classes?? Should
I do like this
in the code:
<%
	NormalJavaClass cl = new NormalJavaClass();
	cl.process();
%>

<%-- JSP page access Java Bean -- %>
<jsp:useBean scope="session" id="formDataBeanObj"
class="formdatatest.FormDataBean"/>
<jsp:setProperty name="formDataBeanObj" property="*"/>

<HTML>
<HEAD>
<TITLE>page1.jsp</TITLE>
<BODY>
<FORM METHOD="POST" ACTION="page2.jsp">
	<H2>User Name = <jsp:getProperty name="formDataBeanObj"
property="username"/></H2>
<%
	NormalJavaClass cl = new NormalJavaClass();
	cl.process();
%>

<P><INPUT TYPE="SUBMIT" VALUE="submit here">
</FORM>
</BODY>
</HTML>


Please advise. Thanks!!
0
jrefactors (362)
5/25/2004 1:52:50 AM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

2 Replies
545 Views

Similar Articles

[PageSpeed] 43

> I am new to JSP. But most of the time people say JSP page access Java
> Bean classes.
> I want to know what if I want to access regular Java classes??

Import the class with a <%@ page import="com.yourcompany.yourclass" %> tag,
and put your class in the server's classpath (usually context\WEB-INF\lib).
Then use it just like you use the core classes.


KC


0
my1558 (106)
5/25/2004 2:47:04 AM
KC Wong wrote:
>>I am new to JSP. But most of the time people say JSP page access Java
>>Bean classes.
>>I want to know what if I want to access regular Java classes??
> 
> 
> Import the class with a <%@ page import="com.yourcompany.yourclass" %> tag,
> and put your class in the server's classpath (usually context\WEB-INF\lib).
> Then use it just like you use the core classes.
> 
> 
> KC
> 

WEB-INF\lib is for jars, WEB-INF\classes is for classes.

0
no18 (4537)
5/30/2004 3:17:42 PM
Reply: