GeekInterview.com
Series: Subject: Topic:

JSP Interview Questions

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

Can we implement an interface in JSP page?If yes how

Asked By: anilpunia | Asked On: Sep 6th, 2006

Answered by: Arvind Kale on: Dec 18th, 2012

We cant implement interface in JSP but we can use extends used to extends class not interface

Answered by: janmaijais on: Jul 9th, 2010

No, We Can't Implement interface in JSP

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: sankh on: Sep 7th, 2012

Server site application contains web resources such as active web resources and passive web resources. Those resides in server passive web resource execution done at browser and active web resources ...

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

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

Answered by: Radhe on: Sep 1st, 2012

A database link can use at database level to transfer data and we can use web service at application level to transfer data between two applications

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: Lakshmi on: Aug 29th, 2012

init() and destroy() methods can be overrided by an JSP page author

Answered by: sampra on: Mar 28th, 2012

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

How to maintain values inside form field while uploading image using JSP?

Asked By: bhaba_pradhan | Asked On: Apr 17th, 2007

The problem I am facing is that whenever I fill details in the form and then click on upload link then request go to upload.JSP and when after uploading the form the request comes back to registration page(1st page) then the values from all fields disappear

Answered by: Rashmi Ahuja on: Jun 28th, 2012

Its better you use Jquery or java script or ajax so that we dont need to completely submit the jsp page just dialog box appear for upload picture and after uploading it will close

Answered by: goravpal on: Oct 29th, 2010

Multipart/form-data

What information that the servletresponse interface gives the servlet methods for replying to the client?

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

It allows the servlet to set the content length and mime type of the reply. Provides an output stream, servletoutputstream and a writer through which the servlet can send the reply data.

Answered by: Sandhya.Kishan on: Jun 22nd, 2012

The information of buffer size, content length, content type and locale is provided to the client by the servletresponse interface.

What is the servlet life cycle?

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

Each servlet has the same life cycle:a server loads and initializes the servlet (init())the servlet handles zero or more client requests (service())the server removes the servlet (destroy()) (some servers do this step only when they shut down)

Answered by: Sandhya.Kishan on: Jun 22nd, 2012

Every servlet follows the same cycle

*The servlet is initialized by calling the init () method.
*The servlet calls service() method to process a clients request.
*The servlet is terminated by calling the destroy() method.
*Finally, servlet is garbage collected by the garbage collector of the JVM.

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: parwezalam on: May 31st, 2012

No, we cant write these codes within scriptlets.

Answered by: RoyalB on: May 31st, 2012

By using Callable Statement like CallableStatement csmt=con.PrepareCall("{PackageName.ProcedureName}"); In jsp U can write these code with in Scriptlet

Code
  1. <% CallableStatement csmt=con.PrepareCall("{PackageName.ProcedureName}"); %>

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.

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

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

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

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.