Out of curioisty....what abstraction does Struts provide to avoid the mapping that you are talking about. I thought it is pretty standard to use the "*.do" kinda mappings.


From: Kris Schneider <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: <html:link/> & URL Parameters
Date: Thu, 11 Sep 2003 22:10:10 -0400

Whenever I see literals that are tied to the servlet mapping's URL pattern (for example, "/toModule.do" or "/do/editSubscription"), I get the feeling that the abstractions provided by Struts aren't being fully utilized.

"It's a pity that html:link doesn't allow multiple parameters":
As mentioned in a previous note (and not just in this thread), that's exactly what the "name" attribute is for!


"c:url should allow writing a message"
No, it's for rendering URL's, not markup. From a Struts perspective, think <html:rewrite>, not <html:link>.


Carlos Sanchez wrote:
I agree, but when you want to put static parameters in the jsp I use c:url
with html-el:link instead.

    <c:url var="homeURL" value="/toModule.do">
        <c:param name="prefix" value=""/>
        <c:param name="page" value="/MainPage.do"/>
    </c:url>
    <html-el:link href="${homeURL}">
        <fmt:message key="DefaultSidebar.home"/>
    </html-el:link>

It's a pity that html:link doesn't allow multiple parameters, or maybe c:url
should allow writing a message.




-----Mensaje original-----
De: Kris Schneider [mailto:[EMAIL PROTECTED] Enviado el: jueves, 11 de septiembre de 2003 20:20
Para: Struts Users Mailing List
Asunto: Re: <html:link/> & URL Parameters



I'm as fond of JSTL as the next developer, but it's a case-by-case basis as to whether it trumps Struts (or any other) tags. The big win with using <html:link>, or <html-el:link>, is the ability to leverage the path of your actions:


<html:link action="/path/to/action" ...

They also have built-in support for maps as a collection of request parameters. <c:url>, on the other hand, requires the use of <c:param> child elements, one per parameter. So, especially for a Struts app, I'd say <c:url> is much *less* sophisticated.

And then there's transaction control token support...

For your specific case (as Robert replied):

<html:link action="/viewOrder"
          paramId="orderNo"
          paramName="order"
          paramProperty="ponum">
View Order
</html:link>

If you need multiple request parameters, make use of a map:

<html:link action="/viewOrder"
          name="paramMap">
View Order
</html:link>

Or:

<html:link action="/viewOrder"
          name="someBean"
          property="paramMap">
View Order
</html:link>

http://jakarta.apache.org/struts/userGuide/struts-html.html#link

Quoting Pat Quinn <[EMAIL PROTECTED]>:


Cheers guys i'll have a look into JSTL URL.



From: Vic Cekvenic <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: <html:link/> & URL Parameters
Date: Thu, 11 Sep 2003 08:39:14 -0400

Consider using JSTL URL for link, it is much more sophisticated. hth,
.V

Pat Quinn wrote:

Hi Guys,

I trying to use the <html:link/> tag library with dynamic url parameters
e.g (which doesn't work).



<html:link action="/viewOrder.do?orderNo=<c:out value="${order.ponum}"/>">View Order</html:link>



How should i do this with out using the standard HTML Href tag?

-- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Get a FREE computer virus scan online from McAfee. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to