Frage

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.

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top