Java/J2EE Interview - Top 50 JSP Interview Questions and Answers for developers. The primary level of JSP Interview Questions. .. We've observed from our experience that you won't struck in an interview just after reading the lengthy. JSP Interview Questions and Answers. What is a JSP and what JSPs are normal HTML pages with Java code pieces embedded in them. JSP pages are saved. There is a list of top 40 frequently asked JSP interview questions and answers for freshers and professionals. If you know any JSP interview question that has not.
|Language:||English, Spanish, Dutch|
|ePub File Size:||18.32 MB|
|PDF File Size:||8.68 MB|
|Distribution:||Free* [*Regsitration Required]|
Top 50 JSP Interview Questions & Answers JSP is a standard extension of Java and is defined on top of Servlet .. interview. Download PDF. Dear readers, these JSP Interview Questions have been designed specially to get you As per my experience good interviewers hardly plan to ask any particular question during continue based on further discussion and what you answer. JSP Interview Questions and Answers for Experienced, Beginners, Freshers Here I am providing some important JSP interview questions with answers to help.
Explain the difference between directive include and jsp include. Explain the difference between RequestDispatcher and sendRedirect? How JSP handles runtime exceptions? But sendRedirect redirects the Client-side with new request and responding the objects.
How to delete a Cookie in a JSP? Explain the types of JSP actions. Explain the advantages of JSP. The code below explains it: What are the implicit Objects available? Variable 2.
Class 3. Description - application javax. The context for the JSP page's servlet and any Web components contained in the same application. They are request, response, pageContext, session, and application, out, config, page, and exception.
Question 7: In JSP page how can we handle runtime exception? We can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing page.
It will redirect the browser to the JSP page error.
Within error. Question 8: Question 9: How can you pass information form one jsp to included jsp: This JSP interview question is little tricky and fact based. Question Ans tag library is a collection of custom tags. Custom actions helps recurring tasks will be handled more easily they can be reused across more than one application and increase productivity. JSP tag libraries are used by Web application designers who can focus on presentation issues rather than being concerned with how to access databases and other enterprise services.
Some of the popular tag libraries are Apache display tag library and String tag library. You can also check my post on display tag library example on Spring. Please contribute any interview questions asked to you guys on JSP Interview or if you are looking for the answer of any JSP questions, I will try to help you. Share to Twitter Share to Facebook. United States. Anonymous said JSP Questions are rather good and answers are better. October 10, at May 23, at April 13, at October 14, at 4: Can we call Servlet from Jsp???
November 24, at September 4, at Hi how to used doget and dopost method in jsp.
November 17, at Newer Post Older Post Home. Subscribe to: Post Comments Atom. Follow by Email. Interview Questions core java interview question Coding Interview Question 72 data structure and algorithm 70 interview questions 48 object oriented programming 31 SQL Interview Questions 30 design patterns 30 thread interview questions 30 collections interview questions 25 spring interview questions 19 database interview questions 16 servlet interview questions 15 Programming interview question 6 hibernate interview questions 6.
How to design a vending machine in Java?
How HashMap works in Java? Why String is Immutable in Java? JSP is java server side technology to create dynamic web pages. We can create user views in servlet also but the code will become very ugly and error-prone. Also, most of the elements on a web page are static, so the JSP page is more suitable for web pages. We should avoid business logic in JSP pages and try to use it only for view purpose.
Just make the required changes in the JSP page and replace the old page with the updated jsp page in the deployment directory and the container will load the new JSP page. Actually JSP container takes care of translating the JSP pages and create the servlet class that is used in web application. JSP lifecycle phases are:. We should override jspInit methods to create common resources that we would like to use in JSP service method and override jspDestroy method to release the common resources.
But in this case, we will have to configure it in deployment descriptor just like Servlets. The sample configuration is given below code snippet of web. For example;. Since most of the times we print dynamic data in JSP page using out. JSP Declarations are used to declare member methods and variables of servlet class. We have 9 implicit objects that we can directly use in JSP page.
JSP pageContext implicit object is instance of javax. PageContext abstract class implementation. We can use pageContext to get and set attributes with different scopes and to forward request to other resources. We can configure init params for JSP similar to servlet in web. The only thing differs from servlet is jsp-file element where we need to provide the JSP page location.
JSP pages are mostly used for view purposes and all the business logic should be in the servlet or model classes. Below is the sample code for this:.
We can disable scripting elements in JSP pages through deployment descriptor configuration like below. JSP action elements or action tags are HTML like tags that provide useful functionalities such as working with Java Bean, including a resource, forwarding the request and to generate dynamic XML elements.
JSP action elements always starts with jsp: Some of the important action elements are jsp: The difference between JSP include directive and include action is that in include directive the content to other resource is added to the generated servlet code at the time of translation whereas with include action it happens at runtime. Another difference is that in JSP include action, we can pass params to be used in the included resource with jsp: When the included resource is static such as header, footer, image files then we should use include directive for faster performance but if the included resource is dynamic and requires some parameters for processing then we should use include action tag.
Most of the times we use JSP for view purposes and all the business logic is present in servlet code or model classes.
We also use request params, headers, cookies and init params in JSP to create response views. We can use scriptlets and JSP expressions to retrieve attributes and parameters in JSP with java code and use it for view purpose. JSP Expression Language provides many implicit objects that we can use to get attributes from different scopes and parameter values. Note that these are different from JSP implicit objects and contains only the attributes in given scope.
Most of the times, you can find them in the example projects and you can use them. These jars are container specific, for example in Tomcat, we need to include jstl. Fortunately JSP is extendable and we can create our own custom tags to perform certain operations.
We can add custom tag library in JSP page using taglib directive and then use it. This can be very useful for user when the number is really long. So we want some custom tags like below:. Based on the number and format passed, it should write the formatted number in JSP page, for the above example it should print , All we need to do it to include it in the JSP page using taglib directive.