Radio Button to Servlet?

Asked

Viewed 10 times

0

I am learning web application in college and need a lot of help from you, I have researched a lot but I have not reached any conclusion.. I’ve tried w3school and Videos in English.. I know it’s a silly question, but I’m having a lot of trouble .

I need to make an HTML calculator where it returns the value given by two numbers and the user will select by Radio Buttons which operation he will want..

HTML form

<form action="calcula" method="post"> 
Soma<Input type="radio" name="calcula" value="som"><Br>
Multiplica<Input type="radio" name="calcula" value="mult"><br> 
<input type="submit" value="calcular">
</form>

In Servlet

Int num1 = Int.parserInt(request.getParameter("num1"));

Int num2 = Int.parserInt(request.getParameter("num2"));

Int valor = Int.parserInt(request.getParameter("calcula"))

;

I want to know how to make Servlet understand the value "sound" or "mult" and do this calculation..

Thank you.. and Please is didactic I need to learn and not copy and paste saw..

No answers

Browser other questions tagged

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