Domanda

I am beginner in java and trying to figure out how to send parameter from jsp to servlet using this

inside my jsp -

<%! String option;%>
<% option = request.getParameter("option"); %>
<jsp:useBean id="processBean" scope="session" class="helpers.ProcessBean" />
${processBean.processRequest(option)}  

I want to send 'option' to processRequest but this way it is always empty string, so I am doing something wrong.Could not find anything online. Any help is highly appreciated.

È stato utile?

Soluzione

Variable declared/set on the page's scripting language is not automatically available from EL. You can manually make it available via:

<c:set var="option" value="<%= option %>" />

before using it in EL.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top