I am trying to find a way to get the status (i.e. selected or unselected) of a radio group. Whatever radio button is selected, I want to get its value and store that value in a String variable. How can this be done? Thanks in advance for your help.
<%@ page import="javax.servlet.*" %>
<html>
<% if(request.getParameter("button") == "Yes"){ %>
Hello, <%= request.getParameter("usrname") %>.
<% } else { %>
Sorry, you don't want your name displayed.
<% }; %>
</html>
The problem is that the "if" statement is always returning false. I changed the "==" to "!=" and the initial condition ran. I do not see how this could be possible. Moreover, is there an implicit conversion between a "response" object and a string object for the string comparison operator or do I need to do that manually (using casting)?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.