Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to support JSP in JSP HTTP Server

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how the JSP HTTP server supports JSP. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

1. Design ideas

The local JSP source file is interpreted by the JSP HTTP server to generate the intermediate java source file. Then call the javac compilation tool to compile the java source file into a class file. The JSP HTTP server loads and runs the classes defined in the class file.

two。 Design essentials

(1) the definition of JSP file syntax.

(2) convert JSP files to java source files

(3) compile java source files

(4) load java class and execute the instance object of the class object

3. Design and implementation

(1) formulate the syntax of JSP files and interpret the code as java source files according to the JSP syntax form. Considering the simplification of the interpretation of JSP files, three JSP syntax forms are mainly considered in the design. In this design, the interpretation processing code for compiled statement blocks in JSP files is as follows:

/ / Current line contain JSP compile block start flag if (line.indexOf (") > = 0) / / JSP cimpile block end flag {int start = line.indexOf ("); fout.println (line.substring (start + 3, end));} else / / Those statements no in same line. {while (true) {line = fin.readLine (); if (line = = null) / / The compiled header is broken {return (false);} if (line.equals ("% >") = = true) / / JSP compiled block end flag {break;} else {fout.println (line); / / Output the middle statements of compiled header}} / / while (true)}} / / if (line.indexOf ("

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report