how to convert a request. String parameter to integer

Asked

Viewed 1,100 times

1

In a program I have to do I arose this difficulty

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

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

.Bs that stretch is on a Die doGet

  • my question seems more complete than the commented

  • But the answer you need is there. You tested?

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 :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.