18. How to overwrite the init and destroy method in a jsp page

You cannot override the _jspService() method within a JSP page. You can however, override the jspInit() and jspDestroy() methods within a JSP page. jspInit() can be useful for allocating resources like database connections, network connections, and so forth for the JSP page. It is good programming practice to free any allocated resources within jspDestroy().The jspInit() [...]

17. What are Servlet and JSP lifecycle methods.

servlet life cycle methods:
init();
service();
destroy();
jsp lifecycle methods:
init();
_service();
destroy();
remember starting any method with _ means we cannot override this method.

16.What is the difference between sendRedirect()and forward()in JSP?

In an HttpServletResponse class:
Response.sendRedirect () This function is used, when we want to redirect
the client request to some other site (i.e out of our context) or
when ever we want to redirect errors. If you are using sendRedirect (), then it will be visible to the client that means the URL which you have been redirected [...]

15. What is the difference between Difference between doGet() and doPost()

DoGet
DoPost

In doGet Method the parameters are appended to the URL and sent along with header information
In doPost, parameters are sent in separate line in the body

Maximum size of data that can be sent using doget is 240 bytes
There is no maximum size for data

Parameters are not encrypted
Parameters are encrypted

DoGet method generally is used to query [...]

14. Explain JSP/Servle threading model.

Every Servlet contains a doGet or doPost method.
When we deploy a servlet the init method of the servlet is called. And after it has been deployed on each request of the servlet a separate thread is created to process the doGet/doPost method of the servlet.
So all the instance variables of the servlet are not thread [...]

13. what is the default scope of jsp tags?

Page -

12. What are the default objects provided by JSP container?

Implicit objects let developers access container-provided services and resources. These objects are defined as implicit because you do not have to explicitly declare them. They are defined in every JSP page and used behind the scenes by the container whether you declare them or not — although you cannot redeclare them. Because implicit objects are [...]

11.What object that provides one point access to page, request, response, session, out, exception, config and application

A PageContext instance provides access to all the namespaces associated with a JSP page, provides access to several page attributes, as well as a layer above the implementation details. Implicit objects are added to the pageContext automatically.
The PageContext class is an abstract class, designed to be extended to provide implementation dependent implementations thereof, by conformant [...]

10. what is the difference between , pagedirective include, action tag include ?

A JSP page can include page fragments from other files to form the complete response. You can use this, for instance, to keep header, footer, and navigation bar content in separate files and include them in all other pages. There are two include mechanisms: the include directive and the include action. It’s not always obvious [...]

9. Explain JSP Import and JSP Extends.

extends=”package.class”
The fully qualified name of the superclass of the Java class file this JSP file will be compiled to. Use this attribute cautiously, as it can limit the JSP container’s ability to provide a specialized superclass that improves the quality of the compiled file.
import=”{package.class | package.* }, …”
 A comma-separated list of Java packages that the [...]

8. What is the diff. b/n declaring members in the JSP and declaraing in jspinit() method ?

Declaring a variable in JSP means it will have a scope of page while declaring it in jspInit() means its scope gets end with init() method only.

1. How do I prevent the output of my JSP or Servlet pages from being cached by the browser?

Appropriate HTTP header attributes have to be set to prevent the dynamic content output by the JSP page from being cached by the browser. The following jsp code has to be included at the beginning of your JSP pages to prevent caching :
Execute the following scriptlet at the beginning of your JSP pages to prevent [...]

6. hy should we setContentType() in servlet ?what is the use of that method?

SetContentType() is used to intimate the browser that which type of content is coming as response,Depending upon the contentType browser treats with the response.
* ContentType is also called as MIME(MultipurposeInternetMailExtension)type
* Using this type we can set the response to the client or browser or useragent
* it will  give the response based upon the ContentType
* default MIME [...]

5. Can a single JSP page be considered as a J2EE application?  

A J2EE application contains J2EE modules, which could be web applications, EJBs and application clients. It also contains meta-information about the application as well as shared libraries. You can also say that a J2EE application is a set of J2EE modules with some added glue that binds them together into a complete integrated application. The [...]

PMP Certification – 101

I guess, if you reading this article means you have some interest in preparing for PMP certification. Acquiring PMP certification is a really challenging one and will change some one life at least by 10 percent in all aspects of project management wisdom. Here you go with few more details about PMP certification. Studying for [...]

3.How are the implicit object made available in the jsp file? Where are they defined?

Implicit objects are a set of Java objects that the JSP Container makes available to developers in each page. These objects may be accessed as built-in variables via scripting elements and can also be accessed programmatically by JavaBeans and Servlets.
These objects will be automatically instantiated under specific variable names hence the name implicit.

Object
Class or Interface
Description

page
jsp.HttpJspPage
Page’s [...]

2.How to compile the JSP pages manually in all applications and web servers

Tomcat uses the /tomcat/bin/jspc.bat file to make java servlets out of
 the JSPs. Run this program without parameters to view the help screen.
 It’s pretty simple and easy to use. You can set up another bat file
 to call it with parameters. Make sure to include the param “-p
 org.apache.jsp” to create all servlets in the standard tomcat package
 (package [...]

1. Can One Jsp/Servlet extend another Servlet/Jsp

Extending a JSP from another servlet or JSP can be a very tricky task. However it is not recommended by sun, because in doing so you restrict the capability of the JSP Engine.
The JSP super class and sub-class need to satisfy certain requirements.
Requirements for the Super Class

Welcome to Thinktank blog

Welcome to Thinktank blog. All blogs are not same. I will try to make this blog as having a cup of cofee in the morning. Little ideas, greate thoughts, expert talks, professional lessons and many more. so not just another wordpress blog.