My goal in this is to have a function that returns a string. But instead of doing something like this:
<%! Public String test() { return "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; } %> I want to be able to jump out of JSP and just have the function echo it to the screen without needing to escape the "s to put it into a String object. Charles -----Original Message----- From: Tim Funk [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 15, 2005 12:23 PM To: Tomcat Users List Subject: Re: {OT] Re: Jumping in and out of JSP You can't mix: <%! stuff with open brace { %> JSP CODE <%! } closeing brace here %> Anything in <%!%> are class level declarations which live outside the jspService() method. See the generated java to see what i mean. -Tim Charles P. Killmer wrote: > Maybe I wasn't clear. The code that I pasted below is throwing all > sorts of errors. Assuming that something like this can be done. Why > does my code throw errors? > > Thanks > Charles > > -----Original Message----- > From: Jason Bainbridge [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 15, 2005 11:51 AM > To: Tomcat Users List > Subject: {OT] Re: Jumping in and out of JSP > > On Tue, 15 Mar 2005 10:27:21 -0600, Charles P. Killmer > <[EMAIL PROTECTED]> wrote: > >>Is it possible to do something like the following? I have as much >>code as I want in Java classes. This is just to make modifying the UI > > >>easier. >> >><%! >>public String test() { >>%> >>test2 >><%! >>} >>%> >><%=test()%> > > > Yes it is and one of the reaons using JSP's instead of just Servlets > is attractive. > > Regards, > -- > Jason Bainbridge > http://kde.org - [EMAIL PROTECTED] > Personal Site - http://jasonbainbridge.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]