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 Yan Liu <ya...@hotpop.com> on 2003/08/07 19:42:42 UTC

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: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org