Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Problem in accessing the class methods

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

I'm using a applet and java class files in my application including the servlet. The database connection and the sql querys are written on a standard java class file. I'm going to host all the files in the same server. Now what i need is i need the servlet and the applet to access the java class file methods and also i need the applet to access the methods which are written in the servlet. Please let me know is it possible and also let me know how to do this.

If you know any other solutions please let me know.
Thanks in advance
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sutharshan wrote
also i need the applet to access the methods which are written in the servlet



Which methods of servlet do you want to access? If the method has some business logic you can move it out of servlet into a java class. Its not a great idea to create an instance of the servlet class and invove some method on it.
Please revert back and give some more details of your requirements so that we can work out on some approach.
 
Sutharshan bala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry for the error in the post friend.

I need the servlet and the applet to access the java standard class methods in the same server, which contains the database details.

Also i want to check the user login details in applet, but i cant use session inside applet. So i need to check the session in jsp or servlet and pass that to applet via a method. Hope the problem is clearly explained now.

Give me some idea and sampLe code to handle this issue.

Thanks in advance
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Server side classes are kept under WEB-INF, a directory that is not accessible to your client side code. This means that you can't use the copy of a class file for both the client and server.

You might need to make copies of the classes that are needed by your applets and place them in a directory that is accessible to the web.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic