samedi 3 février 2018

Correct url flow for web Java-spark application

My web application is created with Spark Framework (Connecting on same page as server) the url of the first page is http://localhost:4567/start From here the user clicks on a button to decide one of four tasks. The form action button is /start

The server checks everything is okay and then returns the new page for this task (e.g fixsongs) (i.e returns the page contents as a string ) from the page.

The problem is url stays the same, i.e is one behind where the user is

Now I have worked out how to solve this, instead of the server returning page it now does a redirect to /fixsongs.go which calls method that then returns the page contents as a string and modifys the url.

But I have two questions

  1. Is this more cumbersome approach the correct way to do this
  2. Do these additional redirect steps impact performance

Note I am not using templating but creating webpages using j2html

I cannot do a redirect directly to a html file in the first call since the html does not actually exist, the pages are created dynamically.




Aucun commentaire:

Enregistrer un commentaire