jQuery in Action, 2nd edition*
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
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: http://aspose.com/file-tools
subject: Declaration
Similar Threads
why my application can't detect struts tld files ?
How private method are written in Jsp page
Declaring String array in JSP
Tag question
doubt in JSTL c:out