You could add a method to a JSP, but you really can't reuse a method in a JSP; at least not in other JSPs.
What about developing a custom tag? You create a custom tag, such as
<mytage:doSomething/>
And when the JSP hits that tag, something gets printed out. Essentially, this tag links back to a
Java method that can spit out the HTML tags that you desire.
Also, in the code for the custom tag, you have access to things like the HttpSession and ServletContext. If you have an object, you can stuff those objects into the HttpSession, and retrieve it in the custom tag.
And of course, you can write one tag, but use it in all of your JSP files.
Does this sound like a feasable solution? Custom tags were added to the API to address these very types of issues.
Cheers!
-Cameron