Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jsp methods

Status
Not open for further replies.

sparc20

Programmer
Mar 13, 2002
56
GB
Guys, do you know if i can delcare and implement methods within a JSP ?

thanx
 
Yes :

<%!
String myMethod() {
return "Hello";
}
%>
 
Note, however, that if you want to use 'global' variables in these methods, you need to declare them within <%! ... %> tags as well.

Obviously, you can also send the variables as parameters to the method.

--Dave
 
Be very, very careful declaring globals in a Servlet as they will be shared across all http request services ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top