Request parameter on jsp page

I set my parameter in my jsp like this:

<s:url id="open" action="viewEvent"> <s:param name="eventName" value="eventName" /> </s:url> <sj:a href="%{open}" targets="eventSearchResultsDiv">Open</sj:a> 

How do I access this option on my jsp page. This does not seem to work -

 <s:property value="eventName" /> 

Although it works - <%= request.getParameter("eventName") %>

thanks

+4
source share
2 answers

The documentation says:

Assuming there is a request parameter myParameter (for example, http: //host/myApp/myAction.action? MyParameter = one ).

 <s:property value="%{#parameters.myParameter}" /> 
+11
source

JSP pages have some implicit objects that provide access to this information. The one you are looking for is a parameter. If you write jstl using c: out, for example, you could do:

<c:out value="${param.eventName}"/>

Or in your example:

 <s:url id="open" action="viewEvent"> <s:param name="eventname" value="${param.eventName}"/> </s:url> 
+3
source

Source: https://habr.com/ru/post/1338098/


All Articles