You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Glenn Kronschnabl <gr...@netquotient.com> on 2002/05/02 03:22:01 UTC

cooperation with struts transaction token - better than brute force?

Hi,

I'm a struts user and I use the transaction token that you can use on 
forms/urls.  However, I prefer the <c:url> syntax over <html:link> 
(especially for multiple request params).  The way I'm simulating the 
<html:link transaction="true"> right now is to do something like:

<jr:set var="token" value='<%= 
session.getAttribute("org.apache.struts.action.TOKEN") %>' />

<c:url var="editUrl" value="/main/service_edit/pre.do">
  <c:param name="org.apache.struts.taglib.html.TOKEN" value="${token}" />
  <c:param name="rateData.orderType" value="${rate.orderType}"/>
  <c:param name="accountNum" value="${acm.accountId}"/>
</c:url>
<a href='<c:out value="${editUrl}"/>' >Change</a>

but I was wondering if there is an easier way?  Could I somehow use 
cooperating tags and come up with something like <c:param> but for the 
transaction token specific?

Thanks,
Glenn




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


Re: cooperation with struts transaction token - better than brute force?

Posted by Martin Cooper <ma...@tumbleweed.com>.
I'm not sure if you could write a special tag to do this specific task, if
that's what you're asking. However, you can get rid of the scriptlet, and
the tag that's using it in your example. Instead, write the corresponding
parameter like this:

  <c:param name='org.apache.struts.taglib.html.TOKEN'
    value='${sessionScope["org.apache.struts.action.TOKEN"]}' />

Perhaps not ideal, but somewhat cleaner and simpler.

--
Martin Cooper


----- Original Message -----
From: "Glenn Kronschnabl" <gr...@netquotient.com>
To: <ta...@jakarta.apache.org>
Sent: Wednesday, May 01, 2002 6:22 PM
Subject: <c:url> cooperation with struts transaction token - better than
brute force?


> Hi,
>
> I'm a struts user and I use the transaction token that you can use on
> forms/urls.  However, I prefer the <c:url> syntax over <html:link>
> (especially for multiple request params).  The way I'm simulating the
> <html:link transaction="true"> right now is to do something like:
>
> <jr:set var="token" value='<%=
> session.getAttribute("org.apache.struts.action.TOKEN") %>' />
>
> <c:url var="editUrl" value="/main/service_edit/pre.do">
>   <c:param name="org.apache.struts.taglib.html.TOKEN" value="${token}" />
>   <c:param name="rateData.orderType" value="${rate.orderType}"/>
>   <c:param name="accountNum" value="${acm.accountId}"/>
> </c:url>
> <a href='<c:out value="${editUrl}"/>' >Change</a>
>
> but I was wondering if there is an easier way?  Could I somehow use
> cooperating tags and come up with something like <c:param> but for the
> transaction token specific?
>
> Thanks,
> Glenn
>
>
>
>
> --
> 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>