• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jsp

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everybody

We all know that every jsp file is converted into a servlet when exection,
and we have some tags in jsp like Scriplet and Declarative tags.
We can declare variable in these both tags.

If we declare some variables in Scriplets tags then where those variables are located in the corresponding Servlet file for that jsp.

And if If we declare some variables in Declarative tage then where those variables are located in the corresponding Servlet file for that jsp.

Eg:
Declarative
<%!
int i = 10;
%>
And
Scriplet
<%
int i = 10;
%>
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use Tomcat, you can learn how JSP pages get translated to servlets by examining the source code of the servlets. It's kept in a directory called "work" inside of the main Tomcat directory. Other servers likely also store the source somewhere where you can look at it.
[ July 30, 2006: Message edited by: Ulf Dittmer ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi thr

Well as u hav written that in a jsp file v hav scriplet and declarative sections, yes they are the part and parcel of any jsp code. And let me explain
where in the corresponding servlet they are going to be placed...

Declarative :- They become the member variable of the servlet class, so let us say if u hav only one object but maultiple threads accessing the servlet then all the threads are going to share these variables which are declared in the declarative section, not only variables u can also hav the function definition over there.

Scriplets:- They become the part of the service method, so for the same scenario as explained earlier they are going to hold different values for different threads. So v normally use scriplets to hold the processing of the
code.

That's the magic of Java my dear friend...Cheers...! Enjoy Java
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Please try to UseRealWords and avoid abbreviations such as thr, u hav, v and so on. They only make posts harder to read and therefore less useful to the people you are trying to help.

thanks,
Dave
 
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic