A open source implementation of Struts, MVC

xiaoxiao2021-03-06  29

An open source implementation of Struts, MVC implements complex large sites for this servlet and JSP framework

Please don't join too much Java code in my HTML in Listing 1, not having a lot of HTML in the Java code, but there is a lot of Java code in the HTML file. From this point of view, in addition to allowing web designers to write Java code, I don't actually do anything. However, we are not all; in JSP 1.1, we get a new feature called "tag".

The JSP tag is just a way to extract the code from the JSP file. Some people regard JSP tags as a macro of the JSP file, which is included in the servlet used for this tag. (Macro's view is largely correct.) For the same reason, I don't want to see HTML tags in the Java code, and I don't want to see Java code in the JSP file. The entire starting point of JSP technology is to allow web designers to create servlets without entanglement of Java code. The tag allows Java programmers to extend JAVA code into HTML to extend JSP files. Figure 3 shows the general concepts of extracting code from the JSP page and put them in a JSP tag.

Figure 3. JSP tag

Listing 2 is an example in which the function of the Struts tag is used. In Listing 2, the normal HTML

tag is replaced with a struts tag. Listing 3 shows the results of the browser received HTML. The browser gets HTML tags, but with additional code, such as JavaScript. Additional JavaScript activates the Email address domain. The tag code for the server is created, and the web design personnel will no longer contact JavaScript.

Listing 2. Struts FORM tag

Listing 3. Send to the browser results HTML