You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Zahid Rahman <za...@gmail.com> on 2019/11/22 03:06:17 UTC
Update views how to ?
Hi,
I have an admin screen (jsp) where the administrator updates values i.e.
current weather temperature, cricket , football score, death counter
showing people killed by knife crime in a city, natural causes , car
accidents etc.
I have at least two users who are looking at the current temperature or
game score etc. (JSP).
Once the administrator updates the values , the data viewed by the two users
In their browser is now stale data , due to the fact the web browser is
based on a stateless pull model.
Is there an example app or maven archetype which shows how I can update
or refresh the views (JSPs viewed in browser) in all the user sessions
[views ] from inside the running application server using the struts2
framework.
Re: Update views how to ?
Posted by Zahid Rahman <za...@gmail.com>.
Many Thanks Huzaifah,
For my application idea, your information certainly would have met my
requirement and I found your message very helpful and I am very
appreciative.
In the past however I have done a system work around in an ill-conceived
commercially available system architecture and detected another system work
in another system architecture.
In all good conscious I was not happy with the system work around I did.
But it was at the end of a project.
All in the space of one two months.
Coming across one system work around in an application developers career is
one too many.
So for this reason I will try and apply the chat application first as
suggested by Yasser. If that doesn't meet my requirement then I will try
your suggestions.
Regards
zahid
On Fri, 22 Nov 2019 at 03:27, M Huzaifah <mh...@gmail.com> wrote:
> Hi,
>
> You should use stream mecanism for that case. What i've done, i used JMS,
> message-broker, which mean the browser always listen to message-broker
> server using websocket (STOMP,AMQP,etc). When backend push message to the
> broker server, browser automatically receive and render the message to the
> browser. I use ActiveMQ over MQTT, and render the message using javascript
> in browser.
>
> You can find another stream mecanism or reactive application example out
> there.
>
> Regards
>
> On Fri, Nov 22, 2019, 10:06 Zahid Rahman <za...@gmail.com> wrote:
>
> > Hi,
> >
> > I have an admin screen (jsp) where the administrator updates values i.e.
> > current weather temperature, cricket , football score, death counter
> > showing people killed by knife crime in a city, natural causes , car
> > accidents etc.
> >
> >
> > I have at least two users who are looking at the current temperature or
> > game score etc. (JSP).
> >
> > Once the administrator updates the values , the data viewed by the two
> > users
> > In their browser is now stale data , due to the fact the web browser is
> > based on a stateless pull model.
> >
> > Is there an example app or maven archetype which shows how I can update
> > or refresh the views (JSPs viewed in browser) in all the user sessions
> > [views ] from inside the running application server using the struts2
> > framework.
> >
>
Re: Update views how to ?
Posted by M Huzaifah <mh...@gmail.com>.
Hi Yasser,
Thank you for your information, glad to hear that struts2 going to have
Async actions support. until this day, i use DWR for sync and Async.
this feature make me easy build app using strtus2.
Regards
On Sun, Nov 24, 2019 at 3:09 PM Yasser Zamani <ya...@apache.org>
wrote:
> Hi Zahid,
>
> Additionally, AFAIK...
>
> If your users are a lot, then I think you have to wait for Struts 2.6
> release where I've added support for Async actions. For an instance usage
> see my example at [1] (you can try it via running Struts 2.6 snapshot
> showcase - it's a simple chat room i.e. classic usage of server push).
>
> Otherwise or anyway, for now, you can try if Struts ExecAndWait is able to
> handle your users.
>
> Regards.
>
> [1]
> https://github.com/apache/struts/pull/179/commits/aee171c3b8ad401006612c4df44ed540fb2ed7e3
>
> >-----Original Message-----
> >From: M Huzaifah <mh...@gmail.com>
> >Sent: Friday, November 22, 2019 6:57 AM
> >To: Struts Users Mailing List <us...@struts.apache.org>
> >Subject: Re: Update views how to ?
> >
> >Hi,
> >
> >You should use stream mecanism for that case. What i've done, i used JMS,
> >message-broker, which mean the browser always listen to message-broker
> server
> >using websocket (STOMP,AMQP,etc). When backend push message to the broker
> >server, browser automatically receive and render the message to the
> browser. I
> >use ActiveMQ over MQTT, and render the message using javascript in
> browser.
> >
> >You can find another stream mecanism or reactive application example out
> there.
> >
> >Regards
> >
> >On Fri, Nov 22, 2019, 10:06 Zahid Rahman <za...@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> I have an admin screen (jsp) where the administrator updates values
> i.e.
> >> current weather temperature, cricket , football score, death counter
> >> showing people killed by knife crime in a city, natural causes , car
> >> accidents etc.
> >>
> >>
> >> I have at least two users who are looking at the current temperature
> >> or game score etc. (JSP).
> >>
> >> Once the administrator updates the values , the data viewed by the two
> >> users In their browser is now stale data , due to the fact the web
> >> browser is based on a stateless pull model.
> >>
> >> Is there an example app or maven archetype which shows how I can
> >> update or refresh the views (JSPs viewed in browser) in all the user
> >> sessions [views ] from inside the running application server using the
> >> struts2 framework.
> >>
>
Re: Update views how to ?
Posted by Zahid Rahman <za...@gmail.com>.
You're welcome.
If you look in the inside front cover of a book called professional java
server pages by wrox press.
It is a rather an old book now but wasn't when I first bought it.
https://www.amazon.co.uk/Professional-Programming-JavaServer-Enterprise-Javaspaces/dp/1861002777
.
ISBN-13: 978-1861002778, ISBN-10: 1861002777. Such an old book now, the
price is now is next to nothing. £0.83 GBP.
There is a top level design, diagrammatic view of technologies in the
inside front cover. A person of your technological mind set and ability
will see immediately what I mean.
When I looked at it I always felt from experience and observation of
application development (good and bad), JSPs , Bean in application
container with
Socket streams in web browser was the missing piece and was the route of
the application thread travel. This application thread is both simple yet
flexible whilst guaranteeing data integrity.
On Sun, 24 Nov 2019, 12:13 Yasser Zamani, <ya...@apache.org> wrote:
> Thank you so much Zahid! you made my day :)
>
> As far as I can recall there aren't too much to do to release Struts 2.6.
> I hope it's going to be soon :)
>
> Regards.
>
> >-----Original Message-----
> >From: Zahid Rahman <za...@gmail.com>
> >Sent: Sunday, November 24, 2019 2:10 PM
> >To: Struts Users Mailing List <us...@struts.apache.org>
> >Subject: Re: Update views how to ?
> >
> >The advantages you have outlined in file
> ><apps/showcase/src/main/webapp/async/index.html> (quoted below) is
> >precisely the reason for my post . Now I feel struts2 is a complete
> framework for
> >any imaginable application. Struts 2 is now a simple yet powerful ,
> adaptable
> >framework. Please do what you need to do for version
> >2.6 to refine the last piece.
> >
> >
> >
> ><br/>
> ><h2>Example: A minimal chat room using server push</h2> <h3>Open current
> >page in different tabs, browsers and computers then send messages.</h3>
> ><h4>This is a minimal chat room which uses server push to retrieve new
> >messages.
> >It doesn't poll the server frequently to check if a new message is
> available to
> >display.
> >Instead it waits for the server to push back new messages. This approach
> has two
> >obvious advantages:
> >low-lag communication without requests being sent, and no waste of server
> >resources and network bandwidth.</h4>
> ><h5>Reference: <a href="
> >https://www.javaworld.com/article/2077995/java-concurrency/java-
> >concurrency-asynchronous-processing-support-in-servlet-3-0.html
> >">
> >Asynchronous processing support in Servlet 3.0</a></h5>
> >
> >
> >On Sun, 24 Nov 2019, 08:09 Yasser Zamani, <ya...@apache.org>
> wrote:
> >
> >> Hi Zahid,
> >>
> >> Additionally, AFAIK...
> >>
> >> If your users are a lot, then I think you have to wait for Struts 2.6
> >> release where I've added support for Async actions. For an instance
> >> usage see my example at [1] (you can try it via running Struts 2.6
> >> snapshot showcase - it's a simple chat room i.e. classic usage of
> server push).
> >>
> >> Otherwise or anyway, for now, you can try if Struts ExecAndWait is
> >> able to handle your users.
> >>
> >> Regards.
> >>
> >> [1]
> >> https://github.com/apache/struts/pull/179/commits/aee171c3b8ad40100661
> >> 2c4df44ed540fb2ed7e3
> >>
> >> >-----Original Message-----
> >> >From: M Huzaifah <mh...@gmail.com>
> >> >Sent: Friday, November 22, 2019 6:57 AM
> >> >To: Struts Users Mailing List <us...@struts.apache.org>
> >> >Subject: Re: Update views how to ?
> >> >
> >> >Hi,
> >> >
> >> >You should use stream mecanism for that case. What i've done, i used
> >> >JMS, message-broker, which mean the browser always listen to
> >> >message-broker
> >> server
> >> >using websocket (STOMP,AMQP,etc). When backend push message to the
> >> >broker server, browser automatically receive and render the message
> >> >to the
> >> browser. I
> >> >use ActiveMQ over MQTT, and render the message using javascript in
> >> browser.
> >> >
> >> >You can find another stream mecanism or reactive application example
> >> >out
> >> there.
> >> >
> >> >Regards
> >> >
> >> >On Fri, Nov 22, 2019, 10:06 Zahid Rahman <za...@gmail.com> wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> I have an admin screen (jsp) where the administrator updates
> >> >> values
> >> i.e.
> >> >> current weather temperature, cricket , football score, death
> >> >> counter showing people killed by knife crime in a city, natural
> >> >> causes , car accidents etc.
> >> >>
> >> >>
> >> >> I have at least two users who are looking at the current
> >> >> temperature or game score etc. (JSP).
> >> >>
> >> >> Once the administrator updates the values , the data viewed by the
> >> >> two users In their browser is now stale data , due to the fact the
> >> >> web browser is based on a stateless pull model.
> >> >>
> >> >> Is there an example app or maven archetype which shows how I can
> >> >> update or refresh the views (JSPs viewed in browser) in all the
> >> >> user sessions [views ] from inside the running application server
> >> >> using the
> >> >> struts2 framework.
> >> >>
> >>
>
RE: Update views how to ?
Posted by Yasser Zamani <ya...@apache.org>.
Thank you so much Zahid! you made my day :)
As far as I can recall there aren't too much to do to release Struts 2.6. I hope it's going to be soon :)
Regards.
>-----Original Message-----
>From: Zahid Rahman <za...@gmail.com>
>Sent: Sunday, November 24, 2019 2:10 PM
>To: Struts Users Mailing List <us...@struts.apache.org>
>Subject: Re: Update views how to ?
>
>The advantages you have outlined in file
><apps/showcase/src/main/webapp/async/index.html> (quoted below) is
>precisely the reason for my post . Now I feel struts2 is a complete framework for
>any imaginable application. Struts 2 is now a simple yet powerful , adaptable
>framework. Please do what you need to do for version
>2.6 to refine the last piece.
>
>
>
><br/>
><h2>Example: A minimal chat room using server push</h2> <h3>Open current
>page in different tabs, browsers and computers then send messages.</h3>
><h4>This is a minimal chat room which uses server push to retrieve new
>messages.
>It doesn't poll the server frequently to check if a new message is available to
>display.
>Instead it waits for the server to push back new messages. This approach has two
>obvious advantages:
>low-lag communication without requests being sent, and no waste of server
>resources and network bandwidth.</h4>
><h5>Reference: <a href="
>https://www.javaworld.com/article/2077995/java-concurrency/java-
>concurrency-asynchronous-processing-support-in-servlet-3-0.html
>">
>Asynchronous processing support in Servlet 3.0</a></h5>
>
>
>On Sun, 24 Nov 2019, 08:09 Yasser Zamani, <ya...@apache.org> wrote:
>
>> Hi Zahid,
>>
>> Additionally, AFAIK...
>>
>> If your users are a lot, then I think you have to wait for Struts 2.6
>> release where I've added support for Async actions. For an instance
>> usage see my example at [1] (you can try it via running Struts 2.6
>> snapshot showcase - it's a simple chat room i.e. classic usage of server push).
>>
>> Otherwise or anyway, for now, you can try if Struts ExecAndWait is
>> able to handle your users.
>>
>> Regards.
>>
>> [1]
>> https://github.com/apache/struts/pull/179/commits/aee171c3b8ad40100661
>> 2c4df44ed540fb2ed7e3
>>
>> >-----Original Message-----
>> >From: M Huzaifah <mh...@gmail.com>
>> >Sent: Friday, November 22, 2019 6:57 AM
>> >To: Struts Users Mailing List <us...@struts.apache.org>
>> >Subject: Re: Update views how to ?
>> >
>> >Hi,
>> >
>> >You should use stream mecanism for that case. What i've done, i used
>> >JMS, message-broker, which mean the browser always listen to
>> >message-broker
>> server
>> >using websocket (STOMP,AMQP,etc). When backend push message to the
>> >broker server, browser automatically receive and render the message
>> >to the
>> browser. I
>> >use ActiveMQ over MQTT, and render the message using javascript in
>> browser.
>> >
>> >You can find another stream mecanism or reactive application example
>> >out
>> there.
>> >
>> >Regards
>> >
>> >On Fri, Nov 22, 2019, 10:06 Zahid Rahman <za...@gmail.com> wrote:
>> >
>> >> Hi,
>> >>
>> >> I have an admin screen (jsp) where the administrator updates
>> >> values
>> i.e.
>> >> current weather temperature, cricket , football score, death
>> >> counter showing people killed by knife crime in a city, natural
>> >> causes , car accidents etc.
>> >>
>> >>
>> >> I have at least two users who are looking at the current
>> >> temperature or game score etc. (JSP).
>> >>
>> >> Once the administrator updates the values , the data viewed by the
>> >> two users In their browser is now stale data , due to the fact the
>> >> web browser is based on a stateless pull model.
>> >>
>> >> Is there an example app or maven archetype which shows how I can
>> >> update or refresh the views (JSPs viewed in browser) in all the
>> >> user sessions [views ] from inside the running application server
>> >> using the
>> >> struts2 framework.
>> >>
>>
Re: Update views how to ?
Posted by Zahid Rahman <za...@gmail.com>.
The advantages you have outlined in file
<apps/showcase/src/main/webapp/async/index.html> (quoted below) is
precisely the reason for my post . Now I feel struts2 is a complete
framework for any imaginable application. Struts 2 is now a simple yet
powerful , adaptable framework. Please do what you need to do for version
2.6 to refine the last piece.
<br/>
<h2>Example: A minimal chat room using server push</h2>
<h3>Open current page in different tabs, browsers and computers then send
messages.</h3>
<h4>This is a minimal chat room which uses server push to retrieve new
messages.
It doesn't poll the server frequently to check if a new message is
available to display.
Instead it waits for the server to push back new messages. This approach
has two obvious advantages:
low-lag communication without requests being sent, and no waste of server
resources and network bandwidth.</h4>
<h5>Reference: <a href="
https://www.javaworld.com/article/2077995/java-concurrency/java-concurrency-asynchronous-processing-support-in-servlet-3-0.html
">
Asynchronous processing support in Servlet 3.0</a></h5>
On Sun, 24 Nov 2019, 08:09 Yasser Zamani, <ya...@apache.org> wrote:
> Hi Zahid,
>
> Additionally, AFAIK...
>
> If your users are a lot, then I think you have to wait for Struts 2.6
> release where I've added support for Async actions. For an instance usage
> see my example at [1] (you can try it via running Struts 2.6 snapshot
> showcase - it's a simple chat room i.e. classic usage of server push).
>
> Otherwise or anyway, for now, you can try if Struts ExecAndWait is able to
> handle your users.
>
> Regards.
>
> [1]
> https://github.com/apache/struts/pull/179/commits/aee171c3b8ad401006612c4df44ed540fb2ed7e3
>
> >-----Original Message-----
> >From: M Huzaifah <mh...@gmail.com>
> >Sent: Friday, November 22, 2019 6:57 AM
> >To: Struts Users Mailing List <us...@struts.apache.org>
> >Subject: Re: Update views how to ?
> >
> >Hi,
> >
> >You should use stream mecanism for that case. What i've done, i used JMS,
> >message-broker, which mean the browser always listen to message-broker
> server
> >using websocket (STOMP,AMQP,etc). When backend push message to the broker
> >server, browser automatically receive and render the message to the
> browser. I
> >use ActiveMQ over MQTT, and render the message using javascript in
> browser.
> >
> >You can find another stream mecanism or reactive application example out
> there.
> >
> >Regards
> >
> >On Fri, Nov 22, 2019, 10:06 Zahid Rahman <za...@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> I have an admin screen (jsp) where the administrator updates values
> i.e.
> >> current weather temperature, cricket , football score, death counter
> >> showing people killed by knife crime in a city, natural causes , car
> >> accidents etc.
> >>
> >>
> >> I have at least two users who are looking at the current temperature
> >> or game score etc. (JSP).
> >>
> >> Once the administrator updates the values , the data viewed by the two
> >> users In their browser is now stale data , due to the fact the web
> >> browser is based on a stateless pull model.
> >>
> >> Is there an example app or maven archetype which shows how I can
> >> update or refresh the views (JSPs viewed in browser) in all the user
> >> sessions [views ] from inside the running application server using the
> >> struts2 framework.
> >>
>
RE: Update views how to ?
Posted by Yasser Zamani <ya...@apache.org>.
Hi Zahid,
Additionally, AFAIK...
If your users are a lot, then I think you have to wait for Struts 2.6 release where I've added support for Async actions. For an instance usage see my example at [1] (you can try it via running Struts 2.6 snapshot showcase - it's a simple chat room i.e. classic usage of server push).
Otherwise or anyway, for now, you can try if Struts ExecAndWait is able to handle your users.
Regards.
[1] https://github.com/apache/struts/pull/179/commits/aee171c3b8ad401006612c4df44ed540fb2ed7e3
>-----Original Message-----
>From: M Huzaifah <mh...@gmail.com>
>Sent: Friday, November 22, 2019 6:57 AM
>To: Struts Users Mailing List <us...@struts.apache.org>
>Subject: Re: Update views how to ?
>
>Hi,
>
>You should use stream mecanism for that case. What i've done, i used JMS,
>message-broker, which mean the browser always listen to message-broker server
>using websocket (STOMP,AMQP,etc). When backend push message to the broker
>server, browser automatically receive and render the message to the browser. I
>use ActiveMQ over MQTT, and render the message using javascript in browser.
>
>You can find another stream mecanism or reactive application example out there.
>
>Regards
>
>On Fri, Nov 22, 2019, 10:06 Zahid Rahman <za...@gmail.com> wrote:
>
>> Hi,
>>
>> I have an admin screen (jsp) where the administrator updates values i.e.
>> current weather temperature, cricket , football score, death counter
>> showing people killed by knife crime in a city, natural causes , car
>> accidents etc.
>>
>>
>> I have at least two users who are looking at the current temperature
>> or game score etc. (JSP).
>>
>> Once the administrator updates the values , the data viewed by the two
>> users In their browser is now stale data , due to the fact the web
>> browser is based on a stateless pull model.
>>
>> Is there an example app or maven archetype which shows how I can
>> update or refresh the views (JSPs viewed in browser) in all the user
>> sessions [views ] from inside the running application server using the
>> struts2 framework.
>>
Re: Update views how to ?
Posted by M Huzaifah <mh...@gmail.com>.
Hi,
You should use stream mecanism for that case. What i've done, i used JMS,
message-broker, which mean the browser always listen to message-broker
server using websocket (STOMP,AMQP,etc). When backend push message to the
broker server, browser automatically receive and render the message to the
browser. I use ActiveMQ over MQTT, and render the message using javascript
in browser.
You can find another stream mecanism or reactive application example out
there.
Regards
On Fri, Nov 22, 2019, 10:06 Zahid Rahman <za...@gmail.com> wrote:
> Hi,
>
> I have an admin screen (jsp) where the administrator updates values i.e.
> current weather temperature, cricket , football score, death counter
> showing people killed by knife crime in a city, natural causes , car
> accidents etc.
>
>
> I have at least two users who are looking at the current temperature or
> game score etc. (JSP).
>
> Once the administrator updates the values , the data viewed by the two
> users
> In their browser is now stale data , due to the fact the web browser is
> based on a stateless pull model.
>
> Is there an example app or maven archetype which shows how I can update
> or refresh the views (JSPs viewed in browser) in all the user sessions
> [views ] from inside the running application server using the struts2
> framework.
>