How to send a parameter to a mashlet

igo
igo's picture
User offline. Last seen 49 weeks 3 days ago. Offline
Joined: 09/23/2008
Points: 157
igo asks:

Question

Hi,

Let's say I have this mashlet

http://localhost:8080/mashlets/standalone.jsp?mashlet=StockCodeRetriever...

which has an input parameter called query which defaults to "genera". My question is: How do I send paramaters to the mashlet for it to load with the string being sent in the parameter. I wouldn't want it to load with the same default value each time it is being loaded and then changing it in Settings. Is this possible?

Thanks in advance,

igo

igo
igo's picture
User offline. Last seen 49 weeks 3 days ago. Offline
Joined: 09/23/2008
Points: 157

Answer:

Assume that your mashlet has one input parameter named "param1" and you create your mashlet directly with "Create Mashlet" option. After you publish your mashlet you'll be given 3 links. Standalone, HTML and MediaWiki. Standalone will look like this:

http://localhost:8080/mashlets/standalone.jsp?mashlet=StockResults.Mashlet

but that will load the mashlet with the default value for your input parameter. Therefore we must add this fragment

&param1=gene

which tells the mashlet "Hey you!! Use "gene" as the input parameter and forget that default value."

so your final URL will be:

http://localhost:8080/mashlets?mashlet=StockResults.Mashlet&param1=gene

Hope it helps you.

igo

"... keep mashing ..."