You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by "Henrik W. Hansen" <sp...@procesgruppen.dk> on 2003/04/20 19:29:33 UTC

setTemplate and $jslink.setAction

Hi all
My problem is, that I want to use $jslink.setAction() from velocity, and 
then set the template from the action. But i recieve an exception:

Horrible Exception: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



 From my template I initiate the call with:
 <a 
href="$jslink.setAction("portlets.CalendarAction").addQueryData("eventSubmit_doGetdayview","0")">Test</a>

My action looks like:
 public void doGetdayview(RunData rundata, Context context) {
        setTemplate(rundata, "calendar/calendar-dayview.vm");
}

This following works fine (ofcourse):
<form name="test" action="" method="post">
    <input type="submit" name="eventSubmit_doGetdayview" 
value="eventSubmit_doGetdayview">
</form>

How come i am not able to use setAction and then setTempate?

Best regards Henrik



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


Re: setTemplate and $jslink.setAction

Posted by "Henrik W. Hansen" <sp...@procesgruppen.dk>.
Hi
The solution was to use <a 
href="$jslink.setAction("portlets.CalendarAction").addQueryData("action","someaction")">Hit 
me</a>
This will execute the buildNormalContext action. Depending on the action 
parameter an template can be set in buildNormalContext action
if (action.equals("someaction")){
    //here a call to doGetdayview is placed.
    setTemplate(rundata,"calendar/ day.vm");
    return;
}
That did the trick.

But it would be nice if the following would go directly to the 
doGetdayview action instead being "proxyed" through the 
buildNormalContext ation:
<a href="$jslink.getPortletById( $portlet.ID  
).setAction("portlets.CalendarAction").addQueryData("eventSubmit_doGetd 
ayview","0")">Test2</a>

Best regards Henrik

David Sean Taylor wrote:

>
> On Monday, April 21, 2003, at 01:13  PM, Henrik W. Hansen wrote:
>
>> Ok. Im a trying another strategy. The following two $jslinks 
>> actually  executes the doGetdayview action:
>>    <a  
>> href="$jslink.setAction("portlets.CalendarAction").addQueryData("eventS 
>> ubmit_doGetdayview","0")">Test1</a>
>>    <a href="$jslink.getPortletById( $portlet.ID  
>> ).setAction("portlets.CalendarAction").addQueryData("eventSubmit_doGetd 
>> ayview","0")">Test2</a>
>> But I am still not able to set the template from within the  
>> doGetdayview action (or any other action executed with a $jslink). > 
>> Why?
>> The main template specified in the portlets.xreg are used instead.
>>
>> If I cannot set the template from within the action when using  
>> $jslink, then how would the above links look like, if I wanted to  
>> associate the link with at template AND an action?
>> I had hoped that something like this would work:
>> <a  href="$jslink.setTemplate("calendar/ 
>> day.vm").setAction("portlets.CalendarAction").addQueryData("eventSubmit 
>> _doGetdayview","0")">Test1</a>
>> But I cant seem to get it to work. Any suggestions?
>>
> Don't think you can do that, since the day.vm template probably does  
> not aggregate portlet content.
> Try forwarding (or redirecting) to the template in your Java after  
> executing your action
>
> -- 
> David Sean Taylor
> Bluesunrise Software
> david@bluesunrise.com
> +01 707 773-4646
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
>




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


Re: setTemplate and $jslink.setAction

Posted by David Sean Taylor <da...@bluesunrise.com>.
On Monday, April 21, 2003, at 01:13  PM, Henrik W. Hansen wrote:

> Ok. Im a trying another strategy. The following two $jslinks actually  
> executes the doGetdayview action:
>    <a  
> href="$jslink.setAction("portlets.CalendarAction").addQueryData("eventS 
> ubmit_doGetdayview","0")">Test1</a>
>    <a href="$jslink.getPortletById( $portlet.ID  
> ).setAction("portlets.CalendarAction").addQueryData("eventSubmit_doGetd 
> ayview","0")">Test2</a>
> But I am still not able to set the template from within the  
> doGetdayview action (or any other action executed with a $jslink). > Why?
> The main template specified in the portlets.xreg are used instead.
>
> If I cannot set the template from within the action when using  
> $jslink, then how would the above links look like, if I wanted to  
> associate the link with at template AND an action?
> I had hoped that something like this would work:
> <a  
> href="$jslink.setTemplate("calendar/ 
> day.vm").setAction("portlets.CalendarAction").addQueryData("eventSubmit 
> _doGetdayview","0")">Test1</a>
> But I cant seem to get it to work. Any suggestions?
>
Don't think you can do that, since the day.vm template probably does  
not aggregate portlet content.
Try forwarding (or redirecting) to the template in your Java after  
executing your action

--
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
+01 707 773-4646




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


Re: setTemplate and $jslink.setAction

Posted by "Henrik W. Hansen" <sp...@procesgruppen.dk>.
Ok. Im a trying another strategy. The following two $jslinks actually 
executes the doGetdayview action:
    <a 
href="$jslink.setAction("portlets.CalendarAction").addQueryData("eventSubmit_doGetdayview","0")">Test1</a>
    <a href="$jslink.getPortletById( $portlet.ID 
).setAction("portlets.CalendarAction").addQueryData("eventSubmit_doGetdayview","0")">Test2</a>
But I am still not able to set the template from within the doGetdayview 
action (or any other action executed with a $jslink). Why?
The main template specified in the portlets.xreg are used instead.

If I cannot set the template from within the action when using $jslink, 
then how would the above links look like, if I wanted to associate the 
link with at template AND an action?
I had hoped that something like this would work:
<a 
href="$jslink.setTemplate("calendar/day.vm").setAction("portlets.CalendarAction").addQueryData("eventSubmit_doGetdayview","0")">Test1</a>
But I cant seem to get it to work. Any suggestions?

Finally, the last alternative I can see is the $jslink.setLink(). If you 
have any examples of how to get that to work it would be appreciated.
Best regards Henrik


Henrik W. Hansen wrote:

> Hi all
> My problem is, that I want to use $jslink.setAction() from velocity, 
> and then set the template from the action. But i recieve an exception:
>
> Horrible Exception: java.lang.reflect.InvocationTargetException
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>
>
> From my template I initiate the call with:
> <a 
> href="$jslink.setAction("portlets.CalendarAction").addQueryData("eventSubmit_doGetdayview","0")">Test</a> 
>
>
> My action looks like:
> public void doGetdayview(RunData rundata, Context context) {
>        setTemplate(rundata, "calendar/calendar-dayview.vm");
> }
>
> This following works fine (ofcourse):
> <form name="test" action="" method="post">
>    <input type="submit" name="eventSubmit_doGetdayview" 
> value="eventSubmit_doGetdayview">
> </form>
>
> How come i am not able to use setAction and then setTempate?
>
> Best regards Henrik
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
>




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