blue-sky
blue-sky

Reputation: 53896

Request parameter in jsp page

Im setting my parameter in my jsp like so -

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

How can I access this parameter in my jsp page. This does'nt seem to be working -

<s:property value="eventName" />

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

Thanks

Upvotes: 4

Views: 31159

Answers (2)

pauld
pauld

Reputation: 41

There are some implicit objects in JSP pages that provide access to this sort of information. The one you are looking for is param. If you were writing jstl with 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>

Upvotes: 3

JB Nizet
JB Nizet

Reputation: 692261

The documentation says :

Assuming there's a request parameter myParameter (e.g. http://host/myApp/myAction.action?myParameter=one).

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

Upvotes: 12

Related Questions