GeekInterview.com
Series: Subject: Topic:

JSP Interview Questions

Showing Questions 1 - 20 of 199 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

What are advantages of JSP

Asked By: Interview Candidate | Asked On: Sep 6th, 2005

Answered by: sadanand on: Apr 14th, 2012

Jsp container provides a easy way to access standard objects and actions..

Answered by: tariqj2ee on: Oct 8th, 2005

Easily saying

1)Auto compilation(translation.....)

2)Not deployment descritpor specific

3)Multiple deployment is avoided.

JSP comments

Asked By: nishant.mca2010 | Asked On: Aug 1st, 2010

What are the ways to write comments in the JSP page? Give example.

Answered by: sampra on: Mar 28th, 2012

Hidden comment
Show comment

Answered by: delindia on: Jan 3rd, 2012

HTML Comments - The Container passes these comments straight on to the client, where the browser interprets them as HTML comments. The commented out blocks still display in the source code. JSP Comme...

What JSP lifecycle methods can I override?

Asked By: Interview Candidate | Asked On: Aug 28th, 2004

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...

Answered by: sampra on: Mar 28th, 2012

init() and destroy() methods can be override. not service() method.

Answered by: ajkush on: Jan 18th, 2011

init() and destroy() methods can be override. not service() method.

What is the difference between relative and absolute url?

Asked By: pramendra | Asked On: Apr 4th, 2006

Answered by: sampra on: Mar 28th, 2012

absolute url is full url relative url is part of url wn we are in app

Answered by: Karan on: Sep 27th, 2011

As there seems to still be confusion about the difference between relative and absolute urls, I thought I'd post a little information and a reference link for everyone. An url that is ABSOLUTE shows ...

How to disable the expression language in a JSP?

Asked By: anampr | Asked On: Aug 10th, 2011

Answered by: sampra on: Mar 28th, 2012

isELIgnored="true"

Answered by: Navdeep on: Aug 19th, 2011

We can use isEliIgnored property or we can disable by using below code..

Code
  1. <jsp-config>
  2. <jsp-property-group>
  3. <url-pattern>*.jsp</url-pattern>
  4. <el-ignored>true</el-ignored>
  5. </jsp-property-group
  6. </jsp-config>

Exception handling in JSP

Asked By: anithyus | Asked On: Oct 21st, 2009

How will you handle the exception without sending to error page? How will you set a message detail to the exception object?

Answered by: sampra on: Mar 28th, 2012

isErrorPage and errorPage

Answered by: delindia on: Jan 2nd, 2012

Example:


The exception will be thrown inside the catch:

<% int x = 5/0;%>



The exception is : ${catchException}


There is an exception: ${catchException.message}



How do you call stored procedures from JSP

Asked By: Interview Candidate | Asked On: Aug 15th, 2005

Answered by: sampra on: Mar 28th, 2012

we can do same as doing in java wd scriptlet

Answered by: delindia on: Jan 2nd, 2012

We can call stored producedure using sql tags in jstl "java5 For example, calling a stored procedure that returns a result set: exec ExampleProcLoadExample ? ...

Transfer data in JSP

Asked By: Mohit Pabari | Asked On: Oct 7th, 2011

How to transfer data over multiple pages?

Answered by: sampra on: Mar 28th, 2012

we can set attribute in application session or request attribute.here page wont be use ful bcz scope of page is same page only

Answered by: sampra on: Mar 13th, 2012

1.page
2.session
3.request.
4.application

using these scoped variables we can translate data from one resource to another

ex: request.setAttribute("key","value");
Object o=getAttribute("key");

Pass control from one JSP page to another

Asked By: Aparna Rao | Asked On: Jun 22nd, 2010

Write sample code to pass control from one JSP page to another?

Answered by: delindia on: Jan 2nd, 2012

The RequestDispatcher objects forward method to pass the control. The response.sendRedirect method

Code
  1. <%      response.sendRedirect("RedirectIfSuccessful.html");            %>
  2.  
  3. <%
  4. String st=request.getParameter("n");
  5. if(st==""){
  6. getServletContext().getRequestDispatcher("/form.jsp").forward(request, response);
  7. }
  8. else{
  9. getServletContext().getRequestDispatcher("/welcome.jsp").forward(request, response);
  10. }
  11. %>
  12.  

Answered by: pavanshetty05 on: Jan 5th, 2011

There are 2 ways to redirect the page
1) Use the forward :- By using this
you will get the all the objects in the redirected page.
2) response.sendRedirect("Path") :- In This case the control is not transferred to the next page.

What is need of JSP implicit objects?

Asked By: narendra_d | Asked On: Oct 27th, 2011

Answered by: khaled on: Dec 16th, 2011

application javax.servlet.ServletContext config javax.servlet.ServletConfig exception java.lang.Throwable out javax.servlet.jsp.JspWriter page java.lang.Object PageContext javax.servlet.jsp.PageContex...

Why we need web container to deploy the servlet or JSP ?

Asked By: 100881 | Asked On: Oct 17th, 2007

I.E why we can not run the application like simple Java program

Answered by: Jyotshna Pardhia on: Nov 16th, 2011

The web container is a Java runtime environment which is responsible for managing life cycle of JSP pages and Servlets. A web container is responsible for instantiating, initializing and invoking Serv...

Answered by: ishar.Gsingh on: Dec 19th, 2009

Containers are like window for Servlet and JSP's to ourside world. As explain by many answers it provides interface to ourside world. Few advantage of deploying JSP and servlet in container is:1) ...

Jasper exception in JSP

Asked By: tathagata812 | Asked On: Jan 28th, 2009

When and why jasperexception occurs?

Answered by: Muhammade Irfan Ghori on: Oct 31st, 2011

What exactly mean by the following:

jsp-api.jar is missing in the build path.

Answered by: Rahul on: Aug 8th, 2011

What happen if it is occurred in Struts 2.1.0 ? while i trying to submit a list value from JSP page in action class : -



why jasper exception occurred when action successfully got the list value - and It give " Unhandled exception in struts : JasperException.

Can we use main method inside JSP? Why?

Asked By: ganeshvertech | Asked On: Jun 22nd, 2007

Answered by: ashish on: Aug 5th, 2011

Can someone tell me...how a servlet container execute init(),service() and destroy() method in a sequential manner ?
is it true that a servlet container itself contains a main() method which call these methods ?

thanks in advance...

Answered by: mullangi13 on: Jul 29th, 2008

We can use main method in Jsp/servlet, but there is no use. This main() method will not execute throughout the life cycle. Then why should we need to use.Generally these JSP/Servlets are server side t...

Share data in two different projects

Asked By: gunturanilkumar007 | Asked On: Jul 26th, 2011

How to share the data in two different projects in JSP or servlets

When many users are browsing the same application at the same time and they click the "submit" button will many objects be created for each and every user?

Asked By: Santhini | Asked On: Mar 28th, 2006

Answered by: umar farooq on: Jul 24th, 2011

NO, There will be one single instance of the servlet in the web-container ,when request arrives to the server a thread will be created rather creating the object. so that multiple request will have ...

Answered by: vinaymudgil007 on: Mar 31st, 2011

single servlet object will be loaded in memory and one thread per request would be created by the container to serve those requests.

Thanks,
Vinay

What is JSP

Asked By: Interview Candidate | Asked On: Sep 10th, 2005

Answered by: Venugopal L on: May 1st, 2006

JSP is an advanced version of Java Servlets. It will also extends the functionality of a web server. It will give clear separation between application logic and prosentation logic.

Answered by: RajeshKumar on: Apr 21st, 2006

Hi, JSP is a server side scripting language. It encapsulates the java code with the html code. It is simpler and easier to develop application with JSP than servlet or any othere.

A] is the response.Sendredirect ends the existing session?B] if I logged in to a site ( say a.Com) & then in same browser window I type the url for another site (say b.Com), then does my session gets ended...

Asked By: pisalya | Asked On: Mar 18th, 2006

Answered by: ajkush on: Jan 18th, 2011

no. both session retained.

Answered by: charankk on: Apr 30th, 2008

Hi Prasanth, The case is differnt here.Assume you have opened gmail.com and logged in... session will be created.Then you have tried to replace the url as yahoo.com, here the browser will identify the...

JSP page object request

Asked By: Akashpanth | Asked On: Jan 9th, 2011

In order to access the request object from a JSP page? Which step you must complete among the following:a. Call the getrequest method of the JSP page.B. Use the getservletconfig method of the JSP page, then call the getrequest method of the servletconfig object.C. There is never a good reason to access...

Answered by: yogesh249 on: Jan 12th, 2011

request is an implicit object in JSP

How do you use "synchronized" blocks?

Asked By: sathireddy | Asked On: Feb 16th, 2006

Is there other way to prevent next thread to access the resource with out using "synchronized" blocks?

Answered by: Deepak agnihotri on: Nov 30th, 2010

We can use thread local variable as an alternative to synchronization.

Answered by: Nishant jain on: May 7th, 2006

there is a way to do so, but its a bit complex and has be done by a programmer.Well u can implement the semaphore architecture using the the semaphore variable.this can be done as following:take a boo...

First | Prev | | Next | Last Page

 

 

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Career Counselling

 Have Career Question?

 Ask Chandra

 Ask Only Career questions.

Follow us:
 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, click "Subscribe".