Wednesday, August 16, 2006

Methods in JSP

It isn't really all that tricky but nice to know anyway:

Just use the exclamation mark to declare the method. Note that request and response objects are not available. However, that doesn't stop you from hacking around it and passing the request or response as a parameter to the method:

<%!

public String myMethod(HttpServletRequest req){

//do something really cool with the req

return "Boo!";
}


%>



No comments:

Post a Comment