Java Project Development Helps

Servlet Maven Dependencies


Servlet URL Mapping annotation

@WebServlet(name = "ImageUploadCTL", urlPatterns = { "/ImageUploadCTL" })

Image uploading Maven Dependencies

    <!-- -->

While developing a web application using JSP, Servlet, Spring, and hibernate or in Java. there are lots of utilities and methods that are required frequently, In this page, I will cover some of them and will keep updating to cover up as many as solutions.

Get path of your root folder


It will return the base path of the application.

Take a single parameter and return multiple values

String[] values = getParameterValues(“Input Parameter”);

How to encode the URL or Manage Session without cookies

String encode = response.encodeUrl(request.getContextPath());

How to set a Servlet context

String Url = "<a herf= ''>Home</a>";
ServletContext context = getServletContext();
context.setAttribute("url", Url);

get a servlet context


Send Bean Object from Servlet to JSP

request.setAttribute("bean", bean);

Get bean Object in JSP from Servlet

<jsp:useBean id="bean" class="com.travelandtour.beans.UserBean" scope="request"></jsp:useBean>