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 Todd Kuebler <tk...@cisco.com> on 2003/10/08 23:16:59 UTC

Re: / /OREF:CPT482FF Velocity context: portlet variable is null?

the guru's correct me if I'm wrong, but the context seems to be empty if 
you have defined the action class in the submit form.  The reason this 
occurs seem to be that this triggers _turbine's_ action handling (which 
doesn't create a context) instead of the Velocity Portlet handling the 
action (which does create the context).  See if you have defined

<input type="hidden" name="action" value="<your action class>">

in your submit form html, that was my problem when I had this issue.


-tk


At 02:44 PM 10/7/2003 +0200, aribic@za.safmarine.com wrote:
>Hi,
>
>I have a Velocity portlet with a  doUpdate(...) action event that is
>called when user clicks a form button.
>Problem now is that when I try to get the portlet object from
>Velocity context, null value is returned.
>
>My doUpdate(...) method looks like this:
>
>  public void doUpdate(RunData data, Context context) throws Exception
>{
>       try {
>              // get portlet reference from Velocity context
>               VelocityPortlet portlet = (VelocityPortlet) context.get
>("portlet");
>              // announce null portlet
>              if (portlet == null) {
>                   throw new NullPointerException(
>                         "Velocity context contains a null reference
>to this portlet!");
>              }
>             // use portlet object here to set Attributes!!!!
>       } catch(Exception exc) {
>                   Log.error("MyWorldClockPortlet#doUpdate:  [error] "
>, exc);
>                   throw exc;
>       }
>  }
>
>I'm very new to Jetspeed so I'm not to sure why exectly the problem
>may be occuring.
> >From what I know, Jetspeed would set the "portlet" varibale in
>Velocity context implictly.
>
>
>Alen Ribic
>
>Developer
>Safmarine Computer Services (Pty) Ltd.
>Tel: +27 21 4086588
>Fax: +27 21 4086651
>Email: aribic@za.safmarine.com
>Web: http://www.scs.co.za
>
>
>
>
>---------------------------------------------------------------------
>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