2 deleted 3 characters in body; edited tags
source | link

I currently have a basic j2ee website. Currently, a jsp frontend gets data from the backend (the java program, lets call it object "Score"). The backend gets this data from a web site.

<% Main m = new Main(5); %>
<table style="width: 100%">
  <tr>
    <th align="left">NBA</th>
    <th style="text-align: right"><%=m.getTime("nba")%></th>
  </tr>
</table>
<% Iterator itrNba = m.getNbaM().entrySet().iterator();
   for (Map.Entry<Integer, Match> entry : m.getNbaM().entrySet()) {
     Match value = entry.getValue(); %>

However, this only happens once. If the user wants new data, they have to refresh the page, the backend will run the algorithm to populate some objects (hashmapsHashMaps), and the jsp displays the values.

The backend data is sports scores and I want this to be a live feed. Therefore I have to make the back end poll the source, and the front end poll the backend (not necessarily the same intervals either).

How can I make my data objects persist? With my current implementation, every time the page is loaded, a new Score, when Score should be the same for all clients (the frontend jsp). So I made my data objects static and I put the main entry point in a loop, and it isnt working.

Im thinking my main java Scores object needs to be run as a service. Do I need to use servlets here?

Is there an easy way to accomplish what ImI'm describing?

I currently have a basic j2ee website. Currently, a jsp frontend gets data from the backend (the java program, lets call it object "Score"). The backend gets this data from a web site.

<% Main m = new Main(5); %>
<table style="width: 100%">
  <tr>
    <th align="left">NBA</th>
    <th style="text-align: right"><%=m.getTime("nba")%></th>
  </tr>
</table>
<% Iterator itrNba = m.getNbaM().entrySet().iterator();
   for (Map.Entry<Integer, Match> entry : m.getNbaM().entrySet()) {
     Match value = entry.getValue(); %>

However, this only happens once. If the user wants new data, they have to refresh the page, the backend will run the algorithm to populate some objects (hashmaps), and the jsp displays the values.

The backend data is sports scores and I want this to be a live feed. Therefore I have to make the back end poll the source, and the front end poll the backend (not necessarily the same intervals either).

How can I make my data objects persist? With my current implementation, every time the page is loaded, a new Score, when Score should be the same for all clients (the frontend jsp). So I made my data objects static and I put the main entry point in a loop, and it isnt working.

Im thinking my main java Scores object needs to be run as a service. Do I need to use servlets here?

Is there an easy way to accomplish what Im describing?

I currently have a basic j2ee website. Currently, a jsp frontend gets data from the backend (the java program, lets call it object "Score"). The backend gets this data from a web site.

<% Main m = new Main(5); %>
<table style="width: 100%">
  <tr>
    <th align="left">NBA</th>
    <th style="text-align: right"><%=m.getTime("nba")%></th>
  </tr>
</table>
<% Iterator itrNba = m.getNbaM().entrySet().iterator();
   for (Map.Entry<Integer, Match> entry : m.getNbaM().entrySet()) {
     Match value = entry.getValue(); %>

However, this only happens once. If the user wants new data, they have to refresh the page, the backend will run the algorithm to populate some objects (HashMaps), and the jsp displays the values.

The backend data is sports scores and I want this to be a live feed. Therefore I have to make the back end poll the source, and the front end poll the backend (not necessarily the same intervals either).

How can I make my data objects persist? With my current implementation, every time the page is loaded, a new Score, when Score should be the same for all clients (the frontend jsp). So I made my data objects static and I put the main entry point in a loop, and it isnt working.

Im thinking my main java Scores object needs to be run as a service. Do I need to use servlets here?

Is there an easy way to accomplish what I'm describing?

    Post Migrated Here from stackoverflow.com
1
source | link

Java App as Tomcat Service?

I currently have a basic j2ee website. Currently, a jsp frontend gets data from the backend (the java program, lets call it object "Score"). The backend gets this data from a web site.

<% Main m = new Main(5); %>
<table style="width: 100%">
  <tr>
    <th align="left">NBA</th>
    <th style="text-align: right"><%=m.getTime("nba")%></th>
  </tr>
</table>
<% Iterator itrNba = m.getNbaM().entrySet().iterator();
   for (Map.Entry<Integer, Match> entry : m.getNbaM().entrySet()) {
     Match value = entry.getValue(); %>

However, this only happens once. If the user wants new data, they have to refresh the page, the backend will run the algorithm to populate some objects (hashmaps), and the jsp displays the values.

The backend data is sports scores and I want this to be a live feed. Therefore I have to make the back end poll the source, and the front end poll the backend (not necessarily the same intervals either).

How can I make my data objects persist? With my current implementation, every time the page is loaded, a new Score, when Score should be the same for all clients (the frontend jsp). So I made my data objects static and I put the main entry point in a loop, and it isnt working.

Im thinking my main java Scores object needs to be run as a service. Do I need to use servlets here?

Is there an easy way to accomplish what Im describing?