Class javax.servlet.http.HttpServlet

javax.servlet.GenericServlet | 
+----javax.servlet.http.HttpServlet

public abstract class HttpServlet
extends GenericServlet
An abstract class that simplifies writing HTTP servlets. It extends the GenericServlet base class and provides an framework for handling the HTTP protocol. Because it is an abstract class, servlet writers must subclass it and override at least one method. The methods normally overridden are:
  • doGet, if HTTP GET requests are supported. Overriding the doGet method automatically also provides support for the HEAD and conditional GET operations. Where practical, the getLastModified method should also be overridden, to facilitate caching the HTTP response data. This improves performance by enabling smarter conditional GET support.
  • doPost, if HTTP POST requests are supported.
  • doPut, if HTTP PUT requests are supported.
  • doDelete, if HTTP DELETE requests are supported.
  • The lifecycle methods init and destroy, if the servlet writer needs to manage resources that are held for the lifetime of the servlet. Servlets that do not manage resources do not need to specialize these methods.
  • getServletInfo, to provide descriptive information through a service's administrative interfaces.
Notice that the service method is not typically overridden. The service method, as provided, supports standard HTTP requests by dispatching them to appropriate methods, such as the methods listed above that have the prefix "do". In addition, the service method also supports the HTTP 1.1 protocol's TRACE and OPTIONS methods by dispatching to the doTrace and doOptions methods. The doTrace and doOptions methods are not typically overridden.

JSP Element Type

Directive:
<%@   %>
e.g
page directive 
<%@ page import=”abc.* session=””false”   %>
A page directive can use up thirteen different attributes
        1.  import
        2. isTheadsafe
        3. contentType
        4. isELIgnored
        5. isErrorPage
        6. errorpage
        7. language
        8. extends
        9. session
       10.buffer
       11. autoFlush
       12. info
       13. pageEncoding
taglib directive
<%@ taglib tagdir=”/WEB-INF/tags/krrish prefix=””krrish” %>
include directive
<%@ include file=”krrish.html” %>
Declaration:
             <%!     %>
Scriptlet:
            <%    %>
Expression:
          <%=     %>
EL Expression:
            $(   )
e.g
email:$(application.mail)
Action:
Standard  action
<jsp:include  page=”abc.jsp”>abc</jsp>
e.g

  • jsp:include 
  • jsp:param
  • jsp:forward
  • jsp:plugin
  • jsp:fallback
  • jsp:getProperty  
  • jsp:setProperty
  • jsp:useBean
Other action
<c:set var=”rate” value=”32”/>

Clocks



CASE-1: Find an Angle between hands:      
 Angle between minute hand and hour hand of an clock in 1 minute= 6 degree
Angle between minute hand and hour hand of an clock in 60 minute i.e in 1hr= 360 degree
CASE-2:When hands will Coincide:
Initially at  time 00:00 minute hand and hour hand makes  0deg(zero degree) angle.and when minute hand completed 60minutes and hour hand completed only 5 minutes i.e in 60minutes i.e in 1hr minute hand is 55minutes (60-5=55) more than hr hand.so we can say that in 1hr minute hand gains 55minutes over hr hands.
If we want to find that when minute hand and hour hand will coincide each other between t1 and t2 time( we considering 12hrs  time format not 24hrs time format ).
where t1=1,2,3...11 and t2=t1+1
Then D=5*t1 minutes
Coinciding minutes CM= D*(12/11) minuts past t1
And hand will concide at D*(12/11) minuts past t1.
e.g1
Question: At what time between 2 and 3 o’clock will the hands of a clock be together?
Sol:
  here t1=2
so D=5*t1=5*2=10 minutes
Coinciding minutes=D*(12/11)minutes past t1
                                  =10*(12/11) minutes past 2
                                  = 10*(12/11)minutes past 2
e.g2
Question: At what time between 1:30 and 2:30 o’clock will the hands of a clock be together?
Sol:
We know that minute hand and hour hand will not meet  between 1:30 and     2 o’clock they will meet after 2 o’clock i.e between 2 and 3 o’clock the the question is same  as e.g1
CASE-3: when hands make a particular angle.
If we want to find that when minute hand and hour hand will make angle A between t1 and t2 time( we considering 12hrs  time format not 24hrs time format ).
t1=1,2,3...11 and t2=t1+1 
Then D=5*t1 minutes
           T1= D-(A/6)
           T2= D+(A/6)
    Angle making time AMT=T*(12/11)minutes past t1.
i.e  AMT1= T1*(12/11)minutes past t1
and AMT2= T2*(12/11) minutes past t1

e.g1
Question: At what time between 4 and 5 o’clock wil the hands of a clock be at right angle(i.e 90degree angle)?
Sol:
Here  t1=4,t2=5,A=90degree
          D=5*4=20
T1=D-(A/6)=20-(90/6)=5
And T2=D+(A/6)=20+(90/6)=35
So AMT1=T1*(12/11) minutes past t1
                =5*(12/11)minutes past 4
And AMT2 =T2*(12/11) minutes past t1
                =35*(12/11)minutes past 4

e.g2 
Question: At what time between 4:30 and 5:30 o’clock wil the hands of a clock be at right angle(i.e 90degree angle)?

sol:
 find the right angle between 4 and 5 'oclock and take a time of 4:30.then find right angle between 5 and 6o'clock  and take time before 5:30.

           

   

An important proof

Let
 Cost Price=cp
Selling price=sp
Case-I
If we sell one thing on x% gain then 
sp1=[(100+x)*cp]/100
 and  now the purchaser  of this thing  sells it on  x% loss 
then  sp2=[(100+x)*cp]/100-[(100+x)*cp*x]/(100*100 )
where   [(100+x)*cp*x]/(100*100 )=x% of sp1(i.e loss)
or sp2=[{(100+x)*cp}/100][1-x/100]
now  net  loss or gain=cp-sp2= -(x*x*cp)/(100*100)


(-)ve sign tells that we  incur loss
     so  net loss %=[(cp-sp2)*100]/cp= (x*x)/( 10*10)

Case-II
 If we sell one thing on x% loss and then 
 purchaser  of this thing  sells it on  x% gain
then from same process of  Case-I 
   net loss % =(x*x) / 10*10


Example:
If  actual cost of a thing is cp.and we purchase it from seller by giving him x% loss.Then selling price for that seller is sp and this sp is cp for us.now we sell it on gain of x% of this cp.Then we incur gain but the thing always  incurs  loss of  (x*x)/(10*10)
Reverse
If  actual cost of a thing is cp.and we purchase it from seller by giving him x% gain.Then selling price for that seller is sp and this sp is cp for us.now we sell it on loss of x% of this cp.Then we incur loss but the thing also always  incurs  loss of  (x*x)/(10*10)



Counters