Java Techies - Solution for All
Java Techies - Solution for All
| Client Side | Server Side |
|---|---|
| Client Side programs run on the user's computer. | Server side codes are executed in server and result is displayed in web browser as HTML. |
| Client Side programming is less secure. | Server-side scripts are more secure than client-side. |
| The code which is run on the user's computer using scripts like Javascript can or may be blocked. | Server-side scripting does not have any limitation of any browser. |
javax.servlet and javax.servlet.http packages provide interfaces and classes for writing servlets.
| Method | Description |
|---|---|
void init(ServletConfig config) |
Called the when Servlet is initialized or created. Web Container calls the init method exactly once after instantiating the Servlet. An UnavailableException is thrown if the servlet cannot be intialized. |
public ServletConfig |
Returns ServletConfig object. |
public void service(ServletRequest req,
|
Called by the Web Container to allow the servlet to respond to a request. Parameters: Object of ServletRequest(req) that contains the client's request and Object of ServletResponse(res)that contains the servlet's response. An IOException is thrown if IO problem occurs. |
String getServletInfo() |
Returns a String containing information about Servlet. |
public void destroy()
|
Called when the servlet is unloaded (being taken out of service method). Happens during web-container shut down. |
| Method | Description |
|---|---|
String getInitParameter(String name)
|
Returns a String which contains the value of the initialization parameter and name which defines names of initialization parameter. |
Enumeration getInitParameterNames() |
Returns Enumeration of String objects containing the names of all initialization parameters. |
public ServletContext getServletContext() |
Returns the reference of ServletContext. |
| Method | Description |
|---|---|
void log(String s)
|
It writes the specified message to a servlet log file. |
void log(String s, Throwable e) |
It writes an explanatory message and a stack trace for a given Throwable exception to the servlet log file. |
| Method | Description |
|---|---|
protected void doGet( |
Called by the server through service() to allow a servlet to handle a GET request. Parameters: Object HttpServletRequest(req) that contains the request the client has made of the servlet. Object of HttpServletResponse(resp) that contains the response the servlet sends to the client |
protected void doPost(
|
Called by the server through service() to allow a servlet to handle a POST request. Parameters: Object of HttpServletRequest(req) that contains the request the client has made of the servlet. Object of HttpServletResponse that contains the response the servlet sends to the client. |
protected long getLastModified(
|
Returns last modified time in miliseconds. |
protected void doHead( |
|
protected void doPut( |
Called by the server to allow a servlet to handle a PUT requests. Parametrs: Object of HttpServletRequest(req)that contains the request the client made of the servlet. Object of HttpServletResponse(resp) that contains the response the servlet returns to the client. |
protected void doTrace(
|
Called by the server to allow a servlet to handle a TRACE request. |
protected void service(
|
Receives standard HTTP and responds by calling doXXX() method defined in the servlet. |
doOptions protected void doOptions( |
Called by the server to allow a servlet to handle a OPTIONS request. |
| HttpServlet | GenericServlet |
|---|---|
| HttpServlet defines a HTTP protocol specific servlet. | GenericServlet defines a generic, protocol-independent servlet. |
| It inherit generic servlet class. | It implements servlet interface. |
| It use doGet and doPost method instead of service. | It use service method. |
Explore the world of open-source software with Groovy Grails!
— Har Narayan (@har_narayan44) December 6, 2025
Check out their collection of amazing open-source projects and get inspired to contribute or start your own project!
Visit: https://t.co/LYNd8Cs3N7
#OpenSource #GroovyGrails #SoftwareDevelopment #Innovation"


