This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes When are scriplets executed? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "When are scriplets executed?" Watch "When are scriplets executed?" New topic
Author

When are scriplets executed?

Ian Whitelaw
Greenhorn

Joined: Mar 30, 2000
Posts: 13
I have another problem with my JSP/bean (shown below). My understanding of jsp scriplets (as opposed to declarations and expressions) is that they are executed when the user submits a request, but not when the JSP is first loaded.
If so, why does the processRequest() method on my bean seem to be executed when the page first comes up?
The JSP:

The bean:
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
I had the same question some time ago and I found out that the scriptlets are always executed when the JSP is.
The first time, you may want to check for nulls depending on the application. My observation is that they always get executed when the page is processed. And that you may want a different result the times after the first


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: When are scriplets executed?
 
It's not a secret anymore!