Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Jsp  RSS feed

 
velmurugan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • 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;
%>
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • 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 ]
 
Mayank Keshari
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!