Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes JSP Declaration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP Declaration" Watch "JSP Declaration" New topic
Author

JSP Declaration

Cameron Park
Ranch Hand

Joined: Apr 06, 2001
Posts: 371
Hi, I was wondering if methods can be decalred in JSP declarations like class variables. If so, how is it done?
Is
<%!String toString(){
StringBuffer temp = new StringBuffer();
for(int i=0; i<10; i++){
temp.append(Integer.toString(i));
.append("\n");
}
return temp.toString();
}%>
valid?
gsaha
Greenhorn

Joined: Apr 23, 2001
Posts: 6
Yes you can do that!! this Declaration block <%! %> will added to the outside of the _jspService() method. Other Scriplet block <% %> will added to the inside the _jspService() method.
 
 
subject: JSP Declaration
 
Similar Threads
Apply XSL to XML (Java)
Escaping special character
String buffer issue when dispalying a new line
ClassCastException
Newbie wrestles with scope and includes