Thursday, October 8, 2015

JSP Interview Questions and Answers

7.What are the types of scripting elements?
There are three types of scripting elements:
  • Scriptlets
  • Declaration
  • Expression
8. How to create a scriptlet?
Scriptlets are embedded between <% and %> delimiters.
Syntax: <% java code goes in here %>
9. What is declaration element?
  • Declarations are used to declare, define methods and instance variables.
  • Declaration tags does not produce any output that is sent to client.
  • The methods and classes declared will be translated as class level variables and methods during translation.
10. How to declare methods or variables in JSP?
Methods or variables are declared using <%! and %> delimiters.
Syntax: <%! variable=0; %>
11. What is expression element?
Expression element are used to write dynamic content back to the client browser. It is used in place of out.print() method. Only expressions are supported inside the tag. Declarations of methods and variables is not possible inside this tag.

Wednesday, October 7, 2015

JSP Interview Questions and Answers

1. What is a JSP?
JSP files are HTML files with special tags that contain java source code that provide dynamic content. Google search engine, the search page is dynamic will display the search results based on the user’s search request.
2. Compare between Servlet and JSP?
  • In servlets HTML is written inside java code using print statements. In JSP java code is embedded inside HTML.
  • JSP pages are converted to servlets by the web container so actually it can do the same thing as java servlets.
  • JSP are easier for creating HTML content but servlets are easier for writing the java code.
  • A combination of JSP and servlet can be used to separate the presentation(HTML) and logic (java code) and taking the advantage of both.
3. Explain JSP life cycle phases?
JSP life cycle phases are:
  • Translation and compilation: The JSP will be translated into servlet java file and compiled to servlet class by the web container.
  • Instantiation: The web container creates an instance of the servlet class.
  • Initialization: The web container instantiates the servlet and makes it ready for servicing the request.
  • Service: This is the phase during which the JSP services the user requests.
  • Destroy: JSP is destroyed by the web container when the application is uninstalled.
4. Explain JSP life cycle methods?
JSP life cycle methods are:
  • jspInit() – The web container calls the jspInit() to initialize the servlet instance generated. It is invoked before servicing the client request and invoke only once for a servlet instance.
  • _jspService() – The web container invokes the jspService() for each user request, passing it the request and the response objects.
  • jspDestroy() - The web container invokes this when it decides to take the instance out of service.

Tuesday, October 6, 2015

Current Affairs 2015

Rajasthan Assembly has passed -Rajasthan Special Backward Classes Reservation Bill, 2015 : This bill provides 5 % reservation to Gujjars and other communities under Special Backward Classes (SBC). Five communities namely Banjara/Baldiya/Laba na, Gadiya/Lohar/Gadoliya, Gujar/Gurjar, Raika/Rebari/Debasi and Gadariya/Gadri/Gaya ri have been included in this bill.
Rajasthan Economically Backward Classes Reservation Bill, 2015 : This bill provides 14 % quota to Economically Backward Classes (EBC) of unreserved categories.
Rajasthan Assembly has also passed the Rajasthan Vexation Litigation Prevention Bill, 2015 by voice vote.
The Union Cabinet has approved the setting up of Indian Sign Language Research and Training Centre (ISLRTC) as a society under the Societies Registration Act, 1860.
Bombay High Court restrains Maharashtra government from releasing water from Gangapur dam for ‘Shahi Snaan’ (holy dip) of the Kumbh Mela as many parts of state are facing drought.
Two Indian Coast Guard Ships Apoorva and C-421 are commissioned at Naval Dock. C-421 is a water jet propelled vessel, 27th in the series of IBs constructed by L & T Limited
Union Health Ministry today released the National Health Profile 2015, which provides comprehensive information related to health sector