Thanks !
It works great now! 
(the action defined in the form came from an example i found in the tutorial)

The only thing, is that in the portletlink tag i have (1.4b4), there's no
"template" attribute, so i did not put it. then the form action url looks a
bit awkward:
http://myhost/ThingWeb/portal/user/admin/page/default.psml/media-type/html?ac
tion=controls.Maximize

Is this normal?

I guess I can close the bug on bugzilla... or change its component to
"documentation" ;) I guess I'll leave the decision up to you!

Thanks again. 

greg

-----Original Message-----
From: Weaver, Scott [mailto:[EMAIL PROTECTED]
Sent: mardi 9 septembre 2003 19:19
To: 'Jetspeed Users List'
Subject: RE: setTemplate using JSPAction (or even
GenericMVCPortlet/PortletAction now)


I see your problem, you have defined your action within the form, this is
causing turbine to execute your action before the portlet can.  This is why
there is no context available, the GenericMVCPortlet creates it before
invoking the action nut it never makes it there because Turbine is calling
the action.

Remove the action field and make sure you have your action defined at the
registry level.

Try this (I have removed the action field and changed your form action)

<form name="form" action="<js:portletlink template=""  />" method="get">
 <input type="hidden" name="js_peid" value="<%=jspeid%>"/>
 <input type="submit" name="eventSubmit_doSearch" value="Search">
 <input type="reset" value="Clear Fields">
 <input type="text" name="thingieid" size="20">
</form>

*===================================*
* Scott T Weaver������������������� *
* Jakarta Jetspeed Portal Project�� *
* [EMAIL PROTECTED] *
*===================================*
� 


> -----Original Message-----
> From: Gregory Joseph [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 09, 2003 10:57 AM
> To: Jetspeed Users List
> Subject: RE: setTemplate using JSPAction (or even
> GenericMVCPortlet/PortletAction now)
> 
> Through form submission, my form looks like: (removed useless html stuff)
> 
> <form name="form" action="http://myhost/ThingWeb/portal"; method="get">
>  <input type="hidden" name="js_peid" value="<%=jspeid%>"/>
>  <input type="hidden" name="action" value="ThingieSearchAction"/>
>  <input type="submit" name="eventSubmit_doSearch" value="Search">
>  <input type="reset" value="Clear Fields">
>  <input type="text" name="thingieid" size="20">
> </form>
> 
> I'm starting to believe there's something wrong there :/
> (my action is executed, though, since i also added result display in the
> "main" template, to check that)
> 
> greg
> 
> -----Original Message-----
> From: Weaver, Scott [mailto:[EMAIL PROTECTED]
> Sent: mardi 9 septembre 2003 15:06
> To: '[EMAIL PROTECTED]'
> Subject: RE: setTemplate using JSPAction (or even
> GenericMVCPortlet/PortletAction now)
> 
> 
> Gregory,
> 
> How are you invoking the action when this fails?  Is it through a form
> submission or directly through a link?  If it is a form, what is the
> "action"
> attribute set to?
> 
> 
> Regards,
> *===================================*
> * Scott T Weaver������������������� *
> * Jakarta Jetspeed Portal Project�� *
> * [EMAIL PROTECTED] *
> *===================================*
> 
> 
> 
> > -----Original Message-----
> > From: Gregory Joseph [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, September 09, 2003 8:20 AM
> > To: Jetspeed Developers List
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: setTemplate using JSPAction (or even
> > GenericMVCPortlet/PortletAction now)
> >
> > Hi Scott,
> >
> > I was really glad to get your mail, but unfortunately it still doesn't
> > work
> > :/
> > Below is a copy of my registry, as it was, and as i modified it
> following
> > your example. But still no luck.
> > My action was a subclass of JspPortletAction, I made it a subclass of
> > GenericMVCAction, but still no luck. It seems like
> "VelocityActionContext"
> > thingie is never instanciated as it should for the setTemplate method to
> > work.
> > I will file a bug on bugzilla... but in the mean time, is there anything
> > else
> > I can do or try?
> >
> > Thanks again
> >
> > greg
> > ====================
> >
> > Here's how my registry looked like:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <registry>
> > <portlet-entry name="Thingie" hidden="false" type="ref"
> >                parent="GenericMVCPortlet" application="false">
> >   <meta-info>
> >     <title>Thingieportlet</title>
> >     <description>
> >       Allows to search thingies using various search criterias.
> >     </description>
> >   </meta-info>
> >   <parameter name="viewtype" value="Jsp" hidden="true"/>
> >   <parameter name="template" value="thingie/searchform.jsp"
> > hidden="false"/>
> >   <parameter name="action" hidden="true" value="ThingieSearchAction" />
> >   <media-type ref="html"/>
> >   <category>company</category>
> >   <category>company.thingie</category>
> > </portlet-entry>
> >
> > </registry>
> >
> >
> > Here's how I modified it following your example:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <registry>
> >
> > <portlet-entry name="CompanyMVCPortlet" hidden="false"
> application="false"
> >                type="abstract">
> >   <security-ref parent="default"/>
> >
> >
> <classname>org.apache.jetspeed.portal.portlets.GenericMVCPortlet</classnam
> > e>
> >   <parameter name="viewtype" value="JSP" hidden="false"
> >              cachedOnName="true" cachedOnValue="true"/>
> >   <url cachedOnURL="true"/>
> >   <category group="Jetspeed">company</category>
> > </portlet-entry>
> >
> > <portlet-entry name="Thingie" hidden="false" application="false"
> >                type="ref" parent="JspMVCPortlet">
> >   <security-ref parent="default"/>
> >   <meta-info>
> >     <title>Thingie portlet</title>
> >     <description>Allows to search thingies using various search
> > criterias.</description>
> >   </meta-info>
> >
> >
> <classname>org.apache.jetspeed.portal.portlets.GenericMVCPortlet</classnam
> > e>
> >   <parameter name="template" value="thingie/searchform.jsp"
> >              hidden="false" cachedOnName="true" cachedOnValue="true"/>
> >   <parameter name="action" value="ThingieSearchAction"
> >              hidden="false" cachedOnName="true" cachedOnValue="true"/>
> >   <parameter name="provides.customization" value="true"
> >              hidden="false" cachedOnName="true" cachedOnValue="true"/>
> >   <media-type ref="html"/>
> >   <url cachedOnURL="true"/>
> >   <category>company.thingie</category>
> > </portlet-entry>
> > </registry>
> >
> >
> > -----Original Message-----
> > From: Weaver, Scott [mailto:[EMAIL PROTECTED]
> > Sent: mardi 9 septembre 2003 0:14
> > To: 'Jetspeed Users List'
> > Cc: 'Jetspeed Developers List'
> > Subject: RE: setTemplate using JSPAction (or even
> > GenericMVCPortlet/PortletAction now)
> >
> >
> > Please post a snippet of your registry.  That would help us immensely.
> > Some
> > quick thoughts:
> >
> > 1. In viewtype, Jsp needs to be all caps
> >
> > <parameter name="viewtype" value="JSP" hidden="false"
> > cachedOnName="true" cachedOnValue="true"/>
> >
> > The GenericMVCAction.setTemplate(RunData, String) also works fine for me
> > within my JSP portlet action.  I will give you some example reg entries.
> > Maybe that will help you in getting started:
> >
> > (Excuse the formatting)
> >
> > A nice base for JSP portlets using MVC:
> >
> > <portlet-entry name="JspMVCPortlet" hidden="false" type="abstract"
> >    application="false">
> >  <security-ref parent="default"/>
> >  <classname>
> >    org.apache.jetspeed.portal.portlets.GenericMVCPortlet
> >  </classname>
> >  <parameter name="viewtype" value="JSP" hidden="false"
> >       cachedOnName="true" cachedOnValue="true"/>
> >  <url cachedOnURL="true"/>
> >  <category group="Jetspeed">jsp</category>
> > </portlet-entry>
> >
> >
> >
> >
> > And here is an example of its use:
> >
> > <portlet-entry name="BaseHTMLPortlet" hidden="false" type="ref"
> >     parent="JspMVCPortlet" application="false">
> >  <security-ref parent="default"/>
> >  <meta-info>
> >    <title>Editable  Free-Form HTML portlet generator</title>
> >      <description>Use this this portlet generator to create
> >                   editable free-form HTML portlets.
> >      </description>
> >  </meta-info>
> >  <!-- Make sure this is the GenericMVCPortlet, or a subclass of it. -->
> >  <classname>
> >    org.apache.jetspeed.portal.portlets.GenericMVCPortlet
> >  </classname>
> >  <!-- My default template -->
> >  <parameter name="template" value="essential/editor/document.jsp"
> >       hidden="false" cachedOnName="true" cachedOnValue="true"/>
> > <!-- My action, make sure it is a subclass of GenericeMVCAction -->
> >  <parameter name="action"
> >     value="portlets.freeform.FreeformPortletAction"
> >     hidden="false" cachedOnName="true" cachedOnValue="true"/>
> > <!-- So we can use our own configure screens -->
> >  <parameter name="provides.customization" value="true"
> >     hidden="false" cachedOnName="true" cachedOnValue="true"/>
> >
> > <!-- I left out a bunch of parameters
> >    - that are not relative to the example
> >  -->
> >
> >  <media-type ref="html"/>
> >  <url cachedOnURL="true"/>
> > </portlet-entry>
> >
> >
> > HTH,
> > *===================================*
> > * Scott T Weaver������������������� *
> > * Jakarta Jetspeed Portal Project�� *
> > * [EMAIL PROTECTED] *
> > *===================================*
> >
> >
> >
> > > -----Original Message-----
> > > From: Gregory Joseph [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, September 08, 2003 1:02 PM
> > > To: Jetspeed Users List
> > > Cc: [EMAIL PROTECTED]
> > > Subject: RE: setTemplate using JSPAction (or even
> > > GenericMVCPortlet/PortletAction now)
> > >
> > > I am now using the GenericMVCPortlet, with an additional parameter in
> my
> > > local-portlets.xreg (viewtype=Jsp), but still no success: when i
> examine
> > > what
> > > is going on in the setTemplate method, i see usage of the
> > > getTemplateContext
> > > method from the TemplateInfo object of my rundata. If I look in
> > > templateInfo,
> > > i can see 3 "tempKeys", namely "VelocityActionContext",
> > "VELOCITY_CONTEXT"
> > > and "00layout_template00", the 1st one being an instance of
> > > GenericActionContext, but with no available keys(this is where the
> > > nullpointerexception is thrown i think), the 2nd being an instance of
> > > VelocityContext, with a number of keys, but none of them being
> > "template",
> > > and the last one being a string("/default.jsp")
> > >
> > > I really don't know what to do. I expect I'm not the only one using
> > > multiple
> > > views on the same portlet right!?
> > >
> > > Thanks for any help.
> > >
> > > greg
> > >
> > > -----Original Message-----
> > > From: Gregory Joseph
> > > Sent: vendredi 5 septembre 2003 18:28
> > > To: Jetspeed Users List
> > > Subject: RE: setTemplate using JSPAction
> > >
> > >
> > > Maybe this should be forwarded to the dev-ml.
> > > Anyway, I included the complete stacktrace below if that can help.
> > >
> > > -----Original Message-----
> > > From: Gregory Joseph
> > > Sent: vendredi 5 septembre 2003 17:52
> > > To: Jetspeed Users List
> > > Subject: setTemplate using JSPAction
> > >
> > >
> > > Hi list,
> > >
> > > In my action class extending jspAction, i try to use the setTemplate
> > > method,
> > > but it doesn't work. I throws a NullPointerException somewhere when
> > trying
> > > to
> > > retrieve a "VelocityPortletContext" (how surprising when working with
> a
> > > JSPPortlet) Besides, I had to catch this exception myself, otherwise
> it
> > > wasn't appearing anywhere in the logs, not even a single error
> > message...
> > >
> > > I found this had been fixed a while ago:
> > > http://www.mail-archive.com/jetspeed-
> > [EMAIL PROTECTED]/msg07770.html
> > > Bug when looking on the cvs view, i see there's been some refactoring
> > > afterwards, so i think the issue might have re-appeared.
> > >
> > > Can someone confirm and/or propose a solution?
> > >
> > > my code simply looks like:
> > >
> > > //.....blahblah do stuff
> > > setTemplate(rundata, "mypage.jsp");
> > >
> > > But then the portlet still displays the original template (the one set
> > in
> > > the
> > > xreg file).
> > > (I also tried without the .jsp extension, but result is exactly the
> > same)
> > >
> > >
> > > ---------------------------------------------------------------------
> > > java.lang.NullPointerException
> > >         at
> > >
> >
> org.apache.jetspeed.modules.actions.portlets.PortletAction.getPortlet(Port
> > > let
> > > Action.java:208)
> > >         at
> > >
> >
> org.apache.jetspeed.modules.actions.portlets.PortletAction.setTemplate(Por
> > > tle
> > > tAction.java:169)
> > >         at
> > > com.company.web.actions.SearchAction.doSearch(SearchAction.java:81)
> > >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >         at
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > 39)
> > >         at
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> > > pl.
> > > java:25)
> > >         at java.lang.reflect.Method.invoke(Method.java:324)
> > >         at
> > >
> >
> org.apache.jetspeed.modules.actions.portlets.PortletActionEvent.fireEvent(
> > > Por
> > > tletActionEvent.java:215)
> > >         at
> > >
> >
> org.apache.jetspeed.modules.actions.portlets.PortletActionEvent.executeEve
> > > nts
> > > (PortletActionEvent.java:176)
> > >         at
> > >
> >
> org.apache.jetspeed.modules.actions.portlets.GenericMVCAction.perform(Gene
> > > ric
> > > MVCAction.java:148)
> > >         at
> > > org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:122)
> > >         at
> > >
> >
> org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:143)
> > >         at org.apache.turbine.modules.Page.build(Page.java:90)
> > >         at
> > org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123)
> > >         at org.apache.turbine.Turbine.doGet(Turbine.java:563)
> > >         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > >         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > >         at
> > >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown
> > > Source)
> > >         at
> > > org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown
> > > Source)
> > >         at
> org.apache.catalina.core.StandardWrapperValve.invoke(Unknown
> > > Source)
> > >         at
> > >
> >
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv
> > > oke
> > > Next(Unknown Source)
> > >         at org.apache.catalina.core.StandardPipeline.invoke(Unknown
> > > Source)
> > >         at org.apache.catalina.core.ContainerBase.invoke(Unknown
> Source)
> > >         at
> org.apache.catalina.core.StandardContextValve.invoke(Unknown
> > > Source)
> > >         at
> > >
> >
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv
> > > oke
> > > Next(Unknown Source)
> > >         at org.apache.catalina.core.StandardPipeline.invoke(Unknown
> > > Source)
> > >         at org.apache.catalina.core.ContainerBase.invoke(Unknown
> Source)
> > >         at org.apache.catalina.core.StandardContext.invoke(Unknown
> > Source)
> > >         at org.apache.catalina.core.StandardHostValve.invoke(Unknown
> > > Source)
> > >         at
> > >
> >
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv
> > > oke
> > > Next(Unknown Source)
> > >         at
> > org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown
> > > Source)
> > >         at
> > >
> >
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv
> > > oke
> > > Next(Unknown Source)
> > >         at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown
> > > Source)
> > >         at
> > >
> >
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv
> > > oke
> > > Next(Unknown Source)
> > >         at org.apache.catalina.core.StandardPipeline.invoke(Unknown
> > > Source)
> > >         at org.apache.catalina.core.ContainerBase.invoke(Unknown
> Source)
> > >         at org.apache.catalina.core.StandardEngineValve.invoke(Unknown
> > > Source)
> > >         at
> > >
> >
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv
> > > oke
> > > Next(Unknown Source)
> > >         at org.apache.catalina.core.StandardPipeline.invoke(Unknown
> > > Source)
> > >         at org.apache.catalina.core.ContainerBase.invoke(Unknown
> Source)
> > >         at
> > >
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
> > >         at
> > >
> >
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
> > >         at
> > >
> >
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processCon
> > > nec
> > > tion(Http11Protocol.java:392)
> > >         at
> > >
> >
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
> > >         at
> > >
> >
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.j
> > > ava
> > > :619)
> > >         at java.lang.Thread.run(Thread.java:536)
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to