CodesJava

Easy learning with example program codes

eclipse maven servlet hello world

Eclipse maven servlet hello world: Eclipse provides m2eclipse plugin to integrate Maven and Eclipse together. Steps to create maven java web project in eclipse: In eclipse, click… Read More

How to get attribute from session object in servlet?

HttpSession interface’s getAttribute() method is used to get attribute from session object. Syntax: public Object getAttribute(String name); Example: String value = (String) session.getAttribute(“attName”); See more at: HttpSession… Read More

How to set attribute in session object in servlet?

HttpSession interface’s setAttribute() method is used to set attribute in session object. Syntax: public void setAttribute(String name,Object value); Example: session.setAttribute(“attName”, “attValue”); See more at: HttpSession in servlet.… Read More

How to get session object?

HttpServletRequest interface’s getSession() method is used to get the session object. Syntax: HttpSession session = request.getSession(); See more at: HttpSession in servlet. Related topics What is a… Read More

error handling page in servlet

We have to use the error-page element in web.xml to specify the invocation of servlets in response to certain exceptions or HTTP status codes. How to configure… Read More

Can we call a jsp from the servlet?

Yes, we can call a jsp from the servlet using RequestDispatcher interface for example: RequestDispatcher rd=request.getRequestDispatcher("/login.jsp"); rd.forward(request,response);RequestDispatcher rd=request.getRequestDispatcher("/login.jsp"); rd.forward(request,response); Related topics What is a Web application? What… Read More

what is lazy loading in servlet?

The servlets are initialized by the container at the time of first request for the servlet. This is called lazy loading. Related topics What is a Web… Read More

What is servlet collaboration?

Servlet collaboration is a way of communication between two servlets. Servlet collaboration can be achieved by 3 ways. RequestDispatchers include() and forward() method . Using sendRedirect()method of… Read More


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap