#automatically call servlet doGet in jsp
30 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @tawny marsh! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
a java script
please don't call it that lmao
This is not a JavaScript server. [Java](https://en.wikipedia.org/wiki/Java_(programming_language) and JavaScript are completely different languages. See: How is JavaScript different from Java?
@tawny marsh
can you please be more specific and provide a bit more context?
Do you mean something like invoking a method in the jsp?
Invoking a method after the jsp is constructed / initialized?
Invoking a method on jsp load?
Hm wait
Sec
Like this i guess
But it makes the title of the tab flicker between the title and some localhost 8080 etc...
Like i think this might work but the flickering is scary
usually a jsp has its java counterpart, a class that handles the control, a controller
in that controller you should be able to define methods that are executed during different lifetimes of that jsp
ther should be one liek PostConstruct or something like that
let me check
I did not know that
Do you mean the servlet
But theres a button there and if i make it hidden the script does not work
@tawny marsh
I think I mean something else than what you do
doGet() is used to intercept GET requests in this context
Is that what you mean?
Yes
And the get method just makes a book object by getting values from a SQL DB
So i just want to call it automatically when the page loads
Rather than making a form to submit a get request
hmm is your controller registered for that url path?
Can you show the controller and jsp