开发者

Request parameter in jsp page

开发者 https://www.devze.com 2023-02-08 16:26 出处:网络
Im setting my parameter in my jsp like so - <s:url id=\"ope开发者_运维百科n\" action=\"viewEvent\">

Im setting my parameter in my jsp like so -

<s:url id="ope开发者_运维百科n" 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


The documentation says :

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

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


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消