Pass the out object as a parameter to you output method and use out.println in your method
Pavan -----Original Message----- From: A mailing list about Java Server Pages specification and reference [mailto:JSP-INTEREST@;JAVA.SUN.COM] On Behalf Of cbarnes Sent: Friday, October 11, 2002 3:42 PM To: [EMAIL PROTECTED] Subject: Methods in JSPs I've added a method to my JSP, which in a simplified form looks something like the following: <%! private void output(String text) { System.out.println(text); } %> I want to change this so that it also displays 'text' on the html page, but I can't work out how this can be done from within the method. If I do the following: <%! private void output(String text) { System.out.println(text); %> <p><%= text %></p> <% } %> I get an error because it thinks the method is not terminated with a }. If I do the following: <%! private void output(String text) { System.out.println(text); %> <p><%= text %></p> <%! } %> it thinks that 'text' is no longer in scope. Can anyone help? Thanks, Catharine ======================================================================== === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
**************************Disclaimer************************************************** Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. ****************************************************************************************