Ok, so a user enters some information on a JSP and clicks 'submit' which launches a servlet. This servlet then processes the information and sends back another JSP. That works fine.
However, what about if the servlet needs to ask the user a question before continuing the processing? In a general Java Application you can use the likes of JOptionPane or something.
As a very simple example.... say there is a list of names and ages: names {bob: 21, fred: 19, john: 20}
And the user is asked to enter 4 more: harry: 25, john: 17, percy: 54, gary: 12
The servlet gets the names input and then tries to add them to the list 'names'. However when it gets to 'john: 17', it finds that 'john' is already there. And we want to ask the user:
"Do you want to skip or replace John?"
Then if they skip, we move to percy and the list is: names {bob: 21, fred: 19, john: 20, harry: 25, percy: 54, gary: 12}
If they chose replace, we'd have: names {bob: 21, fred: 19, john: 17, harry: 25, percy: 54, gary: 12}
How would you get that user input? Is the only way to move all the logic into JavaScript or something?