function SubmitDefault() {
form.....action.value = "MyDefaultPortletAction";
form.....template.value = "MyDefaultTemplate.vm" ;
}
function SubmitToUpdate() {
form.....action.value = "MyUpdatePortletAction";
form.....template.value = "MyUpdateTemplate.vm" ;
}
...
What are the reasons to use several action and template variables ?
[EMAIL PROTECTED] wrote:
This seems great.. What is the argument against just makeing this part of
the VelocityPortlet? Currently I have a single .vm file and a huge case
statement to deal with the various screens, very crufty!
Eric
-----Original Message-----
From: Luta, Raphael (VUN) [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 27, 2003 5:51 AM
To: 'Jetspeed Users List'
Subject: RE: Flow and State of a portlet
De : Wei Guan [mailto:[EMAIL PROTECTED]]
First, I would like to say: Great job.This is not possible in the default VelocityPortlet but it's very easy to implement.
I am still puzzling on how to build highly-interactive portlet. Here is a user case:
1) the default template is page1.vm rendering default data prepared by buildNormalConent of Action1.java
2) on page1.vm, there are couple of links, each link will result an action, generate different data and need diifferent templates to render. For example, there is a link "link1" on page1.vm:
page1.vm ---link1--->method in action1---->page2.vm.
I think this is the sequence in JetSpeed
1) action1.buildNormalContent ---> page1.vm
2) --->link1--->method in action1 -->action1.buildNormalContent--->action1.setTempate(page2.vm)-
-->page2.vm.
I am looking for a solution like this.
1) action1.buildNormalContent ---> page1.vm
2) --->link1--->method in action2 -->action2.buildNormalContent--->action2.setTempate(page2.vm)-
-->page2.vm.
For example:
Assumption: you can define a new non-conflicting parameter name
that will handle the state of your portlet, let's say "pstate".
1- Update your portlet Regsitry definition to have:
<parameter name="action" value="MyDefaultPortletAction" />
<parameter name="template" value="MyDefaultTemplate.vm" />
<parameter name="action.update" value="MyActionInStateUpdate" />
<parameter name="template.update" value="MyUpdateTemplate.vm" />
<parameter name="action.browse" value="MyActionInStateBrowse" />
<parameter name="template.browse" value="MyDeleteTemplate.vm" />
etc...
2- Apply the following patch to VelocityPortlet:
Index: VelocityPortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/Velo
cityPortlet.java,v
retrieving revision 1.20
diff -r1.20 VelocityPortlet.java
159c159,170
< String template = getPortletConfig().getInitParameter("template");
---
String state = data.getParameters().getString("pstate");getPortletConfig().getInitParameter(templateName);
String templateName = "template";
String actionName = "action";
if ((state != null) && (!state.equals("")))
{
templateName = templateName + "." + state;
actionName = actionName + "." + state;
}
String template =
181c192
< String actionName = getPortletConfig().getInitParameter("action");
---
String actionName =getPortletConfig().getInitParameter(actionName);
Et voila, your portlet now gives you basic built-in controller capabilities
so that you don't even have to use "setTemplate" unless you want to redirect your user to a non-standard state template, plus you would have the
following flow control:
- page1.vm
- link1
- actionX.doEvent (depends on the "action" paramater included in the link)
- go to state 2
- action2.buildContext
- page2.vm
--
Rapha�l Luta - [EMAIL PROTECTED]
Jakarta Jetspeed - Enterprise Portal in Java
http://jakarta.apache.org/jetspeed/
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
