You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alex Paransky <al...@individualnetwork.com> on 2002/01/21 19:38:53 UTC

Question on forwarding/redirecting/href usage...

When I use ActionForward I supply it the Context-relative URI to which
control should be forwarded.  However, when I want to use <a href="..." I
cannot use the Context-relative URI.  Thus my returnTo= backlink works
correctly if I use it with the ActionForward, but fails to work when used
with <a href tag.

Is there a BEAN/TAG/METHOD that would convert a Context-relative URI to
something that I can use with an anchor tag?  I guess I could always call
request.getContext() and prepend that to the URI, however, this will only
work if the URI is context-relative.  In case URI is page-relative, no such
append is needed.  Is there something in JSP/Servlet/Struts that would do
these checks for me?

Thanks.
-AP_



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Question on forwarding/redirecting/href usage...

Posted by Alex Paransky <al...@individualnetwork.com>.
I looked at html:link, and it seems to require using a Map class to pass
parameters to the link.  Seems like a lot of setup, and scriplet code (which
I am not crazy about) just to generate
/school/maintenance.jsp?schoolId=223&context=ready.  Is there an easier way
to do this?

Here is how I imagine the code would look like with the current STRUTS
html:link tag:

<bean:define id="schoolId" name="school" property="id"/>
<bean:define id="contextMode" name="school" property="context"/>

<%
Map map = new HashMap();
map.put("schoolId", schoolId);
map.put("context", contextMode);
%>

<html:link href="/school/maintenance.jsp" name="map" />

I would rather see syntax like this:

<html:link href="/school/maintenance.jsp">
  <html:linkParam id="schoolId" name="school" property="id"/>
  <html:linkParam id="context" name="school" property="context"/>
</html>

The map, is a good feature, but it's TOO dynamic in this case.  I could
create my own tag, but I thought I would ask around before re-inventing the
wheel.

Thanks.
-AP_

-----Original Message-----
From: neel [mailto:neelesh@sunnyind.com]
Sent: Monday, January 21, 2002 11:25 AM
To: Struts Users Mailing List
Subject: RE: Question on forwarding/redirecting/href usage...


try using <html:link page="..."></html:link> instead of <a href=""></a>

-- Original Message --

>When I use ActionForward I supply it the Context-relative URI to which
>control should be forwarded.  However, when I want to use <a href="..."
I
>cannot use the Context-relative URI.  Thus my returnTo= backlink works
>correctly if I use it with the ActionForward, but fails to work when used
>with <a href tag.
>
>Is there a BEAN/TAG/METHOD that would convert a Context-relative URI to
>something that I can use with an anchor tag?  I guess I could always call
>request.getContext() and prepend that to the URI, however, this will only
>work if the URI is context-relative.  In case URI is page-relative, no
such
>append is needed.  Is there something in JSP/Servlet/Struts that would
do
>these checks for me?
>
>Thanks.
>-AP_
>
>
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>




--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Question on forwarding/redirecting/href usage...

Posted by neel <ne...@sunnyind.com>.
try using <html:link page="..."></html:link> instead of <a href=""></a>

-- Original Message --

>When I use ActionForward I supply it the Context-relative URI to which
>control should be forwarded.  However, when I want to use <a href="..."
I
>cannot use the Context-relative URI.  Thus my returnTo= backlink works
>correctly if I use it with the ActionForward, but fails to work when used
>with <a href tag.
>
>Is there a BEAN/TAG/METHOD that would convert a Context-relative URI to
>something that I can use with an anchor tag?  I guess I could always call
>request.getContext() and prepend that to the URI, however, this will only
>work if the URI is context-relative.  In case URI is page-relative, no
such
>append is needed.  Is there something in JSP/Servlet/Struts that would
do
>these checks for me?
>
>Thanks.
>-AP_
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>