Please any will u help me.....
what is the need of using application scope at the any project for jsp.
please give me examples of using application scope. and how to use taglib ..........please give examples which i can run and learn..........please...................................

application scope is used when u want to keep the variable for the whole lifetime of the application.

taglibs are library of tags that you can use in your JSP.
There is a default library for JSP.
But custom libraries can also be made.
The custom tags are powerful means for reusability.

Framweworks like struts are totally based on custom tags

thanks saurav.....

you are always welcome

Application scope, as mentioned, is for sharing data among ALL sessions within an application... this can be useful for many purposes, often a hit count is used as an example, BUT that is a contrived example because any server restarts or application restarts will reset it to ZERO... but when you see XXXXX hits since DATEYYYYY type of comments, it is possible they are using it this way... they just date when the app is restarted and show the count since then...
It is cood for inter-session communications, which only happen when the server is running and don't need to be stored between restarts... It cal be used for longer term storage if you have scheduled runs of an routine to write application data into a db or the serialize it to the hard drive... but this should NEVER be used for important data as this doesn't cover the possibility of a server crash where you don't have the opporuntity to write the data prior to shutdown...
I know someone who uses it for logging... rather than write the log messages every time for normal behavior, he collects them in an application scope stored object and writes them on a schedule or during the application shutdown or restart processes... this reduces the disk overhead of logging for non-error conditions which improves performance... The errors are logged immediatly to avoid the possibility that an error could lead to application crash or restart... all non-error logs are written when any error happend too, so it is like a comit point...
Since logging eats performance quickly, yet robust logging is helpful and often a requirement, this allows a great balance to be struck...
Before anyone complains about memory usage... the buffered log sizes are set and reaching this limit will trigger the log comit also... and memory is so cheap not having enough is a dumb excuse... the disk I/O is a bigger issue for high performance system than a small amount of memory for a log buffer...
Under normal conditions, you don't need to worry about the logs too much, and under error conditions you comit them all immediately so you get the best of both worlds...

Some people believe that ALL Java code should be separate from the presentation layer, the JSP files. This is a valid choice, especially for an application that may have non-programmers involved in it... For this we create custom tag libraries. We code the functions we need, we determine what input / what out etc. we will use and code classes to take care of it. Then you map the specific tags you want to use with the class that will be called when that tag is encountered by the app-server...
Early JSP lacked any looping (or iteration) functionality, so professional projects and frameworks usually built a looping tag as one of the first things they did...


I recomend buying a good book on tag libraries, it should really help much more than we can in a forum, but when you reach points in the book you don't fully understand, then feel free to ask us for clarification... ;-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.