【正文】
性上,而可移植性、標(biāo)準(zhǔn)化和集成性也十分重要。許多人都曾指出過(guò) JSP 中能夠改進(jìn)的功能。 與 JavaScript 相比 JavaScript 和 Java 編程語(yǔ)言完全是兩碼事,前者一般用于在客戶(hù)端動(dòng)態(tài)生成 HTML,在瀏覽器載入文檔時(shí)構(gòu)建網(wǎng)頁(yè)的部分內(nèi)容。 這是否表示您只可以學(xué)習(xí) JSP,將 Servlet 丟到一邊呢?當(dāng)然不是!由于以下 4 種原因, JSP 開(kāi)發(fā)人員需要了解 Servlet: ( 1) JSP 頁(yè)面會(huì)轉(zhuǎn)換成 Servlet。然而,當(dāng)前版本的 ColdFusion 滿(mǎn)足 J2EE 服務(wù)器的環(huán)境,允許開(kāi)發(fā)者容易的混合使用 ColdFusion 和 Servlet/JSP 代碼。但有些應(yīng)用,這種差異卻非常重要。其他這些技術(shù)中 ,有一些也很不錯(cuò) ,在某些情況下也的確是合情合理的選擇 .然而 ,在其他情形 中 ,JSP 明顯要更好一些。隔幾個(gè)位置 ,是來(lái) 自華盛頓一家大型軟件公司的高級(jí)經(jīng)理。 Web開(kāi)發(fā)人員可以將經(jīng)理集中在表示層( presentation layer)上。問(wèn)題不在于技術(shù)的能力,而是二者在便利性、生產(chǎn)率和可維護(hù)性上的不同。畢竟,在特定平臺(tái)上能夠用 Java 編程語(yǔ)言完成的事情,同樣可以用匯編語(yǔ)言來(lái)完成,但是選擇哪種語(yǔ)言依舊十分重要。對(duì)于大型的項(xiàng)目,這種劃分極為重要。在討論過(guò)程中 ,研討會(huì)的主席提出了 Jini的議題 ,這在當(dāng)時(shí)是一項(xiàng)新的 Java技術(shù) .主席向該經(jīng)理詢(xún)問(wèn)他的想法 .他繼續(xù)說(shuō) ,他們會(huì)持續(xù)關(guān)注這項(xiàng)技術(shù) ,如果這項(xiàng)技術(shù)變得流行起來(lái) ,他們會(huì)遵循公司的 “ 接受并擴(kuò)充 (embrace and extend)” 的策略 .此時(shí) , Gosling隨意地插話說(shuō) “ 你的意思其實(shí)就是不接受且不擴(kuò)充 (disgrace and distend)。下面給出幾個(gè)理由。 其次,對(duì)于某些應(yīng)用,底層語(yǔ)言的選擇至關(guān)重要。 與 PHP 相比 PHP( “PHP : Hypertext Preprocessor” 的遞歸字母縮寫(xiě)詞)是免費(fèi)的、開(kāi)放源代碼的、 HTML 嵌入其中的腳本語(yǔ)言,與 ASP 和 JSP 都有某種程度的類(lèi)似。不了解 Servlet 就無(wú)法知道 JSP 如何工作。這是一項(xiàng)有用的功能,一般與 JSP 的功能(只在服務(wù)器端運(yùn)行)并不發(fā)生重疊。這是一件好事,JSP 的優(yōu)勢(shì)之一是該規(guī)范由許多不同公司組成的社團(tuán)控制。例如, Servlet 和 JSP 規(guī)范為 Web 應(yīng)用定義了一個(gè)標(biāo)準(zhǔn)的目錄結(jié)構(gòu),并提供用于部署 Web 應(yīng)用的標(biāo)準(zhǔn)文件( .war 文件)。我如何將 Swing 組件用到 JSP 頁(yè)面中呢? 我如何將圖像放到 JSP 頁(yè)面中?我不知道讀取圖像文件應(yīng)該使用哪些Java? I/O 命令。 ? 瀏覽器根本不 “ 支持 ”JSP 它們看到的只是 JSP頁(yè)面的輸出。在參考該表時(shí),要注意,由 JSP 頁(yè)面生成的 servlet 使用 _jspService 方法( GET 和 POST 請(qǐng)求都調(diào)用該函數(shù)),不是 doGet 或 doPost 方 法。s strengths is the specification of many different panies controlled societies. Thus, in subsequent versions, this technology can be improved coordination. However, some organizations have developed a Javabased alternative technologies to try to fill these gaps. According to our judgments, this is wrong. JSP and Servlet technologies using the expansion of thirdparty tools, such as Apache Structs, is a good idea, as long as the benefits of the tool to pensate for the additional plexity of the tool. However, the attempt to use nonstandard tools to replace the JSP is not ideal. In selecting a technology, you need to weigh a number of factors: standardization, portability, integration, industry support and technical characteristics. JSP alternative technologies for the debate almost exclusively focused on the technical characteristics, while portability, standardization, and integration is also important. For example, Servlet and JSP specification defines a standard Web application directory structure, and provides for the deployment of Web applications, standard file (. War files). JSP is patible with all servers must support these standards. We can create filters to any trees in the role of Servlet and JSP page, but not for nonstandard resources. Web application security settings are the same. In addition, the industry39。 do not use explicit Java code or a lengthy jsp: useBean element difficult to access the dynamic results. Third, the misunderstanding of the JSP Forget JSP technology is a serverside technology Here are some typical problems Marty received (most of the issues appear more than once). ? Our servers are running . How do I use the Swing ponents JSP pages as well? How do I put an image in JSP pages? I do not know what to read image file should use Java ? I / O mands. Tomcat does not support JavaScript, when the user moves the mouse over the image, how can I make the image highlight it? ? ? Our customers do not understand the JSP to use the old browser. How should I do? When our client in the browser using the View ? Source (view source code), how to stop them see the JSP Tag? All of these issues are based on the browser to the serverside process in an informed assumption. But in fact the browser does not understand the serverside process. Therefore: ? If you want to use Swing ponents applet into the page, it is important that the Java version of the browser and the Java version of the se