File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes calling core java(normal) classes from servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

calling core java(normal) classes from servlets

jay thakkar
Greenhorn

Joined: Mar 15, 2013
Posts: 9
hi pals.... i m new to java n i m trying a thing n stuck up ...

i am trying to call method of normal class from within servlets.. i know this is possible so here is what i did..

LoginForm.java



SimplyHello.java // compilation error

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class SimplyHello extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res)throws IOException,ServletException
{
LoginForm fl = new LoginForm();
fl.getLoginForm();
}
}

both the files are in
cd c:\program files\apache-tomcat-7.0.39\webapps\root
directory..


as public classes are availabe to members of package i shouldnt get compilation error


the error message i get is
SimplyHello.java:10: error: cannot find symbol
LoginForm fl = new LoginForm();
^
symbol: class LoginForm
location: class SimplyHello
SimplyHello.java:10: error: cannot find symbol
LoginForm fl = new LoginForm();
^
symbol: class LoginForm
location: class SimplyHello
2 errors

jay thakkar
Greenhorn

Joined: Mar 15, 2013
Posts: 9
please give an example of how it is done..

if path of any file is to be changed.. please mention.... thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

Your build classpath is missing the classes. I've moved this to the Beginning Java forum where build and classpath issues are best discussed.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jay thakkar
Greenhorn

Joined: Mar 15, 2013
Posts: 9
bear bibeault bro if you know what is the problem then you could have explained me instead of leaving it on others ot explain

i mentioned to give detailed explaination of the problem... you could have explained "build classpath" to me...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

jay thakkar wrote:i mentioned to give detailed explaination of the problem

Everyone here is a volunteer, myself included.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38348
    
  23
jay thakkar wrote:bear bibeault bro if you know what is the problem then you could have explained me instead of leaving it on others ot explain
. . .
There is no need to be rude, thank you very much.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7640
    
  19

jay thakkar wrote:i mentioned to give detailed explaination of the problem...

No you didn't; and it's a bit early on in your membership to be dictating to people how they should help you.

This site is not in the practise of simply handing out answers. We much prefer to guide people to their own, which is exactly what Bear was trying to do.

If you have any further questions, I suggest you read the HowToAskQuestionsOnJavaRanch (←click) page first.

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11229
    
  16

jay thakkar wrote:bear bibeault bro if you know what is the problem then you could have explained me instead of leaving it on others ot explain. i mentioned to give detailed explaination of the problem... you could have explained "build classpath" to me...

1) Maybe Bear doesn't know (although I would bet he does)
2) Maybe Bear didn't have time, because he was too busy trying to explain our rules/policies to members who don't take the time to learn how we do things here.
3) Maybe that is not Bear's (or any other moderator's) job.
4) Maybe your "detailed explaination (sic)" wasn't as detailed or as clear as you think.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38348
    
  23
This correspondence now closed.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calling core java(normal) classes from servlets