i am in a doubt of
is it possible to call
a java class in servlet?,actualy this is what i am
doing but i dotn have any idea onto is this possible or not?
i have created 4 things
first html page which calls
jsp page in which i am calling my Servlet
and in my servlet i have placed code which calls
one java class and forwards to another Jsp
i am getting another JSp but my java class is not called
may be all this sounds a bit confusing all
in all what i am trying to achieve is
calling Servlet from JSP passing parameters
to Servlet and
from Servlet passing parameters
to my Java class which connects to the databse
and saves the user input in table
below is my code can anyone help me
onto what i am doing does it go in right direction?
i dont know bcoz i am not gettng data passed by user
in the table
below is my servlet code as well as java class
code for test servlet
code for Connect.java class
please if anyone can help me on above
it will be great thanks in advance......
Dhwani:Its always too soon to quit.
[ January 11, 2008: Message edited by: Bear Bibeault ]
Is the doGet method called? Is the if-condition true or false? If it is true, what happens then? Does the code in the constructor run? As it is, there's no way to check whether that's the case or not, so how have you established that it's not running?
i am sorry Ulf Dittmer for such a confusing code
actualy i have created a JSP from which i am calling
this Servlet and also doGet method is called bcoz i
have used it in my JSP .
i think Sudhir is right bcoz how will the main
method be called ?i was wrong but now i have made
those changes but still i am not getting my data
in the database table
is there any changes i must make
in web.xml so as to include java class in that servlet
please any help on above will be great
thanks in advance.
actualy i have created a JSP from which i am calling this Servlet and also doGet method is called bcoz i have used it in my JSP.
I don't understand what you mean by this. You don't "call" a servlet from a JSP - do you mean forward, or include, or redirect?
Furthermore, the doGet method is not used in a JSP. (To be more precise, one is being created behind the scenes by the servlet container, but there is none in the JSP, nor would your code use it.)
Indeed, main methods have no meaning in servlet containers, and won't be called.
i think Sudhir is right bcoz how will the main method be called?
No. Your class will be used if the code is being called properly. That's why I asked the various questions above. Answering those will help us pinpoint the problem.
is there any changes i must make in web.xml so as to include java class in that servlet
Also, how is the servlet being called - with which URL, and which parameters?
you are absolutly right i have used redirect() in My JSP below is the code for it
Testing.jsp gets the values from html page using request.getParameter method
in my html i pass three values firstname ,email and password
test is the name of my Servlet
below is code for it
below is my code for Connect.java which connects to database and inserts value in table
Now i dont know where i am going wrong ?
here is code for web.xml
any help on above will be realy great
thanks in advance
Dhwani:>Swimmers never weep.
Answer them all to the best of your ability.
If you don't understand one of his questions, let him know so he can re-phrase it.
Originally posted by dhwani mathur:
... method is called bcoz i have used it ...
Please use real words when posting to the forums. Abbreviations such as "bcoz" in place of "because" only serve to make your posts more difficult to read and less likely to generate useful responses.
Please read this for more information.
I do have a suggestion to you. I know you are into the beginning level of Servlets and JSP. And i have been seeing a couple of posts from you in the very basic stuff which certainly shows that you lack in the *fundamental concepts* of the technologies.
Better spend some time and read the concepts clearly. Once you understand the basic working model of the technologies, you yourself will get rid of the small issues.