Jeremy, I think I finally found the error!!!
To call the doAddLink event, I'm using a button with a javascript call on
the onclick:
...
<SCRIPT LANGUAGE="JavaScript">
function updateLinks() { window.location =
'$jslink.addQueryData("js_peid",
$portlet.ID).addQueryData("eventSubmit_doAddlinks", "1")'; }
</script>
...
but this javascript code was embedded inside this form:
<form name="article" method="post" enctype="multipart/form-data"
action='$jslink.getAction("IngresoArticulosPortletsAction")'>
...
</form>
And I removed the getAction() from the "action" part of the form, and it
finally works!
Very very thanks for your help, it was really helpful!!
Best Regards,
Carlos.
"Jeremy Ford" <[EMAIL PROTECTED]>
01-07-2004 14:55
Por favor, responda a
"Jetspeed Users List" <[EMAIL PROTECTED]>
Para
[EMAIL PROTECTED]
cc
[EMAIL PROTECTED]
Asunto
RE: Template question
Send the vms and the xreg first. Also, if you could, sent the parent
Portlets xreg fragment (if there is one).
Jeremy
>From: [EMAIL PROTECTED]
>Reply-To: "Jetspeed Users List" <[EMAIL PROTECTED]>
>To: "Jetspeed Users List" <[EMAIL PROTECTED]>
>Subject: RE: Template question
>Date: Thu, 1 Jul 2004 13:05:43 -0400
>
>Jeremy, first of all, thank you for the time expending in my problem.
>I did exactly what you say, and your example works perfect, but when I
>replicate your coding to my app, it still failed. It's a very strange
>problem; I've been checked a lot of times my code, and can't find the
>problem.
>Can I send you my whole files to see if you find my mistake??
>
>Thank you very much!
>
>
>
>
>"Jeremy Ford" <[EMAIL PROTECTED]>
>30-06-2004 19:43
>Por favor, responda a
>"Jetspeed Users List" <[EMAIL PROTECTED]>
>
>
>Para
>"'Jetspeed Users List'" <[EMAIL PROTECTED]>
>cc
><[EMAIL PROTECTED]>
>Asunto
>RE: Template question
>
>
>
>
>
>
>Here, try the following:
>
>Place the 2 vm files in your portlets/html directory.
>
>Use the following xreg entry:
>
><portlet-entry name="TestMVC" hidden="false" type="ref"
>application="false"
>parent="Velocity">
> <meta-info>
> <title>MVC Test</title>
> <description>Test MVC</description>
> </meta-info>
> <parameter name="template" value="test" hidden="true"/>
> <parameter name="viewtype" value="Velocity" hidden="true"/>
> <parameter name="action" value="portlets.TestMVCAction"
>hidden="true"/>
> <media-type ref="html"/>
> <category>search</category>
> </portlet-entry>
>
>Use this action:
>
>package org.apache.jetspeed.modules.actions.portlets;
>
>import org.apache.jetspeed.portal.portlets.VelocityPortlet;
>import org.apache.turbine.util.RunData;
>import org.apache.velocity.context.Context;
>
>public class TestMVCAction extends VelocityPortletAction {
> protected void buildNormalContext(VelocityPortlet
>portlet, Context
>context,
> RunData rundata) throws
>Exception {
>
> context.put("bnc", "BNC: works");
> }
>
> public void doEdit(RunData rundata, Context context)
> {
> this.setTemplate(rundata, "test2",
true);
> }
>
> public void doAddlinks(RunData rundata, Context
context)
>{
> context.put("links", "5");
> }
>
>}
>
>Does this work for? Does it work how you expected it too?
>
>Jeremy Ford
>[EMAIL PROTECTED]
>
>
>
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, June 30, 2004 4:29 PM
>To: Jetspeed Users List
>Subject: Re: Template question
>
>I'm using Jetspeed 1.5.
>
>
>
>
>
>"Jeremy Ford" <[EMAIL PROTECTED]>
>30-06-2004 15:52
>Por favor, responda a
>"Jetspeed Users List" <[EMAIL PROTECTED]>
>
>
>Para
>[EMAIL PROTECTED]
>cc
>[EMAIL PROTECTED]
>Asunto
>Re: Template question
>
>
>
>
>
>
>Sorry if you've answered this before, but what version of Jetspeed are
you
>
>
>using? If you are using 1.4b4 or earlier, then you need to explicitly
>call
>buildNormalContext.
>
>Jeremy Ford
>[EMAIL PROTECTED]
>
>
> >From: [EMAIL PROTECTED]
> >Reply-To: "Jetspeed Users List" <[EMAIL PROTECTED]>
> >To: "Jetspeed Users List" <[EMAIL PROTECTED]>
> >Subject: Re: Template question
> >Date: Wed, 30 Jun 2004 11:55:50 -0400
> >
> >Jeremy, the URL doesn't specified the action, only the event...
> >
> >After a few tries, finally I could display the template as I wished.
This
> >is what I did:
> >
> >In the doEdit event method, the line where I set the template, changes
> >from:
> >
> >setTemplate(rundata, "addArticle");
> >setTemplate(rundata, "addArticle", true);
> >
> >BUT....
> >
> >when I call the doAddLinks event from the addArticle template, the data
> >putted in context isn't read in the next render of the addArticle
> >template.
> >
> >What could be wrong??
> >
> >Regards.
> >
> >
> >
> >
> >"Jeremy Ford" <[EMAIL PROTECTED]>
> >29-06-2004 13:31
> >Por favor, responda a
> >"Jetspeed Users List" <[EMAIL PROTECTED]>
> >
> >
> >Para
> >[EMAIL PROTECTED]
> >cc
> >
> >Asunto
> >Re: Template question
> >
> >
> >
> >
> >
> >
> >What does the url look like that executes the event? If the action is
> >specified, try removing it.
> >
> >Jeremy Ford
> >[EMAIL PROTECTED]
> >
> >
> > >From: [EMAIL PROTECTED]
> > >Reply-To: "Jetspeed Users List" <[EMAIL PROTECTED]>
> > >To: "Jetspeed Users List" <[EMAIL PROTECTED]>
> > >Subject: Re: Template question
> > >Date: Tue, 29 Jun 2004 10:07:53 -0400
> > >
> > >Any ideas???
> > >
> > >
> > >
> > >
> > >
> > >[EMAIL PROTECTED]
> > >25-06-2004 16:11
> > >Por favor, responda a
> > >"Jetspeed Users List" <[EMAIL PROTECTED]>
> > >
> > >
> > >Para
> > >[EMAIL PROTECTED]
> > >cc
> > >
> > >Asunto
> > >Template question
> > >
> > >
> > >
> > >
> > >
> > >
> > >Hi.. I'll try to explain my problem... hope you can undertand it.
> > >I've a VelocityPortlet with his default template. This template shows
a
> > >list of articles already stored in the db, and has a link to add a
new
> > >one: $jslink?eventSubmit_doEdit=
> > >
> > >This method (doEdit) only set a template wich has the input fields:
> > >
> > > public void doEdit(RunData rundata, Context context) throws
> >Exception
> > >{
> > > String id = rundata.getParameters().getString(ID);
> > > if (id!=null){
> > > ArticlesManager mng = new ArticlesManager();
> > > Article article = mng.getArticle(new
> > >Long(id).longValue());
> > > context.put("article", article);
> > > }
> > > context.put("totalLinks", new Integer(0));
> > > setTemplate(rundata, "addArticle");
> > > }
> > >
> > >Until here, everything goes fine...
> > >
> > >My problem is that I need to send some info from this template
> >(addArticle
> > >
> > >- not the default) and come back to the same template, and always,
> >despite
> > >
> > >of explicity set the template in the event method, the flow of the
> > >application goes to the default template.
> > >
> > >This is the event I'm calling:
> > >
> > > public void doAddlinks(RunData rundata, Context context)
>throws
> > >Exception {
> > > ...
> > > int totalLinks =
> >rundata.getParameters().getInt("totalLinks",
> > >0);
> > >
> > > ...
> > >
> > > context.put("totalLinks", new Integer(totalLinks));
> > > setTemplate(rundata, "addArticle");
> > > }
> > >
> > >please, any help would be very appreciated.
> > >
> > >regards,
> > >Carlos.
> > >
> > >
> >
> >_________________________________________________________________
> >MSN Movies - Trailers, showtimes, DVD's, and the latest news from
> >Hollywood!
> >http://movies.msn.click-url.com/go/onm00200509ave/direct/01/
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>_________________________________________________________________
>FREE pop-up blocking with the new MSN Toolbar ? get it now!
>http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
>
>
>---------------------------------------------------------------------
>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]
_________________________________________________________________
>From ?will you?? to ?I do,? MSN Life Events is your resource for Getting
Married. http://lifeevents.msn.com/category.aspx?cid=married
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]