Find Interview Questions for Top Companies
Ques:- how can we retrieve the values in jsp by using custom tags
Right Answer:
To retrieve values in JSP using custom tags, you can create a custom tag by defining a tag handler class that extends `SimpleTagSupport` or `TagSupport`. In the tag handler, you can use the `set` methods to accept attributes and the `doTag()` method to process them. Then, in your JSP file, you can use the custom tag by declaring the tag library with the `<%@ taglib %>` directive and using the custom tag with the defined attributes. For example:

1. Define the tag in a Java class.
2. Create a TLD (Tag Library Descriptor) file to register the tag.
3. Use the tag in your JSP like this:

```jsp
<%@ taglib uri="http://example.com/tags" prefix="mytags" %>
<mytags:myCustomTag attributeName="value" />
```

This will allow you to retrieve and manipulate the values as needed within your JSP.
Comments
Admin May 17, 2020

using get methods

Admin May 17, 2020

${person.name}

Ques:- What is the difference in using request.getrequestdispatcher() and context.getrequestdispatcher()?
Asked In :- Cygnet Infotech,
Right Answer:
`request.getRequestDispatcher()` is used to forward or include resources relative to the current request's URL, while `context.getRequestDispatcher()` is used to forward or include resources relative to the web application's context root.
Ques:- what is the difference between jsp and servlets ?
Asked In :- Polestar Solutions,
Right Answer:
JSP (JavaServer Pages) is a technology that allows for the creation of dynamic web content using HTML and Java code, while Servlets are Java programs that run on a server and handle requests and responses. JSP is more user-friendly for designing the view layer, whereas Servlets are better for handling business logic and processing requests.
Ques:- What is the use of implicit object named “application” in Application?
Ques:- Can any one explain about the project Approximate shortest distance computing:A query dependent local landmark scheme
Right Answer:
The project "Approximate Shortest Distance Computing: A Query Dependent Local Landmark Scheme" focuses on improving the efficiency of finding the shortest path in large graphs or networks. It uses a method where specific 'landmark' nodes are selected based on the query, allowing for faster distance calculations by approximating paths rather than calculating exact distances for every node. This approach reduces computational overhead and speeds up query responses, making it suitable for applications like navigation systems and network routing.
Ques:- What is JTGrid?
Asked In :- J K Technosoft, leantaas,
Right Answer:
JTGrid is a Java-based grid component used in JSP (JavaServer Pages) applications for displaying and managing tabular data in a user-friendly format, often allowing features like sorting, filtering, and pagination.
Ques:- Write a Program using Servlet and JDBC for developing online application for displaying the details of Cars owned by the residents in XYZ society. Make necessary assumptions and create appropriate databases.
Right Answer:
```java
// CarServlet.java
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/CarServlet")
public class CarServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();

String jdbcUrl = "jdbc:mysql://localhost:3306/xyz_society";
String username = "root";
String password = "password";

try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection(jdbcUrl, username, password);
Statement statement = connection
Ques:- How clear chache and buffer of opera browser.
Right Answer:
To clear the cache and buffer in the Opera browser, follow these steps:

1. Open Opera.
2. Click on the menu icon (three horizontal lines) in the top-left corner.
3. Select "Settings."
4. Scroll down and click on "Advanced."
5. Under "Privacy and security," click on "Clear browsing data."
6. Choose the time range and check "Cached images and files."
7. Click on "Clear data."
Ques:- Can we write a class inside Jsp?
Asked In :- one advanced,
Right Answer:
Yes, we can write a class inside a JSP using scriptlets, but it's not recommended for maintainability and readability.
Comments
Admin May 17, 2020

Yes, We can , But it will be an inner class for the generated Servlet class of the JSP.

Ques:- Hi, We developed a webpage using jsp for our team, now we need to know who are employees opening this page,i.e, we need to get the windows user name when ever he/she open the page and stores into a variable. Plz help on this
Right Answer:
To get the Windows username of the user accessing a JSP page, you can use the following code snippet:

```jsp
<%
String username = request.getRemoteUser();
%>
```

Make sure your web application is configured to use container-managed security, and the server must be set up to authenticate users.
Ques:- i have one jsp page. inside this, String s=req.getParameter(“raja”);…… now we want to remove duplicate characters and o/p will be like “rj”…. what is the logic?
Comments
Admin May 17, 2020

Please check below jsp code.
<% String message= "saajin";
for (int i = 0; i < message.length(); i++){
for (int j = i + 1; j < message.length(); j++){
if (message.charAt(i) == message.charAt(j)){
message = message.substring(0,(j - 1)) +
message.substring(j + 1, message.length());
out.println("Servlet Communicate Messgen"+message);
}
}
}
%>

Ques:- how to disable the expression language in a jsp?
Right Answer:
To disable Expression Language (EL) in a JSP, you can set the `isErrorPage` attribute to `true` in the page directive and use the `page` directive to set `isErrorPage` to `true` like this:

```jsp
<%@ page isErrorPage="true" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page pageEncoding="UTF-8" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="javax.servlet.jsp.*" %>
<%@ page import="javax.servlet.jsp.tagext.*" %>
<%@ page import="javax.servlet.jsp.jstl.*" %>
<%@ page import="javax.servlet.jsp.jstl.core.*" %>
<%@ page import="javax.servlet.jsp.jstl.fmt.*"
Comments
Admin May 17, 2020

by using <%@ page isELIgnore="true"%> by placing this at the
top of the js. Then the expression language disabled.

Ques:- how to insert star image and need to rate it.. one star two star so on how to do in jsp…????
Ques:- how to write the code of jsp program?
Right Answer:
To write a JSP program, create a file with a `.jsp` extension and include HTML and JSP tags. Here’s a simple example:

```jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>My JSP Page</title>
</head>
<body>
<h1>Hello, JSP!</h1>
<%
String message = "Welcome to JSP programming!";
out.println(message);
%>
</body>
</html>
```

Save this code in a file named `example.jsp` and deploy it on a servlet container like Apache Tomcat to run it.
Ques:- how can i update the marque in jsp without changing the sourse code
Right Answer:
You can update the marquee in JSP without changing the source code by using JavaScript to modify the marquee's content dynamically. For example, you can use AJAX to fetch new content from the server and update the marquee element on the client side.
Ques:- what is the page attribute in JSP?
Asked In :-
Right Answer:
The page attribute in JSP is a directive that provides information about an individual JSP page, such as its content type, language, error handling, and session management. It is defined using the `<%@ page %>` directive at the top of the JSP file.
Comments
Admin May 17, 2020

page is an implicit object in JSP which is one among the
four scopes of the objects the other three are
request,session & application.page scope will be aquired
thru pagecontext object

Admin May 17, 2020

page derective

Ques:- what is social transformation system? any site reference? How i get requirement gathering about for it? i wanna build website on this topic
Right Answer:
A social transformation system refers to a framework or approach aimed at facilitating significant changes in societal structures, behaviors, and values to improve social conditions. To gather requirements for building a website on this topic, you can:

1. Conduct surveys or interviews with stakeholders involved in social transformation.
2. Research existing social transformation initiatives and their needs.
3. Analyze online forums and communities discussing social issues.
4. Review academic literature and case studies on social transformation.

For site references, you can explore organizations like the United Nations Development Programme (UNDP) or the World Bank, which focus on social change and development.
Ques:- write a program in javasacript to shake the window
Right Answer:
```javascript
function shakeWindow() {
const originalX = window.screenX;
const shakeDistance = 10;
const shakeTimes = 10;
let shakeCount = 0;

const shakeInterval = setInterval(() => {
if (shakeCount < shakeTimes) {
window.moveTo(originalX + (shakeCount % 2 === 0 ? shakeDistance : -shakeDistance), window.screenY);
shakeCount++;
} else {
clearInterval(shakeInterval);
window.moveTo(originalX, window.screenY); // Reset position
}
}, 100);
}

shakeWindow();
```
Ques:- How session is achieved in JSP?(once user logs out,if he press back button of browser he should not be allowed to same page)
Right Answer:
Session in JSP is achieved using the `HttpSession` object. To prevent a user from accessing a page after logging out, you can check if the session is invalidated. If it is, redirect the user to the login page. Additionally, you can set response headers to prevent caching, such as:

```java
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1
response.setHeader("Pragma", "no-cache"); // HTTP 1.0
response.setDateHeader("Expires", 0); // Proxies
```

This ensures that when the user presses the back button, they cannot access the previous page.


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