Find Interview Questions for Top Companies
Ques:- Differentiate between response.sendredirect(url) and ?
Asked In :- Unica Solutions,
Right Answer:
`response.sendRedirect(url)` sends a response to the client to request a new URL, resulting in a new request to the server. In contrast, `response.forward(request, response)` forwards the request to another resource on the server without the client being aware, maintaining the same request and response objects.
Ques:- Is jsp technology extensible?
Asked In :- Rightmove, sandvik,
Right Answer:
Yes, JSP technology is extensible.
Ques:- What is translation phase?
Right Answer:
The translation phase in JSP (JavaServer Pages) is the process where the JSP file is converted into a servlet by the JSP engine. This involves parsing the JSP code, generating the corresponding Java servlet code, and compiling it into bytecode for execution on the server.
Ques:- Explain jsp technology?
Right Answer:
JSP (JavaServer Pages) is a technology used for developing web pages that contain dynamic content. It allows developers to embed Java code directly into HTML pages, enabling the creation of interactive and data-driven web applications. JSP files are compiled into servlets by the server, which then processes requests and generates responses.
Ques:- How can multiple submits due to refresh button clicks be prevented?
Right Answer:
To prevent multiple submits due to refresh button clicks in JSP, you can implement the Post/Redirect/Get (PRG) pattern. After processing the form submission, redirect the user to a different page or the same page using a `response.sendRedirect()` method. This way, refreshing the page will not resubmit the form data.
Ques:- Can a subsequent request be accessed with one’s servlet code if a request attribute is already sent in the JSP?
Asked In :- Nohitatu, asml, bairesdev,
Right Answer:

No, request attributes are only available for the duration of the request and cannot be accessed in subsequent requests.

Ques:- What is a output comment?
Right Answer:
An output comment in JSP is a comment that is included in the output sent to the client, typically using the syntax `<%-- comment --%>`. However, it is not rendered in the HTML output; it is used for documentation purposes within the JSP file.
Ques:- how to pass values to a function fron input tags, and how to display that values in that called function
Asked In :- Qway Technologies,
Right Answer:
To pass values from input tags to a function in JSP, you can use a form to collect the input and then call the function with the input values. Here's a simple example:

```jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Input Example</title>
</head>
<body>
<form action="yourJspPage.jsp" method="post">
<input type="text" name="inputValue" />
<input type="submit" value="Submit" />
</form>

<%
String inputValue = request.getParameter("inputValue");
if (inputValue != null) {
out.println("You entered: " + inputValue);
}
%>
</body>
</html>
```

In this example, when the form is submitted, the value from the input field is passed to the
Comments
Admin May 17, 2020

write ur question clearly

Admin May 17, 2020

I think you r talking about Javascript fuction??

Ques:- Where we use assertion in java programming?
Right Answer:
Assertions in Java programming are used to test assumptions about the program during development and debugging. They help identify logical errors by verifying that certain conditions hold true at specific points in the code.
Comments
Admin May 17, 2020

->assertions are using for debugging/ testing the flow of
program at the time of development and testing phases not
yet deployment phase.
we can use the assertions any where in java program is
valid but we have to use it in appropriate way.
->the syntax of Assertion is:
assertion(boolean): value;
*we can take any value after colon(:) that may be int,
char,string and method call
when ever assertion parameter is "true" then it will
proceed the remaining execution of program otherwise it
throw an exception saying"java.lang.AssertionError:xxxx"
assertion for testing purpose if assumption value is
false then it raises an exception but to handling this
exception by using "try-catch-finally" is not recommended.

Admin May 17, 2020

Only we used in try block

Ques:- How to works asjx in jsp?
Right Answer:
AJAX in JSP works by using JavaScript to send asynchronous requests to the server without reloading the entire page. You can use XMLHttpRequest or the Fetch API to call a JSP page, which processes the request and returns data (like JSON or HTML) that can be dynamically updated on the client side.
Comments
Admin May 17, 2020

what our target is get the server side information into
clientside .
put a jsp file into server and get the information from
that jsp and show to client.
pls check in google with ajax.

Ques:- which situation you use static include and dynamic include in jsp?
Right Answer:
Use static include (`<jsp:include page="staticPage.jsp" />`) when the included content is fixed and does not change, allowing for better performance. Use dynamic include (`<jsp:include page="dynamicPage.jsp" flush="true" />`) when the included content may change based on user input or other conditions, allowing for more flexibility.
Comments
Admin May 17, 2020

This is Static include.
<%@ include file="header.jsp" %>
1.the file includes static text. i.e if we use the static
include, it will merge the contents of included jsp
(header.jsp) with main jsp at compile time. and the size of
the main jsp will increase. some times it may have problem,
because the maximum size of the jsp is 64kb.
2.if the file is changed,the JSP engine may not recompile
the JSP
This is Dynamic include.
<jsp:include page="header.jsp">
1.The file includes Dynamically. i.e at run time.
2.If the included file (header.jsp) is changed,the JSP
engine recompile the included JSP, because it will include
at run time.By using this the jsp size also not increased.
For Example
Static include (<%@ include file="header.jsp" %>) like our
#include (C++)
Dynamic include (<jsp:include page="header.jsp"> ) like our
import (JAVA)

Admin May 17, 2020

when same request and response objects are shared by
multiple JSP's in dynamic include
In static include internally,it will merge the contents(eg:
one.jsp and two.jsp) and creates a jsp as(one_two.jsp)then
generates the output of both the jsp's

Ques:- what are the alternate way to use the scriplet in jsp.
Right Answer:
The alternate ways to use scriptlets in JSP are:

1. **Expression Language (EL)**: Use `${}` to access data.
2. **JSTL (JavaServer Pages Standard Tag Library)**: Use tags like `<c:forEach>`, `<c:if>`, etc., for control flow and data manipulation.
3. **Custom Tags**: Create and use custom tag libraries for reusable components.
4. **JavaBeans**: Use JavaBeans to encapsulate data and access properties with EL.
Comments
Admin May 17, 2020

Action Tags, jstl and custom tags

Ques:- What Do you Mean By Object Serialization in java.
Right Answer:
Object serialization in Java is the process of converting an object into a byte stream, allowing it to be easily saved to a file or transmitted over a network. This enables the object to be reconstructed later, preserving its state and data.
Comments
Admin May 17, 2020

Serialization is a process of writing the state of the
object in a stream. The state of the object (information
available in the object)will be held in the instance
variable (not in the static variables)
There are various streams like
ByteArrayOutputStream, FileOutputStream,SocketOutputStream
all these streams can be used to store data to various
destinations like memory,file and someother program.
writeObject() method is for carryout the operation of
serialization.

Admin May 17, 2020

Object Serialization extends the core Java Input/Output
classes with support for objects. Object Serialization
supports the encoding of objects, and the objects reachable
from them, into a stream of bytes; and it supports the
complementary reconstruction of the object graph from the
stream. Serialization is used for lightweight persistence
and for communication via sockets or Remote Method
Invocation (RMI). The default encoding of objects protects
private and transient data, and supports the evolution of
the classes. A class may implement its own external encoding
and is then solely responsible for the external format.
Serialization now includes an API that allows the serialized
data of an object to be specified independently of the
fields of the class and allows those serialized data fields
to be written to and read from the stream using the existing
protocol to ensure compatiblity with the default writing and
reading mechanisms.

Ques:- Are application, pageContext and object of ServletContext same or not?
Asked In :-
Right Answer:
No, application, pageContext, and ServletContext are not the same. They represent different scopes and contexts in a JSP environment.
Comments
Admin May 17, 2020

application and object of ServletContext are same. In jsp
page application implicit variable represents object of
ServletContext but pageContext represent object whose super
class is SerlvetContext. the class of PageContext has some
conviniant methods for manipulation of attributes of
different scopes. These methods are findAttribute, get/set/
removeAttribute that accept last parameter as a int value
representing scope to which attribute pass to methods
belongs.
The PageContext has integral contant value for showing
scopes which are PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE
and APPLICATION_SCOPE. These constant values are used as a
last arguement to set/get/removeAttribute methods to
indicate to which scope the attribute belong. such a methods
and consant values are not present in its super class
ServletContext.

Admin May 17, 2020

application and object of servlet context is same
remaining not same.

Ques:- how can i get a scjp certification??
Right Answer:
To get a SCJP (Sun Certified Java Programmer) certification, you need to follow these steps:

1. Study the Java programming language and the exam objectives.
2. Choose a reputable study guide or course.
3. Practice with sample questions and mock exams.
4. Register for the SCJP exam through an authorized testing center.
5. Take and pass the exam to receive your certification.
Comments
Admin May 17, 2020

First we need to register on scjp authorized organization,
they give particular date to write online exam on the date
you need to go and write the online exam

Admin May 17, 2020

You can approach any prometric center(for eg NIIT), pay the
amount and get the voucher. The voucher is valid till 1
year. If you are paying the amount from your pocket, wait
for SUNs offer period

Ques:- How do you import the packages in the JSP?
Asked In :- Keyence,
Right Answer:
You can import packages in JSP using the `<%@ page import="package.name" %>` directive. For example: `<%@ page import="java.util.List" %>`.
Comments
Admin May 17, 2020

<%@page import="java.sql.*,java.io.*"%>

Admin May 17, 2020

<% @ page import = 'org.com.className' %>

Ques:- What is the use of Application Object and Session Object in JSP?
Right Answer:
The Application Object in JSP is used to store data that is shared across all users and sessions of the web application, while the Session Object is used to store data specific to a single user's session, allowing for user-specific information to be maintained throughout their interaction with the application.
Comments
Admin May 17, 2020

Application object is used to maintain the information
related to the current webapplication which is running in
the webcontainer.
Session object is used to maintain the information related
to the browser from which the user gets the request.

Ques:- how to maintain sessions in jsp?can you tellme the methods.
Right Answer:
To maintain sessions in JSP, you can use the following methods:

1. **HttpSession Object**: Use `request.getSession()` to create or retrieve a session. You can store and retrieve attributes using `session.setAttribute("key", value)` and `session.getAttribute("key")`.

2. **URL Rewriting**: Append the session ID to URLs using `response.encodeURL("yourURL")` if cookies are disabled.

3. **Cookies**: Store session information in cookies if needed, using `Cookie` objects.

4. **Hidden Form Fields**: Pass session-related data through hidden fields in forms.

These methods help manage user sessions effectively in JSP applications.
Comments
Admin May 17, 2020

A small correction at **
using session oject in jsp.
first u set using following methods
String name="ravi";
session.setAttribute("user",name);
using retrive method
String sessionuser=session.getAttribute("user");**
out.println("welcome"+sessionuser);
u give this last 2 stmts in all jsp pages. it will
display as "Welcome ravi".

Admin May 17, 2020

using session oject in jsp.
first u set using following methods
String name="ravi";
session.setAttribute("user",name);
using retrive method
String sessionuser=session.getAttribute(name);
out.println("welcome"+sessionuser);
u give this last 2 stmts in all jsp pages. it will
display as "Welcome ravi".

Ques:- How does the Jsp Expressions works ? What happens at the back?
Right Answer:
JSP expressions are used to output data to the client. When a JSP expression is written, it is evaluated and converted to a string. At the backend, the JSP engine translates the JSP file into a servlet. During the servlet's execution, the expression is evaluated, and the result is inserted into the response output stream. For example, `<%= variable %>` will be replaced with the value of `variable` in the generated HTML.
Comments
Admin May 17, 2020

jsp expressions are evaluated at the run time,
jsp compiler evaluates the expressions at the run time.

Admin May 17, 2020

jsp expressions is a normal java expression , when we write
the jsp expression in our jsp page like
<%=some expression%> then in the servlet ie generated by
jsp compiler the jsp expression will be placed without" "
in out.printmethod.
for example :
<%
int i=10,j=20,k=30;%>
k----> <%=k%>
in the servlet equivalent to above jsp page
out.print("k---->");
out.print(k);
like that at the back the jsp expression will be placed in
the out.print()without " " so that the value of the
expresssion will be evaluated and printed.



The Java skill section on takluu.com is designed for freshers, intermediate developers, and experienced professionals aiming to crack Java-based technical interviews with confidence. Java remains one of the most in-demand programming languages, and mastering it opens the door to countless opportunities in backend development, enterprise solutions, Android apps, and cloud-based platforms.

Our Java category covers everything from Core Java concepts like OOPs (Object-Oriented Programming), Data Types, Loops, and Exception Handling to Advanced Java topics including Collections Framework, Multithreading, JDBC, Servlets, JSP, Lambda Expressions, and Streams. We provide practical coding examples, real interview questions (with answers), and key concept explanations that interviewers commonly test.

Whether you’re applying for a role like Java Developer, Backend Engineer, or Full Stack Developer, this section ensures you understand the logic, syntax, and problem-solving approaches that matter in real-world interviews. You’ll also find scenario-based questions and discussions around design patterns, JVM internals, garbage collection, and performance tuning — areas often explored in senior-level interviews.

Each topic is structured to help you revise quickly and efficiently, with quizzes and mock interviews to assess your understanding. Our content is curated by experts who have worked with Java across different domains and keep the material aligned with current industry trends.

At Takluu, we believe in not just learning Java — but preparing to think in Java. Get ready to face interviews with clarity, confidence, and a deep understanding of what makes Java so powerful and reliable.

AmbitionBox Logo

What makes Takluu valuable for interview preparation?

1 Lakh+
Companies
6 Lakh+
Interview Questions
50K+
Job Profiles
20K+
Users