You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by cl...@gmail.com on 2009/01/27 02:14:01 UTC

passing params to action tag...

Hello,

I'm trying to use the #saction tag where I pass a parameter into the action  
being called. (Struts 2, Velocity 1.5)

Like this:

#saction( "id=vehicleAction" "namespace=/admin/fleet/vehicle" "name=search" "executeResult=true")
#sparam("name=when" "value=now")
#end

however the #end gives a parse error:  
org.apache.velocity.exception.ParseErrorException: Encountered "#end\n"....

How do you pass parameters to the #saction struts-velocity tag? Is there  
documentation somewhere that I'm missing?

Thanks,

Carlo

Re: passing params to action tag...

Posted by Dave Newton <ne...@yahoo.com>.
carlo latasa wrote:
> So I guess it's just not possible using the velocity tag equivalent. I'll
> try digging into the source.
> 
> Are the Struts 2 Velocity just not very popular and or supported?

I think the Velo tags are less popular than the JSP and FreeMarker tags, 
certainly. It's not an issue of popularity, this is an issue with 
Velocity--if the action tag was a block tag then it would always require 
an #end directive.

You could certainly request that change in a JIRA, and it's arguable 
this is one of the tags that should be a block tag for this very reason. 
That said, I'm not sure how often the action tag is used this way, 
regardless of the view layer.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: passing params to action tag...

Posted by carlo latasa <cl...@gmail.com>.
Right - duh. I knew that.

So I guess it's just not possible using the velocity tag equivalent. I'll
try digging into the source.

Are the Struts 2 Velocity just not very popular and or supported?

On Mon, Jan 26, 2009 at 5:44 PM, Dave Newton <ne...@yahoo.com> wrote:

> carlo latasa wrote:
>
>> That makes sense. It was multi-line in older versions of WebWork with
>> Velocity.
>>
>> So I'm still stuck trying to make this work....
>>
>> Is there any documentation that I'm missing? How would one do this with a
>> plain struts action tag?
>>
>
> In JSP? The way you're doing it.
>
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Carlo Latasa
Cell: (415) 385-1567

Re: passing params to action tag...

Posted by Dave Newton <ne...@yahoo.com>.
carlo latasa wrote:
> That makes sense. It was multi-line in older versions of WebWork with
> Velocity.
> 
> So I'm still stuck trying to make this work....
> 
> Is there any documentation that I'm missing? How would one do this with a
> plain struts action tag?

In JSP? The way you're doing it.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: passing params to action tag...

Posted by carlo latasa <cl...@gmail.com>.
That makes sense. It was multi-line in older versions of WebWork with
Velocity.

So I'm still stuck trying to make this work....

Is there any documentation that I'm missing? How would one do this with a
plain struts action tag?

On Mon, Jan 26, 2009 at 5:28 PM, Dave Newton <ne...@yahoo.com> wrote:

> clatasa@gmail.com wrote:
>
>> I'm trying to use the #saction tag where I pass a parameter into the
>> action being called. (Struts 2, Velocity 1.5)
>>
>> Like this:
>>
>> #saction( "id=vehicleAction" "namespace=/admin/fleet/vehicle"
>> "name=search" "executeResult=true")
>> #sparam("name=when" "value=now")
>> #end
>>
>
> I'd guess that due to Velocity issues the action tag is an inline tag
> (i.e., won't work with an #end). AFAIK only a few tags are multiline, like
> form.
>
> The source seems to confirm my suspicion. The issue is that the directives
> have to define up-front if they're inline or multiline, so for "convenience"
> most of the Velo tags are declared inline to handle the most common
> use-cases.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Carlo Latasa
Cell: (415) 385-1567

Re: passing params to action tag...

Posted by Dave Newton <ne...@yahoo.com>.
clatasa@gmail.com wrote:
> I'm trying to use the #saction tag where I pass a parameter into the 
> action being called. (Struts 2, Velocity 1.5)
> 
> Like this:
> 
> #saction( "id=vehicleAction" "namespace=/admin/fleet/vehicle" 
> "name=search" "executeResult=true")
> #sparam("name=when" "value=now")
> #end

I'd guess that due to Velocity issues the action tag is an inline tag 
(i.e., won't work with an #end). AFAIK only a few tags are multiline, 
like form.

The source seems to confirm my suspicion. The issue is that the 
directives have to define up-front if they're inline or multiline, so 
for "convenience" most of the Velo tags are declared inline to handle 
the most common use-cases.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org