Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to call user defined class from jsp

 
hanumanth reddy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

my problem is the i want to create an instance of my own class
as the java class obbject instance can be created by the
placing <% Date dt= java.util.Date() %>
but how to create the instance of my own class
thanks in advance
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly the same, but put the full package name of your own class instead.
 
hanumanth reddy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you very much but my class is not in the package it is the class just then where should i place the class and if a place the package where should i place the package

once again thanking you in advance
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your class is called MyClass, then use (for example):

or any other valid Java.
All that is required is that the class is available in the classpath used by the servlet container.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When starting with JSP I found that it helped alot to look at the Java code the JSP engine turns out and compare it with the JSP code you wrote. The java.sun.com web site has a very handy JSP technology syntax document in .pdf form you can keep around to remind you of the syntax.
 
hanumanth reddy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you william but where to set the path for the userdefined class Using the javawebserver2.0
i will be very glad if u can give the exact classpath to set

looking for ur response at the earliest
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where to put the class depends on how you set up the application directory - for example on my Tomcat installation, classes that are not in a package and are used by servlets in the default application are in:
c:\tomcat\webapps\ROOT\WEB-INF\classes
The WEB-INF\classes directory structure is required by
the servlet 2.2 specifications - Sun is trying to standardize the directory structure for server applications. Given the confusing directory setup for JRun, I say more power to them.
WBB
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic