Are You Recruiter/Hiring Manager?
Cloud-based Candidate Screening | Online Tests
PMP 1600 Questions
PMP 1600 Questions
1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)

Tutorial Home

Hibernate

  • Advantage of Hibernate over JDBC
  • Hibernate Setup with an web Application
  • First Hibernate Application
  • Hibernate mapping with Database TABLE
  • Hibernate Data Type-Java Data Type - SQL Data Type mapping
  • One to Many Relation in Hibernate
  • One to Many Relation in Hibernate bi-directional
  • Many to Many Relation in Hibernate
  • HQL: The Hibernate Query Language
  • Criteria Queries
  • Criteria Queries : Equal (eq), Not Equal(ne), Less than (le), greater than (gt),greater than or equal(ge) and Ordering the results
  • Criteria Queries: And OR conditions
  • Hibernate generator to generate id (primary key)
  • prevent concurrent update in Hibernate,slate object updatation in Hibernate,version checking in Hibernate

    Struts


  • Model View Controller (MVC)
  • Model View Controller (MVC)
  • Struts Flow-How Struts Works?
  • Struts Tutorial - Struts Setup- First Struts Action class setup
  • Message Resources
  • Validation Framework
  • Validation Framework-client side
  • ForwardAction
  • IncludeAction
  • DispatchAction
  • LookupDispatchAction
  • DynaActionForm
  • DynaActionForm
  • Struts Tutorial - Mutli-click prevention using struts tokens-Prevent Duplicate Submission
  • Logic Iterate Map and List

    JSP


  • JSP Tutorial
  • Introduction to JSP
  • JSP Comments
  • JSP Syntax
  • JSP Scripting Elements :Scriptlet, expression, declaration
  • JSP Directives
  • implicit objects in JSP
  • JSP Actions
  • Introduction to JSP
  • jsp:useBean
  • The jsp:setProperty Action
  • The jsp:getProperty Action
  • Introduction to JSP

    Spring


  • Spring Tutorial
  • Introduction to Spring
  • Benefits of Using Spring Framework
  • Inversion of Control in Spring
  • Introduction to BeanFactory
  • Dependency Injection in Spring
  • Collections Setter Injection
  • Bean Scopes in Spring
  • Spring IOC Setup Step by Step
  • Bean Lifecycle in Spring
  • ApplicationContext
  • MessageSources in Spring
  • Web Spring MVC framework
  • Developing Your First Spring Web Application
  • Developing Your Second Spring Web Application with Spring Form
  • Developing Your First Spring Web Application with Spring Validation Framework with Code Example
  • Spring integration with Hibernate
  • SCWCD : HttpServletResponse Interface

    SCWCD 1.5 Exam Kit

    Using the HttpServletResponse interface, write code to set an HTTP response header, set the content type of the response, acquire a text stream for the response, acquire a binary stream for the response, redirect an HTTP request to another URL, or add cookies to the response.

    Headers.

    A servlet can set headers of an HTTP response via the following methods of the HttpServletResponse interface:

    • setHeader

      Sets a response header with the given name and value. If the header had already been set, the new value OVERWRITES the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

    • addHeader

      Adds a response header with the given name and value. This method allows response headers to have multiple values.

    public interface HttpServletResponse extends javax.servlet.ServletResponse {
    
    	public void setHeader(java.lang.String name, java.lang.String value);
    	public void addHeader(java.lang.String name, java.lang.String value);
    
    }
    					

    The setHeader method sets a header with a given name and value. A previous header is replaced by the new header. Where a set of header values exist for the name, the values are cleared and replaced with the new value.

    The addHeader method adds a header value to the set with a given name. If there are no headers already associated with the name, a new set is created.

    Headers may contain data that represents an int or a Date object. The following convenience methods of the HttpServletResponse interface allow a servlet to set a header using the correct formatting for the appropriate data type:

    • setIntHeader

      Sets a response header with the given name and integer value. If the header had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

    • setDateHeader

      Sets a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch. If the header had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

    • addIntHeader

      Adds a response header with the given name and integer value. This method allows response headers to have multiple values.

    • addDateHeader

      Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since the epoch. This method allows response headers to have multiple values.

    public interface HttpServletResponse extends javax.servlet.ServletResponse {
    
    	public void setIntHeader(java.lang.String name, int value);
    	public void setDateHeader(java.lang.String name, long date);
    	public void addIntHeader(java.lang.String name, int value);
    	public void addDateHeader(java.lang.String name, long date);
    
    }
    					

    To be successfully transmitted back to the client, headers must be set before the response is committed. Headers set after the response is committed will be IGNORED by the servlet container.

    Content type.

    The charset for the MIME body response can be specified explicitly using the setContentType(String) method. Explicit specifications take precedence over implicit specifications. If no charset is specified, ISO-8859-1 will be used. The setContentType method MUST be called BEFORE getWriter and BEFORE committing the response for the character encoding to be used.

    There are 2 ways to define content type:

    • ServletResponse.setContentType(String);

    • HttpServletResponse.setHeader("Content-Type", "text/html");

    Acquire a text stream.

    To send CHARACTER data, use the PrintWriter object returned by ServletResponse.getWriter()

    public interface ServletResponse {
    
    	public java.io.PrintWriter getWriter() throws IOException;
    	
    }
    					

    Returns a PrintWriter object that can send character text to the client. The PrintWriter uses the character encoding returned by getCharacterEncoding(). Calling flush() on the PrintWriter commits the response.

    Either this method or getOutputStream() may be called to write the body, NOT BOTH.

    Acquire a binary stream.

    ServletResponse.getOutputStream() provides an output stream for sending BINARY data to the client. A ServletOutputStream object is normally retrieved via this method.

    public interface ServletResponse {
    
    	public ServletOutputStream getOutputStream() throws IOException;
    
    }
    					

    The servlet container does NOT encode the binary data.

    Calling flush() on the ServletOutputStream commits the response. Either this method or getWriter() may be called to write the body, NOT BOTH.

    Redirect an HTTP request to another URL.

    The HttpServletResponse.sendRedirect method will set the appropriate headers and content body to redirect the client to a different URL. It is legal to call this method with a relative URL path, however the underlying container must translate the relative path to a fully qualified URL for transmission back to the client. If a partial URL is given and, for whatever reason, cannot be converted into a valid URL, then this method must throw an IllegalArgumentException.

    public interface HttpServletResponse extends javax.servlet.ServletResponse {
    
    	public void sendRedirect(java.lang.String location) throws IOException;
    
    }
    					

    Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading ’/’ the container interprets it as relative to the current request URI. If the location is relative with a leading ’/’ the container interprets it as relative to the servlet container root.

    If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.

    This method will have the side effect of committing the response, if it has not already been committed, and terminating it. No further output to the client should be made by the servlet after these methods are called. If data is written to the response after this method are called, the data is ignored.

    If data has been written to the response buffer, but not returned to the client (i.e. the response is not committed), the data in the response buffer must be cleared and replaced with the data set by these methods. If the response is committed, this method must throw an IllegalStateException.

    Add cookies to the response.

    The servlet sends cookies to the browser by using the HttpServletResponse.addCookie(Cookie) method, which adds fields to HTTP response headers to send cookies to the browser, one at a time. The browser is expected to support 20 cookies for each Web server, 300 cookies total, and may limit cookie size to 4 KB each.

    public interface HttpServletResponse extends javax.servlet.ServletResponse {
    
    	public void addCookie(Cookie cookie);
    
    }
    					

    Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie.

    The information you are posting should be related to java and ORACLE technology. Not political.