Another question: why buildNormalContext is not executed when my portlet is istantiated? Is it normal? Dariush.
-----Messaggio originale----- Da: Dariush Behboudi [mailto:[EMAIL PROTECTED]] Inviato: luned� 17 febbraio 2003 16.36 A: Jetspeed-User Oggetto: Problem customizing a VelocityPortlet hi, I'm trying to understand how actions can be called from vm templates. I started from hello-velocity portlet and I created a simple action class with some actions called from the vm template. Everything works fine since I don't customize my portlet using the 'customize' option: after the customization, my portlet seem to be freeezed and actions are no longer called (it's always called the default doPerform method). Maybe I'm making a mistake? Have I to call a method to 'refresh' my portlet? follows my action code: --------------------------------- package org.apache.jetspeed.modules.actions; import org.apache.jetspeed.portal.portlets.VelocityPortlet; import org.apache.jetspeed.modules.actions.portlets.VelocityPortletAction; // Turbine stuff import org.apache.turbine.util.Log; import org.apache.turbine.util.RunData; // Velocity Stuff import org.apache.velocity.context.Context; public class SimpleVelPortletAction extends VelocityPortletAction { public void SimpleVelPortletAction() { Log log = new Log(); } public void doList(RunData data, Context context) { Log.debug("SimpleVelPortlet ->Lista"); context.put("message", "List required..."); } public void doDelete(RunData data, Context context) { Log.debug("SimpleVelPortlet ->cancellazione"); String passedId = data.getParameters().getString("passedId"); context.put("message", "Deletion required for object with id:" + passedId); } public void doAdd(RunData data, Context context) { Log.debug("SimpleVelPortlet ->aggiunta"); String passedTitle = data.getParameters().getString("passedTitle"); context.put("message", "New user required with title:" + passedTitle); } public void doUpdate(RunData data, Context context) { Log.debug("SimpleVelPortlet -> update"); String passedId = data.getParameters().getString("passedId"); context.put("message", "Update required for object with id:" + passedId); } protected void buildNormalContext( VelocityPortlet portlet, Context context, RunData rundata ) { Log.debug("SimpleVelPortlet -> Normal Context"); } public void doPerform(RunData data, Context context) { Log.debug("SimpleVelPortlet ->do Perform"); } } ---------------------------------- My xreg file: ---------------------------------- <?xml version="1.0" encoding="UTF-8"?> <registry> <portlet-entry name="SimpleVelocityPortlet" hidden="false" type="ref" parent="CustomizerVelocity" application="false"> <meta-info> <title>SimpleVelocityPortlet</title> <description>How action works</description> </meta-info> <classname>org.apache.jetspeed.portal.portlets.VelocityPortlet</classname> <parameter name="template" value="glinetemplates/simpleVelPortlet" hidden="false" cachedOnName="true" cachedOnValue="true"/> <parameter name="action" value="SimpleVelPortletAction" hidden="false" cachedOnName="true" cachedOnValue="true"/> <parameter name="text" value="Simple Velocity portlet" hidden="false" cachedOnName="true" cachedOnValue="true"/> <media-type ref="html"/> <url cachedOnURL="true"/> <category group="Jetspeed">demo</category> <category group="Jetspeed">velocity.demo</category> </portlet-entry> </registry> --------------------------- and my template: --------------------------- #if ($message != "") <center><B><I>Azione eseguita: $message</I></B></center><P> #end welcome $data.getJetspeedUser().getUserName()<br> <table border=1 bordercolor="#CCCCCC" cellpadding="5" cellspacing="0"><tr><td> <b>Ask from list</b> using form submit:<br> <li>Action :'$jslink.Template'</li> <li>submit button name:'eventSubmit_doList'</li> <form name="manageAction" action="$jslink.Template" method="post"> <input type="submit" name="eventSubmit_doList" value="List"> </td></tr> </table> <table border=1 bordercolor="#CCCCCC" cellpadding="5" cellspacing="0"><tr><td> <b>User add</b><br> <li>Action:'$jslink.Template'</li> <li>Submit button name:'eventSubmit_doAdd'</li> <P> <form name="manageAction" action="$jslink.Template" method="post"> Name:<input type="text" name="passedTitle" value=""><br> <input type="submit" name="eventSubmit_doAdd" value="Crea"> </td></tr> </table> <table border=1 bordercolor="#CCCCCC" cellpadding="5" cellspacing="0"><tr><td> <b>Update and Delete users</b> using a dinamic href call <br> <li>Action setter:'addPathInfo("eventSubmit_doDelete","")</li> <li>Parameters passed with:'addQueryData("[par_name]",[value])</li> <P> <table> <tr><td>User 1</td><td><a href="$jlink.addPathInfo("eventSubmit_doDelete","").addQueryData("passedId", 1)">Delete</a></td><td><a href="$jlink.addPathInfo("eventSubmit_doUpdate","").addQueryData("passedId", 1)">Update</a></td></tr> <tr><td>User 2</td><td><a href="$jlink.addPathInfo("eventSubmit_doDelete","").addQueryData("passedId", 2)">Delete</a></td><td><a href="$jlink.addPathInfo("eventSubmit_doUpdate","").addQueryData("passedId", 1)">Update</a></td></tr> </table> </td></tr> </table> ----------------------------------------- I'm using jetpeed 1.4b3 on Tomcat4.1LE on a XP client. Thansk a lot, Dariush. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
