How to start
Hi,
I am new to Servlets.But little bit well in java.
I have J2EE 1.4.But I donot know how to start servlets.
If I read the tutorials ,all are little bit difficult to follow.So I am in a position
that i cannot proceed further.
Will you please help me how to get the basic,how to understand that and how to run a simple servlet in J2EE.?That will very helpful to proceed further.
Thank you so much.
download tomcat.. there are samples of servlet and jsp's on tomcat..
to run servlets u must have your web server....tomcat would b the best for study purposes.. once you do that. it has to be configured on your system.... u can then use the examples present there
hi,
i am writing it in points
(I) First of all , before starting servlet programming try to know more abt
the tools required .probably, the things required are a web browser(for
sending a request) and a tomcat server (to handle the requests that are
sent by the web browser)
(ii) The things to know abt tomcat include what type of programs can be run on a tomcat server.(probably JSP,Servlets)
(iii) Which packages to use for handling servlets(u can find API in sun site)
(iv) installation of tomcat server
(v) properly setting the class path . the reason y i am saying this point
is i suffered a lot for setting the classpath. but finally i managed some how.
(vi) now , start learning y servlets have been developed. how can we use them and important thing to know is the life cycle of the servlet.
Thorough learning of the lifecycle will help u in understanding the background scenario of how servlet execution takes place .
(vii) now , u learn in how many ways u can create a servlet program and which is the best efficient technique to use .
(viii) Start writing small programs using the best technique(probably the
best technique is by extending HttpServlet class available in javax.servlet.http package )
i hope u understand what i have written .
if u feel any diffuculty in servlet programming , just post a message.
i will be regularly checking this site.
regards
Hi,
Thank you so much for your reply.
I have some doubt.
1.Web browser,web server ok than what is the meaning of the next line.
(iii) Which packages to use for handling servlets(u can find API in sun site).Will you please explain me some more?
2.I already have J2EE 1.4 in my pc.
Is it enough to learn servlets? or I have to get Tomcat?
If tomcat is necessary can I install it in the same machine?.
becuase I am in a doubt that in the same machine two servers(Java App server,Tomcat) I have to met some class path problems,port problems.Will you please give some lines to clarify?
3.Why these are all little bit difficult to follow.Last three days i confused with that how to start,what softwares needed,how to learn like that.
very sorry for so many questions.
Thank you so much.
In java, for example if we want to design a GUI , we use AWT package.
The AWT package contains button class, textfield class,so on . if we want to use a button we just create an object of button class(like
for example Button b1=new Button("Send")).Similarly, for designing
servlet applications we use some built in classes that are present in
javax.servlet.* package and javax.servlet.http.* package. this is what i was saying in the third point. For more information about what methods and classes are there in that package(above two) please visit sun site.
if u dont find i will send u the link.
u must require a tomcat server to run servlet applications. the main reason is that servlets are nothing but server side applications.
another reason u require tomcat is that it contains jar files of SERVLET and JSP api's .the two packages i told earlier are present in servlet-api jar file.U can find those jar files in Tomcat5.0\common\lib . check it out after installing tomcat in ur system.
u must install tomcat in the same machine.
though u have two servers, it is not a problem , it is better to use
tomcat server because u are new to servlets.
dont worry once u write one application, u will be very much comfortable with servlets(because i also had the same problems when i was new to servlets )
waiting for ur reply
Hi,
thank you so much for your reply.
I alreday go through javax.servlet.* and javax.servlet.http packages.I understand little bit well.
So if I download and install Tomcat ,Need I install any servlet related softwares,like Java Servlet Development Kit? other wise you told that servlets jar files are alreday in Tomcat so I have to set the path for that jar files. Will you please explain me something about this?
Thank you so much for your reply and your encourgement.
after installing tomcat .class path must be set properly , otherwise we get a compile time error saying that no servlet.http.* package found.
i will show an example how to set class path.
u have to set these in my computer ( in properties ( in advanced (Environment variables)) )
(I) user variables
CATALINA_HOME
C:\Apache Group\Tomcat 4.1
JAVA_HOME
C:\j2sdk1.4.2_03
(II) System variables
classpath
C:\j2sdk1.4.2_03\lib\tools.jar;C:\Apache Group\Tomcat 4.1\common\lib\servlet.jar;
JAVA_HOME
C:\j2sdk1.4.2_03;
the above is an example. ur paths may be different because ur tomcat
may be anywhere(i.e either C or D drive ). set according to that.
i hope it works fine and i hope u understand what i have written
regards,
Hi,Thank you so much for your reply.I keep all the steps in mind.It will very helpful for me to set all without error.Thank you.
HiI also have another doubt that why all are prefer Tomcat for servlets? learn with J2EE is difficult? or anything else?Thank you
hi , How r u. how is everything going on. regards