This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Declaration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Declaration" Watch "Declaration" New topic


Mathew Sam
Ranch Hand

Joined: Dec 19, 2001
Posts: 124
what is the difference between variables declared using scriplets tag and using declaration tag.
1)<% String s; %>
2)<! String s %>
Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
<% declaration %> (scriplet tag) the variable declared will be local to method(say service or user defined method).
<%! code %>(Declaration tag) code is inserted inbody servlet class, outside of service method. There by avaliable for all mehtod's of that jsp.

Sharing is learning
Mathew Sam
Ranch Hand

Joined: Dec 19, 2001
Posts: 124
Thanks for the info
I agree. Here's the link:
subject: Declaration
Similar Threads
How private method are written in Jsp page
Declaring String array in JSP
why my application can't detect struts tld files ?
Tag question
doubt in JSTL c:out