Hi, Actually I don't find any need to use try-catch blocks in JSPs. The exception handling can take place in the Java Bean itself. In my view the bean should work only as Value Objet which just provide the required data to you. If any kind of exceptional handling is there, it should be done within bean before getting it within the JSP. I will take an example of returning String array. String array can be null, that check needs to be done in the JSP, but the contents of the String array are null or not, that should be taken care by bean. Similarly, if bean is returning null which needs to populate in HTML, that can be converted into "" String by bean itself to return it to JSP. When you get the required data, I don't find the need of using try-catch blocks in the JSP while populating the HTML.
When we talk in terms of file include or <jsp:include >, the only difference comes up is, file include will contain the code at the compile time, whereas <jsp:include> use servlet chaining to use that code. -ShriKant A mailing list about Java Server Pages specification and reference wrote: > Hi ShriKant, > > Well there is no processing being done in the JSP (except if you would > count, outputing HTML rows, tables and HTML formatting stuff!). [We did > stick to MVC pattern..] > > I guess then JSPs have a hard limit and the translated java code from > JSP cannot exceed 16k lines for the "try ... catch" block. > > Perhaps this is when we try to merge common output formatting > functionality > and do code clean up!!. > > And for the immediate the only workaround is to put more new stuuf into > utility functions in servlet. Also, I'll try to use the other form of > "jsp:include" ie. > "<jsp:include>" instead of "<%@ include>" and see if that does the trick, > (although I doubt if this should be any different, none the less...) > > Thanks for your input on the same, > > Dharmendra > > -----Original Message----- > From: ShriKant Vashishtha [mailto:[EMAIL PROTECTED]] > Sent: Monday, March 25, 2002 11:23 PM > To: [EMAIL PROTECTED] > Subject: Re: JSP - code size too large for try catch block... > > Hi, > > First of all, according to MVC pattern, JSP (presentation layer) should > contain > only HTML, very less amount of Java code. The controller logic should > reside either > in Servlet or in a Java bean. In your case, it seams that Java code itself > is more > than 16KB which is coming in between try-catch block, and it is too much. > Try to > put this business logic in Java bean or in a servlet. Get the data to be > processed > from the bean itself(no processing logic in JSP). Then I think, you will > not have > any kind of problem. > > -ShriKant > > "Sharan, Dharmendra" wrote: > > > Hi JSP Developers, > > > > I am getting this error in JSP of "code size too large for try catch > > block" and > > when I looked into the compiled java file it has this huge block of > > code translated > > from the included JSPs inside of a try catch block. > > > > I think it was more that 8k or 16k lines of code I don't exactly > > remember it right now. > > > > The only way I was able to work around it was by putting some of the > > functionality into > > one of the Servlet class and calling the function from JSP. > > > > I was wondering if there is something wrong I am doing in the way I > am > > including the JSPs.. > > > > The way it is doing it now is more like a MACRO translation and puts > > the equivalent > > translated Java code for the included JSPs, this makes the same > lines > > being included several times > > causing the huge try catch block in the java source for the JSP. > > > > I have been including JSPs using :- > > > > <%-- some JSP code (and/or HTML) here --%> > > .... > > .... > > <%@ include file="/path_to_jsp/included_jsp_file1.jsp"%> > > > > <%-- some more JSP code (and/or HTML) here --%> > > > > <%@ include file="/path_to_jsp/included_jsp_file2.jsp"%> > > > > <%-- some more JSP code (and/or HTML) here --%> > > > > <%@ include file="/path_to_jsp/included_jsp_file3.jsp"%> > > .... > > .... > > > > Am I missing something here ? Or is there an alternative approach > to > > address this problem of code size too large in JSP ? Any experience with > the > > same problem or insights into the same is appreciated. > > > > Thanks! (in anticipation), > > > > Dharmendra > > > > > =========================================================================== > > 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 > > =========================================================================== > 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 > > =========================================================================== > 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 =========================================================================== 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
