#automatically call servlet doGet in jsp

30 messages · Page 1 of 1 (latest)

tawny marsh
#

Hi guys simple question, how can i call a doGet method the moment the jsp is called

Do i need a java script?

lilac waspBOT
#

This post has been reserved for your question.

Hey @tawny marsh! Please use /close or the Close Post button 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.

leaden bridge
#

a java script
please don't call it that lmao

lilac waspBOT
leaden bridge
#

different things

#

no clue what your question is actually about though, sorry

sage ore
#

@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?

tawny marsh
#

Hm wait

#

Sec

#

Like this i guess

#

But it makes the title of the tab flicker between the title and some localhost 8080 etc...

tawny marsh
tawny marsh
sage ore
#

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

tawny marsh
#

But theres a button there and if i make it hidden the script does not work

sage ore
#

@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?

tawny marsh
#

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

sage ore
#

hmm is your controller registered for that url path?
Can you show the controller and jsp

tawny marsh
#

Got super busy with baby sitting

#

Wait can i send the zip here?

#

Wow i can