-1

I have a scheduler that updates value every 10 seconds. This scheduler is used inside a droplet. This droplet is used on a jsp page

<dsp:droplet name="/path/to/droplet/Droplet">
    <dsp:oparam name="output">
        <dsp:valueof param="myParamName"/>
    </dsp:oparam>
</dsp:droplet>

Also there's a dsp:input, that calls to javascript function whenever it's pressed. Droplet shows correct values before input is pressed and after, but in order to show new value, I have to reload the page.

My question is - how to update droplet value with ajax, without reloading the page?

Milo
  • 3,365
  • 9
  • 30
  • 44
  • Poorly asked question which is very vague. A scheduler should not be inside a droplet. A scheduler should update a value outside of the droplet. You can probably use the jquery setTimeout() to call the droplet which you will need to expose as a web service. – bated Dec 20 '17 at 20:40
  • Scheduler updates a value outside of the droplet. In droplet I just get an updated value from scheduler – Danylo Golubtsov Dec 20 '17 at 20:51
  • So then wrap a web service around the droplet and call the web service every 10 seconds using jquery setTimeout(). – bated Dec 20 '17 at 21:24

1 Answers1

0

Write an Ajax call which calls a jsp which contains the droplet call, as:

jQuery.ajax({
    type: "POST",
    url: '/newPage.jsp',
    ...

});

and in newPage.jsp put:

<dsp:droplet name="/path/to/droplet/Droplet">
    <dsp:oparam name="output">
    <dsp:valueof param="myParamName"/>
   </dsp:oparam>
</dsp:droplet>

Then schedule Ajax call when you want

pacionet
  • 183
  • 4
  • 15