ive created a form in which user will check off checkboxes, select radio buttons, and drop downs in 1.jsp…
i want to use the information from 1.jsp to determine the output of 2.jsp…
jsfiddle for 1.jsp: http://jsfiddle.net/VWczQ/
action="/2.jsp">
now in 2.jsp i have this:
<% if(request.getParameter("extra") != null) { %>
<page:cmsElement id="cmsContent" name="/otcmarkets/traderAndBroker/market-data-vendors/wizard-results" />
<% } else if(request.getParameter("all") != null) { %>
<page:cmsElement id="cmsContent" name="/otcmarkets/traderAndBroker/market-data-vendors/con-all" />
<% } else { %>
<h1>holy crap everything is null!!!</h1>
<% } %>
when i randomly choose options from the form everything is NULL…
what am i doing wrong?!?
You seem to be expecting that the
idattribute of the HTML input elements is been sent as request parameter name. This is wrong. It’s thenameattribute which is been sent as request parameter name. Its value is then thevalueattribtue which is been set on the named input element.So, instead of for example your incorrect check
for the following radio button
you need to get the parameter by name
choiceand test if its value isextranet.As to the
allcheckbox, I am confused. It is possible to send the both values, yet you’re checking them in anif-else. Shouldn’t theallbe inside the same radio button group? Shouldn’t you remove theelse? In any way, the point should be clear. It’s the input elements’nameattribtue which get sent as request parameter name, not theidattribute.