Thank you for helping me to learn different ways to
construct a web link while passing a number of
parameters along with it.
Those hyperlinks forward a request and parameters to
another servlet action. In this servlet action, do I
receive those parameters in an usualy way?
String sort = request.getParameter("sort");
String order = request.getParameter("order");
String offset = request.getParameter("offset");
Different Ways of Constructing a Hyperlink:
<c:url var="listThreadsUrl" value="listthreads">
<c:param name="sort" value="${sort}"/>
<c:param name="order" value="${order}"/>
<c:param name="offset" value="${offset}"/>
</c:url>
<a href='<c:out value="${listThreadsUrl}"/>'>
Click Me
</a>
Depending on how your Actions are setup you may be
able to do this:
<html-el:link action="${listThreadUrl}">
Click Me
</html-el>
James Mitchell gave this example a few weeks ago:
<jsp:useBean id="myLinkParams"
class="java.util.HashMap"/>
<c:set target="${myLinkParams}" property="id"
value="${dto.id}"/>
<c:set target="${myLinkParams}" property="type"
value="edit"/>
...later down the page...
<html:link action="/manageUserAccount"
name="myLinkParams">
<bean:message key="edit.user.link.text"/>
</html:link>
--- Ron Grabowski <[EMAIL PROTECTED]> wrote:
> > 1. what is the JSTL equivalent of the <%else {%>
> ...
> > <%}%> tag?
>
> The c:choose, c:when, and c:otherwise tags:
>
> http://tinyurl.com/2kqlz
>
> > 2. how to write a <html:link ....> tag to replace
> the
> > <a href ... > tag while passing a number of
> > parameters?
>
> You could do this:
>
> <c:url var="listThreadsUrl" value="listthreads">
> <c:param name="sort" value="${sort}"/>
> <c:param name="order" value="${order}"/>
> <c:param name="offset" value="${offset}"/>
> </c:url>
>
> <a href='<c:out value="${listThreadsUrl}"/>'>
> Click Me
> </a>
>
> Depending on how your Actions are setup you may be
> able to do this:
>
> <html-el:link action="${listThreadUrl}">
> Click Me
> </html-el>
>
> James Mitchell gave this example a few weeks ago:
>
> > <jsp:useBean id="myLinkParams"
> class="java.util.HashMap"/>
> > <c:set target="${myLinkParams}" property="id"
> value="${dto.id}"/>
> > <c:set target="${myLinkParams}" property="type"
> value="edit"/>
> >
> > ...later down the page...
> >
> > <html:link action="/manageUserAccount"
> > name="myLinkParams">
> > <bean:message key="edit.user.link.text"/>
> > </html:link>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]