Home > Development Tools > git > What should I do if github does not display the newly added jsp files?

What should I do if github does not display the newly added jsp files?

PHPz
Release: 2023-04-10 14:04:43
Original
804 people have browsed it

GitHub is a popular code hosting platform. Developers can use the platform's version control function to manage code, collaborate on writing documents and code, etc. However, some developers found that when submitting jsp files, the newly added jsp files were not displayed on GitHub. This is because jsp files are generally compiled before they can be run on the server, and Git only recognizes text files. Therefore, when submitting a jsp file, specific operations must be taken to correctly display the jsp file on GitHub.

1. Use .gitignore files to ignore compiled files

In the development process using jsp files, we usually use IDE tools to generate the class files of the jsp page. If .jsp and .class files are submitted to GitHub together, the code repository on GitHub will be very bloated, which is not conducive to version control. Generally speaking, this problem can be solved by ignoring the .class file in the .gitignore file. Copy the following content to the .gitignore file:

*.class
Copy after login

2. Use Markdown files and folders to simulate directories

If you do not want to submit .class files in the project, but you need To conveniently view the structure and directory of jsp files, you can use Markdown language to write the directory structure and organize all jsp files and directories into a single file. You can create a new README.md file on GitHub and add tables of contents and links to individual jsp files in Markdown format.

Please note that in this case, any text related to the jsp file must be submitted in text format, which means that you cannot add any binary files or embedded images in it.

In addition to using Markdown files to simulate directories, you can also create empty directories and add them to the code repository on GitHub. Folder directories added using this method can be displayed in the Git client.

3. Convert JSP files into HTML files

If you choose to convert jsp files into html, you can compile the JSP files into HTML files before submitting them for submission to on GitHub.

The most popular JSP engine currently is Apache Tomcat, which has a very simple tool for converting JSP files into HTML files. Tomcat provides a JSP page management tool. You can visit http://localhost:8080/manager/html, enter the page, select the JSP file you want to convert to an HTML file, and then select "Convert to HTML". Tomcat will automatically generate an HTML version of the JSP page and store it in the Tomcat server directory. Adding this newly generated HTML file to GitHub can solve the problem of jsp files not being displayed on GitHub.

Summary

Through the above three methods, we can easily display jsp files on GitHub and select the corresponding method to match their respective needs. Whether by ignoring JSP class files, manually processing directory tags and links, or converting JSP files into HTML files, you can solve the problem of not being able to display jsp files on GitHub.

The above is the detailed content of What should I do if github does not display the newly added jsp files?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template