> Are you setting the action in the form action or in the form field? Ooops, should have looked down farther in your email for the answer :)
Remove this line from your html: <input type="hidden" name="action" value="portlets.SharedStateAction"/> This is what is causing turbine to prematurely fire your action before the portlet has had a chance to render. *===================================* * Scott T Weaver������������������� * * Jakarta Jetspeed Portal Project�� * * [EMAIL PROTECTED] * *===================================* � > -----Original Message----- > From: Weaver, Scott [mailto:[EMAIL PROTECTED] > Sent: Friday, June 06, 2003 3:40 PM > To: 'Jetspeed Users List' > Subject: RE: Empty Context in do* methods > > Are you setting the action in the form action or in the form field? If > so, you will not have access to the portlet because turbine excutes > actions defined in this manner prior to the portlet rendering. > > Try adding and "action" parameter to the portlets registry entry, if you > have not already done so, and do not specify the action within your form. > This way the portlet's getContent() method will invoke the action instead > of turbine. The portlet's getContent() will also "stuff" the context > things like the Portlet, PortletInstance, etc. > > hth, > *===================================* > * Scott T Weaver������������������� * > * Jakarta Jetspeed Portal Project�� * > * [EMAIL PROTECTED] * > *===================================* > > > > > -----Original Message----- > > From: Zoltan Grose [mailto:[EMAIL PROTECTED] > > Sent: Friday, June 06, 2003 1:45 PM > > To: [EMAIL PROTECTED] > > Subject: Empty Context in do* methods > > > > I'm just getting started with Jetspeed so hopefully I haven't missed > > something obvious. > > > > I am developing a Message-of-the-Day style portlet that stores its > > message as a parameter in the xreg. Everything seems to be working > > except when it goes to run my do* method, the Context is always empty > > so I can't seem to find a Portlet reference anywhere. I found a > > workaround my going to the Registry and hardcoding the name of the > > Portlet but this seems hack-ish. > > > > Do I need to configure something to get the portlet stuck into the > > context? I've run the debugger and in the call stack above me, the > > context is always empty. It is working on the build* methods, just not > > the do* method. I've snipped the relevant fragments below. > > > > -zoltan > > > > ============================= > > the .xreg: > > > > <portlet-entry name="SharedStatePortlet" hidden="false" type="ref" > > parent="GenericMVCPortlet" application="false"> > > > > <classname>org.apache.jetspeed.portal.portlets.GenericMVCPortlet</ > > classname> > > <parameter name="template" value="sharedState.jsp" > hidden="true" > > cachedOnName="true" cachedOnValue="true"/> > > <parameter name="action" value="portlets.SharedStateAction" > > hidden="true" cachedOnName="true" cachedOnValue="true"/> > > <parameter name="text" value="abc" hidden="false" > > cachedOnName="true" cachedOnValue="true"/> > > <media-type ref="html"/> > > <url cachedOnURL="true"/> > > <category group="Jetspeed">my.portlets</category> > > </portlet-entry> > > > > > > ============================= > > the .jsp: > > > > <%@ page language="java" session="false" %> > > <%@ taglib uri='/WEB-INF/templates/jsp/tld/template.tld' > > prefix='jetspeed' %> > > <p> > > Shared State Portlet > > <br/><br/> > > > > The value of 'text' is: <%= request.getAttribute("text") %> > > <form method="post" action="<jetspeed:dynamicUri/>"> > > <input type="hidden" name="js_peid" value="<%= > > request.getAttribute("js_peid") %>"> > > <input type="hidden" name="action" value="portlets.SharedStateAction"/> > > <input type="text" name="text" value="<%= request.getAttribute("text") > > %>" /> > > <input type="submit" name="eventSubmit_doUpdate" value="Change"/> > > </form> > > </p> > > > > ============================= > > the action: > > > > public class SharedStateAction extends GenericMVCAction { > > > > protected void buildNormalContext(Portlet portlet, Context context, > > RunData runData) throws Exception { > > HttpServletRequest request = runData.getRequest(); > > request.setAttribute("text", > > portlet.getPortletConfig().getInitParameter("text")); > > } > > public void doUpdate(RunData runData, Context context) { > > // would like to do this but context is always empty so where is > > the Portlet? > > //PortletConfigState.setPortletConfigParameter(portlet, "text", > > runData.getRequest().getParameter("text")); > > PortletEntry entry = > > (PortletEntry)Registry.getEntry(Registry.PORTLET, "SharedStatePortlet"); > > > > entry.getParameter("text").setValue(runData.getRequest().getParameter("t > > ext")); > > } > > > > } > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED]
