Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top