how to convert a string request.Parameter to integer [duplicate]

1

In a program that I have to do I came up with this difficulty

Familia.setSalariodoPai(request.getParameter("salariodoPai"));

But this request is returning a String and I would need Integer

.obs this snippet is in a servlet doGet

    
asked by anonymous 13.03.2016 / 06:25

1 answer

3

You need to convert to Integer.

Familia.setSalariodoPai(Integer.parseInt(request.getParameter("salariodoPai")));

There are several topics explaining this, search before posting:)

    
13.03.2016 / 07:51