Forums.Sureshkumar.net : A Perfect Place to Share Knowledge         Blogs     Games    Magazines    

"Sharing knowledge does not lessen your store, often it gets you more. Sharing plays a key role in relationships and bonding, happens in small steps and is assisted through community membership."

Go Back   SURESHKUMAR.NET FORUMS > TECHNICAL DISCUSSIONS > JAVA Technologies
Register FAQ Members List Calendar Games Blogs Search Today's Posts Mark Forums Read

   

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 08-05-07, 11:19 PM   #1 (permalink)
Junior Member
 
Join Date: Nov 2006
Posts: 20
Thanks: 6
Thanked 0 Times in 0 Posts
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 3 viskat is on a distinguished road
Servlet Execution !!

Hey Guys,

Kindly tell me how to execute a Servlet i.e. where to save it, where to run it, how and what to deploy, etc,etc,etc,.......

Thanx.
viskat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-05-07, 10:59 PM   #2 (permalink)
Junior Member
 
kris_121's Avatar
 
Join Date: Feb 2007
Age: 26
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 kris_121 is on a distinguished road
Re: Servlet Execution !!

Hi Viskat,
First of all, you need to have a servlet class(Ex: servlEx). Once you are done, follow the below mentioned steps:
-> Create a directory(Ex: xyz or abc)
->Create a WEB-INF directory in that directory(in xyz or abc)
->Open WEB-INF directory and create a folder with the name classes
->copy and paste the servlet class(servlEx) in classes directory
->create a web.xml file using notepad or wordpad.
In web.xml file, the following tags has to be mentioned:
webapp
servlet
servlet-name /servlet-name(name can be anything of your chioceEx: myservlet)
servlet-class /servletclass(servlEx, in our example)
/servlet
servlet-mapping
servlet-name /servlet-name(same name should be givem Ex: myservlet)
url-pattern /url-pattern(Ex: /servletexample)
/servlet-mapping
/web-app

Now, copy whole directory(xyz, in our example) to the server.
The directory or path varies depending on the web server you are using.
If you are using Tomcat, the following procedure is followed:
place the xyz directory in $HOME$/webapps(C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps), If you are using any other server, read the documentation provided with the web server.
Start the Web Server and
Open the Internet Explorer or any web browser(Netscape or Mozilla), and type URL as http://localhost:8080/xyz/servletexample if the server is on localhost and on default port. If it is on network and have different port, relevant ip and port number has to be mentioned.

Any questions, kindly let me know

Regards,
Kris
kris_121 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-05-07, 08:45 PM   #3 (permalink)
Junior Member
 
Join Date: Nov 2006
Posts: 20
Thanks: 6
Thanked 0 Times in 0 Posts
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 3 viskat is on a distinguished road
Displaying Servlet Code !!

Hey I am using WebLogic Server.

When I run the servlet on the browser, it displays the servlet code(class)
on the browser page.

What to do???????
viskat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-05-07, 09:44 PM   #4 (permalink)
Junior Member
 
kris_121's Avatar
 
Join Date: Feb 2007
Age: 26
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 kris_121 is on a distinguished road
Re: Servlet Execution !!

What is the version of your weblogic and browser as well?
kris_121 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-05-07, 03:54 AM   #5 (permalink)
Junior Member
 
Join Date: Nov 2006
Posts: 20
Thanks: 6
Thanked 0 Times in 0 Posts
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 3 viskat is on a distinguished road
Re: Servlet Execution !!

I am using weblogic 8.1 and Mozilla Browser

Thanx.
viskat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 13-05-07, 01:38 AM   #6 (permalink)
Junior Member
 
kris_121's Avatar
 
Join Date: Feb 2007
Age: 26
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 kris_121 is on a distinguished road
Re: Servlet Execution !!

Have you tried using in other browsers like Internet Explorer..coz there could be a browser specific issue..
kris_121 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 14-05-07, 12:54 PM   #7 (permalink)
Junior Member
 
Join Date: Nov 2006
Posts: 20
Thanks: 6
Thanked 0 Times in 0 Posts
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 3 viskat is on a distinguished road
Re: Servlet Execution !!

Thank you Kris.
viskat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 14-05-07, 01:04 PM   #8 (permalink)
Moderator
 
t_mohan's Avatar
 
Join Date: Apr 2006
Location: India
Posts: 636
Thanks: 57
Thanked 78 Times in 63 Posts
Thanks: 57
Thanked 78 Times in 63 Posts
Rep Power: 17 t_mohan is a splendid one to behold t_mohan is a splendid one to behold t_mohan is a splendid one to behold t_mohan is a splendid one to behold t_mohan is a splendid one to behold t_mohan is a splendid one to behold t_mohan is a splendid one to behold
Re: Servlet Execution !!

Hey Viskat,

No, its not a browser specific issue, whatever the browser or whatever the server version it may be if u have deployed ur web appn correctly it has to work

Do one thing man, check ur servlet mapping in the web.xml , i assume your servlet class and servlet mapping are not defined well in web.xml.

Your servlet is working the way as it is a HTML page, only HTML pages comes like that since there is no need of defining them in the web.xml .

The server is not able to interpret ur servlet, and it is jus taking like an HTML, define the servlet properly in ur web.xml

or jus gimme ur servlet name and also attach ur web.xml over here, i'll try to resolve it

Let me know your questions

Thank You,
__________________
M0h@n
t_mohan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 15-05-07, 03:19 AM   #9 (permalink)
Junior Member
 
Join Date: Nov 2006
Posts: 20
Thanks: 6
Thanked 0 Times in 0 Posts
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 3 viskat is on a distinguished road
Re: Servlet Execution !!

Hi Mohan,

Thanx for responding. I have executed the doGet() method without using an html file. Its working fine. But am facing problems executing the doPost() method independent of the html file.

Below is the web.xml file that i have created and the servletname is "MyServlet" :


----!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"

----web-app

display-name--My Web Assignment--/display-name

servlet
servlet-name--MyServlet--/servlet-name
servlet-class--MyServlet--/servlet-class
/servlet

servlet-mapping
servlet-name--MyServlet--/servlet-name
url-pattern--/MyServlet/*--/url-pattern
/servlet-mapping

----/web-app


Kindly tell me whether is this correct or not ??
And also tell me, do we need to edit the web.xml file for each and every servlet??

Thanx.
viskat is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Leadership in Execution AjayKumar.Kataram Inspire yourself & Others - Leaders Zone 0 07-04-07 09:23 PM
J2EE - What is the difference between servlet context and servlet config preethisingh Java Interview / Technical Questions 1 24-01-07 07:03 PM
NJ IndiaInvest Pvt Ltd : Java servlet and PHP sridhar FRESHER JOBS 1 19-09-06 06:25 PM
CA vista Other Queries 2 14-04-06 02:49 AM
servlets naga JAVA Technologies 1 21-02-06 01:40 PM


All times are GMT +6.5. The time now is 03:13 PM.





Search Engine Optimization by vBSEO 3.1.0