Solution 1 :

I would add an answered flag to the data model in the spring service. When rendering the front end, show or hide each block based on whether it has been answered.

Problem :

I am trying to create a jeopardy style game, there is a grid of blocks and when the user clicks a block they need to be redirected to a page where you can answer the question. When the question is answered the user needs to be redirected to the previous page, and the block they selected should disappear.

Below is the block I am trying to hide, using the onclick function:

<div class="top1" id="lastWish1"><a onclick="hideLW1()" th_href="@{/answerQuestion?category=Last Wish Raid&value=100}"><img class="questionBlocks" th_src="@{_images/question1.jpg}"></a></div>

Below is my onclick function:

lastWish1.onclick = function()
{ = 'none';

This does hide the block when I am leaving the page however when I return to the page the block is back. Do I need to use a session to keep this block hidden? Any other suggestions? I am using java, HTML, javascript, spring boot currently in this project.


Comment posted by Derek S

This sounds interesting, however I have not used spring boot too much so I am not 100% sure what you mean, do you know of an example somewhere I can look at? Also thank you for your help!

Comment posted by fram

Your front end gets its data from your back end. The back end will have a data model, such as Player, Game, Question, Answer, etc. I would add a flag to the Question object which says whether the current Player has provided an Answer. You would need to keep track of this anyway, for things like scoring. So, when you are rendering your page, you’d also look to see whether a Question was answered when it comes to making those blocks hidden or visible. I hope that makes sense. If you are looking for a nice set of articles and a book, have a look at, it’s great. Good luck!


Leave a Reply

Your email address will not be published. Required fields are marked *