UrbanPro
true

Ask a Pro

UrbanPro has lakhs of Expert Tutors and Trainers to answer your Questions.

?

Questions Guidelines

  • Start your question with simple statements like "what", "when", "where", or "how".
  • Ensure your question or answer is not offensive or insensitive - it may be voted down or banned.
  • Please provide as much detail as possible as this will allow our members to better understand and respond to your question.
  • Take some time to categorize your question. This will greatly help other users find the question.

You can add upto 6 Images

How it works?

Trending Discussions

A

Anubhav 13/11/2024 in  IT Courses/Java/Servlet

Which is a good refrence book for Servlets and JSP?

0 0

Balmukund replied | 1 day ago

  • Head First Servlets and JSP (Basham, Sierra, Bates): best for beginners, very visual, and good for exam prep. It’s older, but the fundamentals are unchanged.
  • Murach’s Java Servlets and JSP: clear, practical, with full examples. Good for building real apps.
  • Core Servlets and JavaServer Pages (Marty Hall): detailed reference. Free tutorials are at coreservlets.com.
  • Jakarta EE Tutorial (free, official): up to date for the current spec

D

Deepani 30/05/2024 in  IT Courses/Java/JSP (Java Server Pages)

How do you redirect from one JSP page to another in Java?

0 0

Balmukund replied | 2 days ago

  • Redirect (new request, URL changes):
jsp
 <% response.sendRedirect("page2.jsp"); %>
  • Forward (server-side, URL stays, request data kept):
jsp
 <jsp:forward page="page2.jsp" />
  • Link: <a href="page2.jsp">Go</a>

Call either before any output, and add return; after it.

N

Nagaraj 30/05/2024 in  IT Courses/Java/JSP (Java Server Pages)

Can you create several sessions for one user using JSP servlets in Java?

0 0

Balmukund replied | 2 days ago

Yes, but not within a single browser session.

  • Different browsers, devices or incognito windows: each gets its own JSESSIONID cookie, so the same user can have several sessions at once. This is automatic.
  • Same browser: all tabs share one HttpSession per web app, because they share the cookie.
  • Simulating several sessions in one browser: store separate data under different keys, for example session.setAttribute("cart_" + tabId, cart).
  • Tracking a user’s sessions: keep a Map<String, List<HttpSession>> and update it with an HttpSessionListener or HttpSessionBindingListener.
  • Limiting to one session: on login, find the user’s old session in that map and call invalidate().

Y

Yash 30/05/2024 in  IT Courses/Java/JSP (Java Server Pages)

What is the role of JavaServer Pages (JSP) in front-end development with Java?

0 0

Balmukund replied | 2 days ago

JSP is Java’s server-side view layer. It generates HTML dynamically.

  • Role: mixes HTML with Java data (via JSTL and Expression Language) to build the page sent to the browser.
  • In MVC: the servlet or controller is the logic, and the JSP is the View.
  • How it works: the container compiles each JSP into a servlet on first request.
  • Features: includes, custom tags, form handling, session and request data access.
  • Best practice: no Java scriptlets (<% %>). Use JSTL and EL, and keep logic in servlets or classes.
  • Limits: it is server-rendered, so it is not interactive like React or Vue. Real front-end behavior still needs HTML, CSS and JavaScript.
  • Today: still used in legacy and enterprise apps. Newer projects often use Thymeleaf or a JS front end with a REST API.

K

Kiran 30/05/2024 in  IT Courses/Java/JSP (Java Server Pages)

How do I generate a certification report in Java Servlets and JSP from MYSQL database?

0 0

Balmukund replied | 2 days ago

@WebServlet("/certificate")
public class CertificateServlet extends HttpServlet {
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String id = req.getParameter("id");
try (Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/mydb", "user", "pass");
PreparedStatement ps = con.prepareStatement(
"SELECT student_name, course, issue_date, grade FROM certificates WHERE id = ?")) {
ps.setInt(1, Integer.parseInt(id));
ResultSet rs = ps.executeQuery();
if (rs.next()) {
req.setAttribute("name", rs.getString("student_name"));
req.setAttribute("course", rs.getString("course"));
req.setAttribute("date", rs.getDate("issue_date"));
req.setAttribute("grade", rs.getString("grade"));
req.getRequestDispatcher("certificate.jsp").forward(req, res);
} else {
res.sendError(404, "Certificate not found");
}
} catch (Exception e) {
throw new ServletException(e);
}
}
}

Balmukund replied | 1 day ago

Main exam: CUET-UG (conducted by NTA). It’s used for BA admission at Delhi University, BHU, JNU, and other central and many state universities.

Other routes:

  • Merit-based: many state and private colleges admit on Class 12 marks (usually 45-50% minimum), with no entrance test.
  • University-specific tests: some private universities, such as Christ University, run their own entrance exams.
  • BA LLB: CLAT, AILET, SLAT or CUET.
  • Specialised BA (fine arts, music, journalism): often an additional audition, portfolio or interview.

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more