• Post Reply Bookmark Topic Watch Topic
  • New Topic

difference between declaration a variable with Expression and without  RSS feed

 
Vasantha Prabha
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can any one say me the difference between declaring
<%! int Val %>
&
<% int Val %>
Regards,
Sangeetha
 
Brusk Baran
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%! int Val %> belong to the servlet class of the jsp page
&
<% int Val %>belong to the jsp_service() method of the servlet class of the jsp page Only accessible within that service() method....
 
Vasantha Prabha
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Baran,

I have a Question
<%!
int Str;
%>
What does this means Will this called as decalarative statement
If this is not consider as declared under declarative syntax <%! %>
Then how can the below example is considered
<%!
public class innerclass
{
public void test()
{
System.out.println("Welcome");
}
}
%>
 
sarah Marsh
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anybody can answer this question?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%!
int Str;
%>
What does this means Will this called as decalarative statement
If this is not consider as declared under declarative syntax <%! %>

If you begin a scriptlet with <%! it is a declaration. It doesn't matter how many lines there are between the start and end markers.
<%!
int Str;
%>
is exactly the same as
<%! int Str; %>
was that your question?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!