How to pass information from a JSP page to a Servlet

2

I need to pass information from a String variable that is on a JSP page to a Servlet. For example:

String path="C: \ test.jpg";

How do I get this information in the Servlet?

    
asked by anonymous 22.09.2016 / 19:28

1 answer

3

To get the value of a form field or parameter value of a query string, use the getParameter() method of the request object.

url: www.teste.com?parametro=teste

How to get the value in the servlet:

String param = request.getParameter("parametro");

If the value is an integer or another type, a type conversion is required because the http protocol works only with text or everything is a string.

    
22.09.2016 / 19:37