[faq] How to edit .jsp files

Artist radio, genre radio & related artists. A Subsonic server for music nerds.

Moderator: moderators

[faq] How to edit .jsp files

Postby hakko » Mon Nov 19, 2012 6:55 am

The main web interface is built using JSP files, which contain instructions to the Jetty/Tomcat server on how to render each HTML page.

It is possible to edit the JSP files to tweak the user interface. Note however, that any change you make locally will be overridden on installation of a new official version. It is your own responsibility to keep track of files you update. The best way of doing this is forking the original project at Github using the Git versioning control system, to be able to merge official changes to the project with your own.

Since version 0.7.12, JSP files are precompiled to avoid the hit of having to compile each page the first time it is being viewed by a user, which caused a bit of delay. This will create a problem for those who haven't properly forked the project, but are only modifying local JSP files.

To edit local JSP files, make sure you have JDK 7 (not only JRE 7!) installed from http://www.oracle.com/technetwork/java/ ... index.html

Find the find web.xml in jetty/<version>/webapp/WEB-INF/web.xml

Look for the part corresponding to the file you're altering. Here's index.jsp used as an example:
Code: Select all
<servlet-mapping>
        <servlet-name>jsp.WEB_002dINF.jsp.index_jsp</servlet-name>
        <url-pattern>/WEB-INF/jsp/index.jsp</url-pattern>
    </servlet-mapping>


Comment out the whole section:
Code: Select all
<!--
    <servlet-mapping>
        <servlet-name>jsp.WEB_002dINF.jsp.index_jsp</servlet-name>
        <url-pattern>/WEB-INF/jsp/index.jsp</url-pattern>
    </servlet-mapping>
-->


Alter the JSP file to achieve your custom behavior, and restart your service.

Or better yet, fork the project on Github and start building it using Maven, to avoid repetitive changes on each new official version.
MusicCabinet developer
hakko
 
Posts: 1416
Joined: Tue Apr 17, 2012 7:05 pm
Location: Sweden

Return to MusicCabinet

Who is online

Users browsing this forum: No registered users and 26 guests