Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP, Java Beans, and classes  RSS feed

 
Pete Albano
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a JavaServer page call a regular class, or do I have to create Java Beans to work with JSP?
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to javaranch Pete.
No, you can call any java class from a jsp/servlet. That's the advantage of using java technology. It is automatically added to your classpath by the servlet container if you place your class under the WEB-INF directory.
HTH
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must import your class first.
<%@ page import="java.util.ArrayList" %>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where your confusion may arise, is that to use a class via the <jsp:usebean> tag, it must follow (at least some of) the bean pattern.
However, for java classes that you are going to use in JSP scriptlets, any class can be used as has already been pointed out.
hth,
bear
[ August 24, 2003: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!