pravin suroshe

Greenhorn
+ Follow
since Jan 13, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by pravin suroshe

Hi all,

I am using package in my servlets, the folder structure for the same package looks like the following:
D:Servlets\Mypackage\coreservlets

in coreservlets directory, I have two folders as, Application and Helpers

in Application folder I have the following servlet code:

package coreservlets.Application;

import coreservlets.Helpers.ServletUtilities;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.PrintWriter;

public class HelloWWW3 extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response. getWriter();
out.println(ServletUtilities.headWithTitle("Hello WWWW")+"<body>Hello</body></html>");
}
}


in Helpers folder I have the following servlet code:

package coreservlets.Helpers;
public class ServletUtilities
{
public static String headWithTitle(String title)
{
return ("<html><head><title>"+title+"</title></head>");
}
}


Settings in web.xml is as follows:

<servlet>
<servlet-name>HelloWWW3</servlet-name>
<servlet-class>HelloWWW3</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>HelloWWW3</servlet-name>
<url-pattern>/HelloWWW3</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>ServletUtilities</servlet-name>
<servlet-class>ServletUtilities</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ServletUtilities</servlet-name>
<url-pattern>/ServletUtilities</url-pattern>
</servlet-mapping>


I am using Tomcat 5.0 server, and for coding purpose I am using IntelliJIdea 3.0.5

when I compile these two programs it creates folder structure as coreservlet\Application\HelloWWW3.class and coreservlet\Helpers\ServletUtilities.class in C:\Tomcat 5.0\webapps\Mysite\WEB-INF\classes path....that is ok!!!

I run servlet in Internet Explorer as http://localhost:8080/Mysite/coreservlets.HelloWWW3
I have also tried http://localhost:8080/Mysite/Application.HelloWWW3
but, it's not working by giving me error as "The requested resource (/Mysite/coreservlets.HelloWWW3) is not available."

Could anyone explain me what I am doing wrong..???...

Thanx in advance
Pravin
20 years ago
Hi all,
Could anyone explain me what is the difference between Interface and abstract class?

Thanx in advance.
20 years ago
Hi all,
can anyone send me the link from where I candownload the Java Servlet API.

Thanx
20 years ago
Thanx Hareesh, it was really good explaination, and looking forward your help in future also.
Hi all,
Could anyone explain me, what is the difference between Statement, Prepared Statement, and CallableStatement. I have read one thing that, Prapared Statements are precompiled statements, what does it mean?

Any help would be appreciated.
Thanx in advance.
Hi all,

What is the difference between Hashset, Hashmap, Hashtable?

Thanx in advance.
20 years ago
Hi all,
I am new to java tech. Can anyone explain me the difference between Enumeration and Iterator, when should I use enumeration and when Iterator. Any help would be appreciated.

Thanx in advance.
20 years ago
Hi all,
I am new to Java Tech., can anybody explain me how stack and heap works in Java for memory allocation.

Thanx in advance
20 years ago