incubator-jspwiki-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Louis.Mast...@log-net.com
Subject Re: Call Plugin via Link
Date Tue, 23 Sep 2008 21:09:30 GMT
Yes, now that I look at my previous post, it would be nice of me to 
explain it.

OK, so I had the same question you had - I created a plugin and put it on 
a page, but I needed to pass in a variable before it ran.  The trouble is, 
once you invoke the page, the plugin runs immediately and does not give 
you a chance to pass anything in.  So I posted to this group and was 
tipped to use a HTTP parm and then read it from the plugin when the page 
opens.  So, to clarify, here is what happens...

1.  The link is clicked with a HTTP parm in the URL:

[http:WIDRequestDetailsHeadLess?wid=40803]

2.  The "WIDRequestDetailsHeadLess" is simply a page that invokes the 
plugin:

[{'WallyWIDDetailsPlugin'}]
(This is the entire page!)

3.  Here is the "trick"... At the beginning of the plugin is the following 
code:

                wid = c.getHttpParameter("wid");
 
                if(wid == null)
                {
                        value = params.get("wid");
                        if (value == null||((String)value).equals("")) {
                                gotError = true;
                        }
                        else
                        {
                                wid = (String)value;
                        }
                }

This block of code makes it available to be used from a link and from a 
form.  The getHttpParameter call uses the parm from the URL while the 
params.get looks for a "wid" parm from the form.

A little more clear?

-Lou


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LOG-NET, Inc.
The Logistics Network Management System
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230 Half Mile Road
Third Floor
Red Bank, NJ 07701
PH: 732-758-6800
FAX: 732-747-7497
http://www.LOG-NET.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CONFIDENTIAL & PRIVILEGED
Unless otherwise indicated or if obvious from the nature of the content, 
the information contained herein is privileged and confidential 
information/work product. The communication is intended for the use of the 
individual or entity named above.  If the reader of this transmission is 
not the intended recipient, you are  hereby notified that any 
dissemination, distribution or copying of this communication is strictly 
prohibited.  If you have received this communication in error, please 
notify the sender immediately by telephone (732-758-6800) or by electronic 
mail (postmaster@LOG-NET.com), and destroy any copies, electronic, paper 
or otherwise, which you may have of this communication.  Thank you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Benedikt Mohrmann <mohrmann@mail.upb.de> 
09/23/2008 10:59 AM
Please respond to
jspwiki-user@incubator.apache.org


To
jspwiki-user@incubator.apache.org
cc

Subject
Re: Call Plugin via Link






Hi,

first of all, thanks for the snip (it was the post I meant).
But to be honest, I do not get the trick behind this.
It would be very helpful, if you would send me a larger snip or some 
explainations (if possible).

Thanks a lot


Louis.Masters@log-net.com schrieb:
> I posted the solution to this back in june, but here is a snip:
>
> 
> OK, I may have worked out how to do this.  I created another page that
> invokes the plugin without the form (basically when the page is 
rendered).
> I added some code to the beginning of the plugin (thanks to a FAQ tip) 
> that
> looks for a HTTP parm like so:
>
> wid = c.getHttpParameter("wid");
>
> When I am linking to the page and I need to pass the wid, I use a link 
> like
> so:
>
> [http:WIDRequestDetailsHeadLess?wid=40803]
>
> Or
>
> <a href=WIDRequestDetailsHeadLess?wid=39701>39701</a>
>
> And it works great.
> 
>
> Let me know if this is unclear.
>
> -Lou
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> LOG-NET, Inc.
> The Logistics Network Management System
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 230 Half Mile Road
> Third Floor
> Red Bank, NJ 07701
> PH: 732-758-6800
> FAX: 732-747-7497
> http://www.LOG-NET.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> CONFIDENTIAL & PRIVILEGED
> Unless otherwise indicated or if obvious from the nature of the content, 

> the information contained herein is privileged and confidential 
> information/work product. The communication is intended for the use of 
the 
> individual or entity named above.  If the reader of this transmission is 

> not the intended recipient, you are  hereby notified that any 
> dissemination, distribution or copying of this communication is strictly 

> prohibited.  If you have received this communication in error, please 
> notify the sender immediately by telephone (732-758-6800) or by 
electronic 
> mail (postmaster@LOG-NET.com), and destroy any copies, electronic, paper 

> or otherwise, which you may have of this communication.  Thank you.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
> Benedikt Mohrmann <mohrmann@mail.upb.de> 
> 09/23/2008 10:25 AM
> Please respond to
> jspwiki-user@incubator.apache.org
>
>
> To
> jspwiki-user@incubator.apache.org
> cc
>
> Subject
> Call Plugin via Link
>
>
>
>
>
>
> Hi,
>
> is it possible to call a self-written plugin via a link?
> So when you click on the link, the plugin is started and returns its 
> output.
> I thought I already found an option on the homepage, but today I wasn't 
> able to get it again.
>
> Best regards
> Benedikt
>
>
> 



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message