亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? 給你一篇ibm的介紹structs的文章(1).txt

?? 給一個(gè)初學(xué)者的建議和指導(dǎo)之路
?? TXT
字號(hào):
作者:friendcn
日期:2001-2-22 12:46:17
ibm公司的一篇介紹Struts的文章,
覺(jué)的不錯(cuò),我沒(méi)時(shí)間翻譯,你要是E文好的話自己看看吧
網(wǎng)址http://www-106.ibm.com/developerworks/library/j-struts/?dwzone=java


Struts, an open-source MVC implementation 
Manage complexity in large Web sites with this servlets and JSP framework

Malcolm Davis
Consultant
February 2001

Contents: 
 Introduction 
 JSP is a servlet 
 No more Java in my HTML 
 MVC 
 MVC Model 2 
 Struts 
 Struts details 
 Mailing list sample 
 Before and after 
 Future of Struts 
  Resources 
 About the author 
 


This article introduces Struts, a Model-View-Controller implementation that uses servlets and JavaServer Pages (JSP) technology. Struts can help you control change in your Web project and promote specialization. Even if you never implement a system with Struts, you may get some ideas for your future servlets and JSP page implementations.

Introduction
Kids in grade school put HTML pages on the Internet. However, there is a monumental difference between a grade school page and a professionally developed Web site. The page designer (or HTML developer) must understand colors, the customer, product flow, page layout, browser compatibility, image creation, JavaScript, and more. Putting a great looking site together takes a lot of work, and most Java developers are more interested in creating a great looking object interface than a user interface. JavaServer Pages (JSP) technology provides the glue between the page designer and the Java developer. 

If you have worked on a large-scale Web application, you understand the term change. Model-View-Controller (MVC) is a design pattern put together to help control change. MVC decouples interface from business logic and data. Struts is an MVC implementation that uses Servlets 2.2 and JSP 1.1 tags, from the J2EE specifications, as part of the implementation. You may never implement a system with Struts, but looking at Struts may give you some ideas on your future Servlets and JSP implementations.

In this article, I will begin with a JSP file that uses elements you may be familiar with and discuss the pros and cons of such a page. I will then cover Struts and how it can control change in your Web project and promote specialization. Finally, I will re-develop the simple JSP file with the page designer and change in mind. 

A JSP file is a Java servlet 
A JavaServer Page (JSP) file is nothing more than another way to view a servlet. The concept of a JSP file is to allow us to see a Java servlet as an HTML page. This view eliminates all of the ugly print() statements that normally show up in Java code. The JSP file is pre-processed into a .java file, then compiled into a .class. If you are using Tomcat, you can view your pre-processed .java files in the work directory. Other containers may store the .java and .class files elsewhere; the location is container specific. Figure 1 demonstrates the JSP file-to-servlet flow. 

Figure 1. JSP file-to-servlet flow


(This is significantly different from a Microsoft Active Server Page (ASP). An ASP is compiled into memory, not into a separate file.)

The simple self-contained JSP file
In a small JSP application, it is common to see the data, business logic, and the user interface combined into one module of code. In addition, the application generally contains the logic that controls the flow of the application. Listing 1 and Figure 2 demonstrate a simple JSP file that allows a user to join a mailing list.

Listing 1. join.jsp -- a simple request and response JSP file <%@ page language="java" %>
<%@ page import="business.util.Validation" %>
<%@ page import="business.db.MailingList" %>
<%
String error = "";
String email = request.getParameter("email");

// do we have an email address
if( email!=null ) {

    // validate input...
    if( business.util.Validation.isValidEmail(email) ) {

        // store input...
        try {
            business.db.MailingList.AddEmail(email);
        } catch (Exception e) {
            error = "Error adding email address to system.  " + e;
        }

        if( error.length()==0 ) {
%>
            // redirect to welcome page...
            <jsp:forward page="welcome.html"/> 
<%
        }
    } else {
        // set error message and redisplay page
        error = email + " is not a valid email address, please try again.";
    }

} else {
    email = "";
}
%>
<html>
<head>
<title>Join Mailing List</title>
</head>
<body>
<font color=red><%=error%></font><br>

<h3>Enter your email to join the group</h3>
<form action="join.jsp" name="joinForm">
    <input name="email" id="email" value=<%=email%>></input> 
    <input type=submit value="submit">
</form>
</body>
</html>

 


Figure 2. In a simple request and response, the JSP file sets the data, controls the flow to the next page, and creates the HTML


The mailing list JSP file is a self-contained, do-it-all module. The only things not contained in the JSP file are the actual code for validation that is contained in isValidEmail() and the code that puts the e-mail address in the database. (Separating the isValidEmail() method into reusable code might seem like an obvious thing to do, but I have seen the code for isValidEmail() embedded directly into the page.) The advantage of the single-page approach is that it is easy to understand and initially easy to build. In addition, with all the graphical development tools, it is easy to get started. 

Activities of join.jsp


Display opening input page. 
Read the email value from the form parameter. 
Validate the email address. 
If email address is valid: 
Add the address to the database. 
Redirect to the next page. 
If email address is invalid: 
Set an error message. 
Redisplay join.jsp with the error message. 

Consequences of the single-page approach 

Heavy HTML and Java coupling
The coder of the JSP file must be both a page designer and a Java developer. The result is often either terrible Java code or an ugly page, or sometimes both.


Java and JavaScript blur
As the pages become larger, there can be a tendency to implement some JavaScript. When the JavaScript appears in a page, the script can get confused with the Java code. An example of a possible point of confusion is using client-side JavaScript to validate the email field.


Embedded flow logic
To understand the entire flow of the application, you have to navigate all of the pages. Imagine the spaghetti logic on a 100-page Web site.


Debugging difficulties
In addition to being ugly to look at, HTML tags, Java code, and JavaScript code all in one page makes it difficult to debug problems.


Tight coupling
Changes to business logic or data means possibly touching every page involved. 


Aesthetics
Visually, in large pages, this type of coding looks messy. When I was doing Microsoft ASP development, I would commonly see 1000-line pages. Even with syntax coloring, it was still difficult to read and understand. 

No more Java code in my HTML, please
In Listing 1, instead of having a lot of HTML in Java code, I have a lot of Java code in an HTML file. From this standpoint, I really have not accomplished much, other than permit page designers to write Java code. However, all is not lost; with JSP 1.1, we got a new feature called tags. 

A JSP tag is simply a way of abstracting out code from a JSP file. Some people think of JSP tags as macros for JSP files, where the code for the tag is contained in the servlet. (The macro perspective is almost true.) For the same reason I do not want to see HTML tags in Java code, I do not want to see Java code in a JSP file. The entire point of JSP technology is to allow the page designer to create servlets without being distracted with Java code. Tags allow Java programmers to extend JSP files by making Java code look like HTML. Figure 3 displays the general concept of pulling the code from the JSP page and putting into a JSP tag.

Figure 3. JSP tag


An example of Struts tag capability is in Listing 2. In Listing 2, the normal HTML <form> tag is replaced with the Struts <form:form> tag. Listing 3 shows the resulting HTML that the browser receives. The browser gets the HTML <form> tag, but with additional code, such as the JavaScript. The additional JavaScript sets the focus on the email address field. The server side <form:form> tag code created the appropriate HTML and abstracts the JavaScript away from the page designer. 

Listing 2. Struts form tag

<form:form action="join.do" focus="email" >
    <form:text   property="email" size="30" maxlength="30"/>
    <form:submit property="submit" value="Submit"/>
</form:form>

 


Listing 3. Resulting HTML sent to the browser
<form name="joinForm" method="POST" action="join.do;jsessionid=ndj71hjo01">
    <input type="text" name="email" maxlength="30" size="30" value="">
    <input type="submit" name="submit" value="Submit">
</form>
<script language="JavaScript">
<!--
    document.joinForm.email.focus()
// -->
</script>


 


Notes about JSP tags: 

JSP tags require a container that runs JSP 1.1 or later.

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久综合国产精品| 天堂成人国产精品一区| 久久久精品综合| 欧美大片在线观看一区| 91麻豆精品国产91久久久久久久久| 欧美三区在线观看| 欧美日韩在线精品一区二区三区激情| 色悠悠亚洲一区二区| 白白色 亚洲乱淫| 91在线丨porny丨国产| 99久久99久久免费精品蜜臀| 91免费版在线看| 欧美精品一卡二卡| 欧美成人高清电影在线| 久久你懂得1024| 综合精品久久久| 亚洲va在线va天堂| 奇米色777欧美一区二区| 麻豆精品在线播放| 丰满放荡岳乱妇91ww| 91视频免费看| 7777精品伊人久久久大香线蕉超级流畅 | 欧美日韩一区二区三区四区五区| 欧美日韩一区二区在线视频| 91精品国产综合久久精品图片| 精品日产卡一卡二卡麻豆| 国产午夜精品理论片a级大结局| 国产精品国产三级国产普通话蜜臀| 亚洲免费观看高清完整版在线 | 国产日韩欧美综合一区| 亚洲丝袜另类动漫二区| 日本不卡一区二区三区高清视频| 激情综合亚洲精品| 91蝌蚪国产九色| 欧美不卡一区二区三区四区| 国产精品成人免费| 日本色综合中文字幕| 99久久精品免费精品国产| 欧美精品 日韩| 国产精品系列在线| 秋霞成人午夜伦在线观看| av午夜精品一区二区三区| 91精品国产综合久久精品性色| 国产精品久久久久婷婷二区次| 亚洲va中文字幕| 99麻豆久久久国产精品免费 | 欧美性受极品xxxx喷水| 久久精品免费在线观看| 日本不卡不码高清免费观看| 91原创在线视频| 久久精品亚洲麻豆av一区二区| 亚洲综合色区另类av| 国产精品一区在线观看你懂的| 欧美日本不卡视频| 日本aⅴ精品一区二区三区| 成人综合在线网站| 欧美大片一区二区| 天天综合天天做天天综合| av爱爱亚洲一区| 国产亚洲一区二区三区四区| 久久精品久久综合| 91精品福利在线一区二区三区| 亚洲免费视频成人| 色吊一区二区三区| 亚洲日本在线观看| 91啪亚洲精品| 亚洲另类中文字| 色综合久久久久综合体| 国产精品传媒在线| 成人永久aaa| 国产精品久久久久一区| 波多野结衣一区二区三区 | 日日夜夜免费精品| 欧美色老头old∨ideo| 亚洲一区二区三区视频在线| 91丨porny丨最新| 亚洲免费观看在线观看| 色哟哟国产精品免费观看| 亚洲色图色小说| 色8久久精品久久久久久蜜| 亚洲综合一二三区| 欧美日韩一区中文字幕| 日日夜夜精品免费视频| 日韩视频免费观看高清在线视频| 蜜桃av一区二区三区电影| 精品国产乱码久久久久久久久| 久久精品国产99国产| 久久影院电视剧免费观看| 国产成人在线视频网站| 国产精品久久久爽爽爽麻豆色哟哟| 99久久综合色| 午夜视频在线观看一区二区 | 亚洲日本va午夜在线影院| 欧洲av一区二区嗯嗯嗯啊| 午夜视频一区二区| 精品国产91洋老外米糕| 成人黄色免费短视频| 亚洲综合视频在线| 日韩美一区二区三区| 国产aⅴ综合色| 一区二区三区高清在线| 91精品啪在线观看国产60岁| 国产精品资源在线看| 亚洲视频狠狠干| 日韩亚洲欧美中文三级| www.日韩av| 日本午夜一本久久久综合| 欧美国产日本视频| 欧美性极品少妇| 国产91精品入口| 调教+趴+乳夹+国产+精品| 日本一区二区免费在线观看视频 | 久久久影院官网| 色94色欧美sute亚洲线路一ni| 狠狠色狠狠色综合日日91app| 国产精品国产自产拍在线| 日韩一级二级三级| 91麻豆swag| 国产成人精品亚洲日本在线桃色| 亚洲精品免费播放| 久久精品人人做人人爽人人| 欧美喷水一区二区| 日本高清免费不卡视频| 国产麻豆精品theporn| 亚洲蜜臀av乱码久久精品蜜桃| 久久综合久久鬼色| 欧美日韩国产色站一区二区三区| 国产成人综合在线播放| 日本怡春院一区二区| 亚洲欧美偷拍另类a∨色屁股| 久久久久久久久久久久久女国产乱| 欧美日韩综合在线| 色猫猫国产区一区二在线视频| 国产传媒久久文化传媒| 美日韩一区二区| 婷婷成人激情在线网| 亚洲一区二区三区在线播放| 1区2区3区精品视频| 国产欧美日本一区二区三区| 精品久久人人做人人爱| 欧美一区二区播放| 欧美区一区二区三区| 在线精品视频小说1| 一本到不卡精品视频在线观看| 成人动漫精品一区二区| 国产成人精品影院| 国产在线精品免费| 国内久久精品视频| 韩国精品主播一区二区在线观看| 日韩电影一区二区三区四区| 性久久久久久久| 日本不卡的三区四区五区| 亚洲亚洲人成综合网络| 亚洲成人av一区二区三区| 亚洲线精品一区二区三区八戒| 亚洲国产日日夜夜| 日韩黄色免费电影| 欧美aaaaa成人免费观看视频| 免费人成在线不卡| 国产一本一道久久香蕉| 国产91色综合久久免费分享| 成人97人人超碰人人99| 色伊人久久综合中文字幕| 欧美日韩综合不卡| 欧美xxxx老人做受| 国产精品丝袜黑色高跟| 亚洲乱码国产乱码精品精可以看| 亚洲一区二区av在线| 蜜桃免费网站一区二区三区| 国产成人免费在线观看| 91亚洲精品久久久蜜桃网站| 欧美探花视频资源| 日韩欧美综合一区| 国产精品久久久久久久久久久免费看| 亚洲欧美国产三级| 蜜臀a∨国产成人精品| 国产剧情一区二区| 一本久久综合亚洲鲁鲁五月天| 777久久久精品| 国产精品美女一区二区三区| 一个色在线综合| 国内成人精品2018免费看| av中文字幕一区| 91麻豆精品国产91久久久久| 国产亚洲精品精华液| 午夜影视日本亚洲欧洲精品| 国模冰冰炮一区二区| 欧美性生活一区| 久久久国产精品午夜一区ai换脸| 亚洲码国产岛国毛片在线| 久久99久久久久久久久久久| 99视频精品免费视频| 欧美mv日韩mv亚洲| 亚洲激情男女视频| 精品一区二区综合| 欧美私人免费视频| 国产精品久久久久久亚洲毛片| 日韩国产欧美三级| 972aa.com艺术欧美| 久久精品一区二区三区不卡牛牛|