splitting a JSP based on num of lines

Discussion in 'JSP' started by sakthi.abdullah, Jul 26, 2007.

  1. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    One of my jsp files [say X.jsp] is causing "exceeding the 655353 size limit in Tomcat 5.5"

    So I splitted that large jsp file based on the no of lines...
    I <jsp:include>d the splitted jsp files inside X.jsp instead of the original contents..

    BUT THAT IS NOT WORKING..

    Someone tell me "splitting a jsp file based on the num of lines and using <jsp:include> "is the right way to do ????
     
  2. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    Hi banking on that question,

    I found out that if u physically split the file like small files 1000 lines or files of say 100 kb, You must use &lt; include &gt; tag...
     
  3. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    But include tag doesn't serve the purpose .It physically includes the contents of the splitted files .Therefore during the main jsp file compilation,the error recurs saying:

    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: Unable to compile class for JSP:

    An error occurred at line: 29 in the generated java file
    The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit Stacktrace:


    So I have to use jsp:include which means meaningfully splitting the file..
    I need help here ...

    how to achieve this since the file contents change everytime....
    I mean the jsp file is produced by some other machine which I have to process...
    I need a fool-proof mechanism whereby I can handle a large jsp file which itself changes ??

    Please its an urgent requirement!
     
  4. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    You can split the file that way, you need to keep the Class source code in once piece! In .NET you can declare your class in fragments if you wish!
     
  5. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    But that big jsp file is infact a javascript code!!!!!!

    <%
    response.setContentType("application/x-javascript");
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pramga", "no-cache");
    %>

    sonefuntion();
    O("200511","200511");

    var mhArray=new Array(
    "ALL||ALL",
    "06||06"
    ,"1N||1N"
    ,"1X||1X"
    ,"1Y||1Y"
    ,"21||21"
    ,"30||30"
    ,"3C||3C"
    ,"4J||4J"
    }


    Many arrays are dclared in this file spanning thousands of lines ..... That's why the JSP is big !! SO,how to tackle this?
     
  6. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Why declare so many arrays?? Keep the data in a database, and fetch & use as required!
     
  7. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    Nice Suggestion!
    i am a newbie!
    Can you please explain on that how to do !!

    Thanks,
     
  8. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    What are you storing in those arrays??
     
  9. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Will you have your breakfast,lunch & dinner just you need to have it! Likewise, load the data the data when required.
     
  10. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    "Values for list boxes in a web page"

    The jsp or js file contains various list box values....

    The page which includes this file takes all the values and displays in the list box,,,,
     
  11. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Create database tables accordingly and store the data there. Say, you have to show categories, so create a table for categories and store the data there, and when you need to display it fetch it from the database and output as required!
     
  12. sakthi.abdullah

    sakthi.abdullah New Member

    Joined:
    Mar 15, 2007
    Messages:
    29
    Likes Received:
    1
    Trophy Points:
    0
    Tha complexity lies in the fact:::

    That js[p] file is genrated from another machine every night,I have to load that dynamic file .... Everytime the size varies,it may be less or more
     
  13. imrantechi

    imrantechi New Member

    Joined:
    Feb 12, 2008
    Messages:
    116
    Likes Received:
    4
    Trophy Points:
    0
    can you please give an example of jsp page splitted ones
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice