Teammates: Break up instructorHelp.jsp page

Created on 26 Apr 2017  路  13Comments  路  Source: TEAMMATES/teammates

  • Operating System: Windows 10
  • JDK Version: 1.7
  • Eclipse / IntelliJ Version (if applicable): Kepler Service Release 2

What I was trying to do / What I need help with
I was working on #2335 . I didn't add many lines (might be around 200) in instructorHelp.jsp about searching, when I hit the following error -

An error occurred at line: 102 in the generated java file
The code of method invoke0(JspWriter) is exceeding the 65535 bytes limit

Stacktrace:
    at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
    at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
    at com.google.appengine.tools.development.PrivilegedJspServlet$2.run(PrivilegedJspServlet.java:61)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:58)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:128)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:98)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:509)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

This is shown when a request is sent to instructorHelp.jsp -

capture

Attempts to resolve the problem

It turns out that Java methods cannot have more than 65535 bytes. So the instructorHelp.jsp which compiles to a servlet method has exceeded maximum character limit. If I'm right, we need to breakdown the .jsp file, and discuss how we are going to do that.

a-UIX p.Medium

All 13 comments

Yes we can break up the help page into multiple pages.

Thank you sir! Any suggestions on how to break up the file?

Any suggestions on how to break up the file?

Haven't thought about it yet. Suggestions welcome.

Currently, I broke the instructorHelp.jsp according to the sections. This is the current directory structure -
capture

I have created a new folder help, which has one .jsp file per section in instructorHelp page. Precisely speaking, each section I call here is the first level of unordered list we have for the navigation list -
capture

These files are included in instructorHelp.jsp by doing this -

<jsp:include page="help/instructorHelpGettingStarted.jsp"/>
<jsp:include page="help/instructorHelpFAQ.jsp"/>
<jsp:include page="help/instructorHelpTips.jsp"/>
<jsp:include page="help/instructorHelpAddEditInstructors.jsp"/>
<jsp:include page="help/instructorHelpSessions.jsp"/>
<jsp:include page="help/instructorHelpComments.jsp"/>
<jsp:include page="help/instructorHelpSearch.jsp"/>

These are the contents of instructorHelpFAQ.jsp.

Justification

  • We won't get that error anymore.
  • Navigation still works.
  • A .jsp file included via <jsp:include is considered as a dynamic module. So, I assume it compiles separately, thus preventing the error.
  • Making them .jsp files means we can use custom tags too.

@damithc sir, let me know your thoughts about this.

On a related note, you may want to consider how the help page itself is constructed.

Many components in the page are hard-coded but with limited interaction, e.g. forms which can be filled/clicked but cannot be submitted. Replacing them with screenshots will cut down the page size by quite a large margin.

Yes I have noticed it @wkurniawan07 馃憤 . @damithc sir, shall I replace the user interactive forms with screenshots?

A few things I'd like to mention -

  • jQuery and bootstrap.min.js are not currently being loaded into help pages. So the forms which we display currently lack certain features such as tooltips or dropdowns even though the code for it is written in the help page.
  • Replacing forms with images will reduce the LOC greatly but will have the same effect in user interact-ability.
  • If we do replace the forms with images, we would have to make pretty large screenshots for some examples, which may not be feasible or we'd have to break our screenshots into multiple images.

The screen mockups in the help page are done using code (instead of screenshots) to avoid having to replace many screenshots when there are small changes to the UI. Also, all of them can be made to look consistent whereas screenshots will look different based on the computer used to take them.

I will leave the forms as they are then. If the need to convert them to images rises in the future, we could always open up a new issue.

So @damithc sir, is my above mentioned scheme of breaking instructorHelp.jsp agreeable?

is my above mentioned scheme of breaking instructorHelp.jsp agreeable

I'm ok with it.

@VamsiSangam why are we closing this issue?

As you said sir, the break up scheme was OK, I thought the issue is resolved.

I suggest we break up the help page first and then do #2335. It's easier to review and faster to merge that way. Merging the broken up help page sooner will help other PRs working on updating existing examples.
Even the new sections can be added one at a time instead of as one big PR.

Sure sir. I had a similar feeling. Will submit a PR ASAP.

Was this page helpful?
0 / 5 - 0 ratings