I had a similar problem. I renamed the called method to "doUpdate" and changed the 
name value of the submit button in the velocity template to "eventSubmit_doUpdate". 
After those changes the portlet worked. I don't know why! Perhaps anyone has an idea. 

There was also a second thing. Now my portlet works with each link starting with 
"$jslink" for the action parameter in my form. It works with $jslink and with 
$jslink.Template and so on. When I try to call my action class with the link 
$jslink.getAction(myActionName) (I think, it was this link, but I'm not quite sure), 
my action class performs two times when I press the submit button. I also can 
remember, that all doUpdate methods of the portlets in jetspeed performed after I have 
pressed the submit button in my portlet.

So, as you can see, I'm also not an expert in jetspeed. Perhaps someone else can 
explain the concept. The jetspeed documentation couldn't tell my how it works!

-----Urspr�ngliche Nachricht-----
Von: Yan Liu [mailto:[EMAIL PROTECTED]
Gesendet am: Donnerstag, 7. August 2003 19:43
An: Jetspeed Users List
Betreff: VelocityPortlet problem

I wrote a test velocity portlet which is very simple,
but it seems that after pressing the submit button, it's 
always the default vm is loaded next. I don't know if jetspeed
didn't find the right action method or in the action method, the
setTemplate() method doesn't work. Who had the same trouble before?
what to do? But some other examples from jetspeed tutorial work very fine.

Can anybody help? Thanks a lot.

Samuel

Here is the vm files, quite simple:

test-default.vm:

<form method="POST" action="$jslink.Template">
        <p>Now is step $!stepnumber</p>
        <p><input type="submit" value="goto 1" name="eventSubmit_doGMTest1"></p>
</form>

test-1.vm:

<form method="POST" action="$jslink.Template">
        <p>Now is step $!stepnumber</p>
        <p><input type="submit" value="goto 2" name="eventSubmit_doGMTest2"></p>
</form>

test-2.vm:
<p>this is the end at step $!stepnumber</p>

testActin class:

package org.apache.jetspeed.modules.actions.mytest;
.....
public class GMTestAction extends VelocityPortletAction {
    private String property_stepnumber = "stepnumber";
    public buildNormalContext(...) {}
    public void doGMTest1( RunData runData, Context myContext ) {
        myContext.put(property_stepnumber, new Integer(1));
        setTemplate(runData, "test-1");
    }
    public void doGMTest2( RunData runData, Context myContext ) {
        myContext.put(property_stepnumber, new Integer(2));
        setTemplate(runData, "test-2");
    }
}

portlet registry:(.xreg)
<registry>
  <portlet-entry name="my-test" hidden="false" type="ref"
        parent="CustomizerVelocity" application="false">
    <meta-info>
      <title>jetspeed-test</title>
      <description>test jetspeed </description>
    </meta-info>
    
<classname>org.apache.jetspeed.portal.portlets.CustomizerVelocityPortlet</classname>
    <parameter name="template" value="test-default" hidden="false"
            cachedOnName="true" cachedOnValue="true"/>
    <parameter name="cache-period-milliseconds" value="0"
            hidden="false" cachedOnName="true" cachedOnValue="true"/>
    <parameter name="action" value="mytest.GMTestAction"
            hidden="false" cachedOnName="true" cachedOnValue="true"/>
    <parameter name="stepnumber" value="0"
            hidden="false" cachedOnName="true" cachedOnValue="true"/>
    <media-type ref="html"/>
    <url cachedOnURL="true"/>
</registry>


---------------------------------------------------------------------
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