導航:首頁 > 編程語言 > java嵌入html

java嵌入html

發布時間:2022-07-25 04:16:37

❶ 講java代碼嵌入html

你要先想好怎麼送給她。要是讓她訪問你的網站,可以在jsp頁中加入java代碼放在tomcat上發布。如果你直接給她優盤,html中的java將無法正確顯示。

❷ 如何吧html語言嵌套在java中

應該是把java代碼嵌入到 html 中 jsp: <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'buy.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <% request.setCharacterEncoding("utf-8"); String proctName=request.getParameter("proctName"); int proctNum=Integer.parseInt("proctNum"); Object obj=session.getAttribute(proctName); if(obj!=null){ int oldNum=((Integer)obj).intValue(); proctNum+=oldNum; session.setAttribute(proctName, proctNum); }else{ session.setAttribute(proctName, proctNum); } %> 購物成功 <a href="show.jsp">查看購物車</a> <a href="index.jsp">繼續購物</a> <% %> </body> </html> 不能實現功能哈 只是給你看看結構

希望採納

❸ 怎樣把java代碼放到html中

一般java是可以嵌入jsp頁面的,當然也可以調用外部的java。jsp頁面要想運行必須放到容器里,例如最流行的tomcat。
最後可以把jsp就是用java程序動態生成html頁面,瀏覽器不能解析java代碼,所以tomcat這種伺服器負責解析,生成最終的html,希望能幫到你!

❹ 如何把java小程序放到html網頁中運行

建立一個和你類名一樣的HTML文本比如c1_2.java
建立文本名就叫c1_2.html
然後在文本中輸入<APPLET CODE="c1_2.class"width=150 height=100></APPLET>
width和height是你打開applet應用小程序瀏覽器窗口的寬度和長度
c1_2.class是在cmd下用javac編譯c1_2.java出來的。
所以在cmd中找對象的子目錄 輸入javac xxx編譯 回車 aapletviwer xxxx就行了
求採納

❺ java注釋文檔的 嵌入式html

看過java API么?那個文檔就是根據嵌入式html生成的,什麼叫嵌入式html?就是把html嵌入到了java源文件中

作用就不用明說了,如果沒有java api,寫代碼是多麼的痛苦!

/**
* The <code>String</code> class represents character strings. All
* string literals in Java programs, such as <code>"abc"</code>, are
* implemented as instances of this class.
* <p>
* Strings are constant; their values cannot be changed after they
* are created. String buffers support mutable strings.
* Because String objects are immutable they can be shared. For example:
* <p><blockquote><pre>
* String str = "abc";
* </pre></blockquote><p>
* is equivalent to:
* <p><blockquote><pre>
* char data[] = {'a', 'b', 'c'};
* String str = new String(data);
* </pre></blockquote><p>
* Here are some more examples of how strings can be used:
* <p><blockquote><pre>
* System.out.println("abc");
* String cde = "cde";
* System.out.println("abc" + cde);
* String c = "abc".substring(2,3);
* String d = cde.substring(1, 2);
* </pre></blockquote>
* <p>
* The class <code>String</code> includes methods for examining
* indivial characters of the sequence, for comparing strings, for
* searching strings, for extracting substrings, and for creating a
* of a string with all characters translated to uppercase or to
* lowercase. Case mapping is based on the Unicode Standard version
* specified by the {@link java.lang.Character Character} class.
* <p>
* The Java language provides special support for the string
* concatenation operator (+), and for conversion of
* other objects to strings. String concatenation is implemented
* through the <code>StringBuilder</code>(or <code>StringBuffer</code>)
* class and its <code>append</code> method.
* String conversions are implemented through the method
* <code>toString</code>, defined by <code>Object</code> and
* inherited by all classes in Java. For additional information on
* string concatenation and conversion, see Gosling, Joy, and Steele,
* <i>The Java Language Specification</i>.
*
* <p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
*
* <p>A <code>String</code> represents a string in the UTF-16 format
* in which <em>supplementary characters</em> are represented by <em>surrogate
* pairs</em> (see the section <a href="Character.html#unicode">Unicode
* Character Representations</a> in the <code>Character</code> class for
* more information).
* Index values refer to <code>char</code> code units, so a supplementary
* character uses two positions in a <code>String</code>.
* <p>The <code>String</code> class provides methods for dealing with
* Unicode code points (i.e., characters), in addition to those for
* dealing with Unicode code units (i.e., <code>char</code> values).
*
* @author Lee Boynton
* @author Arthur van Hoff
* @version 1.188, 09/14/04
* @see java.lang.Object#toString()
* @see java.lang.StringBuffer
* @see java.lang.StringBuilder
* @see java.nio.charset.Charset
* @since JDK1.0
*/

這是java String類開始的一段文檔,看裡面用了很多html標簽,所謂嵌入式html也

❻ 怎麼把java程序嵌入到HTML文檔中

<appletcode="Bubbles.class"width="350"height="350">
</applet>

不過這種技術不建議學了,不太好用。
另外,在html5中,已經不支持applet標簽了,用object代替。

❼ java:嵌入式HTML詳解

Java是由Sun微系統公司所發展出來的程序語言,它本身是一種對象導向(Object-Oriented)的程序語言。JAVA目前在手機上應用最多的就是JAVA游戲。

Java也號稱是能跨平台使用的語言,這主要是因為Java本身被編譯之後,並不是直接產生可執行的碼,而是產生一種中間碼叫作 ByteCode,這種碼必需在透過 Java 的直譯器來解讀它,才能夠真正的被執行,所以只要平台上裝有這種Java的直譯器,就能解讀ByteCode也就能執行Java編譯過的程序,故與Java程序是在那種平台上被編譯的,就完全沒有干係了。Java寫出來的程序可分為兩類,分別是Java Applet與一般的Application,而Application 這一類就與一般的程序如C++的作用是比較類似的,是一個獨立可執行的應用程序,像HotJava是一個瀏覽器,且就是使用Java程序所發展出來的。最常見的Java程序包括應用程序和applets。應用程序是單獨的程序,諸如HotJava瀏覽器軟體就是用Java語言編寫的。 Applets類似於應用程序,但是它們不能單獨運行, Applets可以在支持Java的瀏覽器中運行。Applet主要是內置於HTML網頁中,在瀏覽時發揮作用。

Java的目標是為了滿足在一個充滿各式各樣不同種機器,不同操作系統平台的網路環境中開發軟體。利用Java程序語言,可以在網頁中加入各式各樣的動態效果。可以放上一段動畫,加入聲音,也可以建立互動式網頁等。

Java手機軟體平台

Java手機軟體平台採用的基本Java平台是CLDC (Connected Limited Device Configuration)和MIDP (Mobile Information Device Profile),是J2ME (Java 2 Micro Edition)的一部分,在中國一般稱為「無線Java」技術。此前,有人把它叫做「K-Java」;其實,K-Java的叫法只是Sun公司在開發KVM Java虛擬機時的項目代號,在該技術被正式命名為KVM後,就不再用K-Java了。

KJava即J2ME(Java 2 Micro Edition),是Sun公司專門用於嵌入式設備的Java軟體。以KJava編程語言為手機開發應用程序,可以為手機用戶提供游戲、個人信息處理、電子地圖、股票等服務程序。J2ME(Java 2 Micro Edition)是致力於消費產品和嵌入式設備的最佳解決方案。J2ME在設計其規格的時候,遵循著「對於各種不同的裝置而造出一個單一的開發系統是沒有意義的事」這個基本原則。於是J2ME先將所有的嵌入式裝置大體上區分為兩種:一種是運算功能有限、電力供應也有限的嵌入式裝置(比方說PDA、手機);另外一種是運算能力相對較佳、並且在電力供應上相對比較充足的嵌入式裝置(比方說冷氣機、電冰箱)。因為這兩種區分,所以Java引入了一個叫做Configuration的概念,然後把上述運算功能有限、電力有限的嵌入式裝置定義在Connected Limited Device Configuration(CLDC)規格之中;而另外一種裝置則規范為Connected Device Configuration(CDC)規格。也就是說,J2ME先把所有的嵌入式裝置利用Configuration的概念區隔成兩種抽象的型態。

Java技術的開放性、安全性和龐大的社會已有資源,以及其跨平台性,即「編寫一次,到處運行」的特點,使Java技術成為智能手機軟體平台的事實標准。採用Java技術後,編寫應用程序和提供服務的人就不必關心接受其服務的手機採用的是什麼操作系統和晶元,只要按照Java的要求去寫程序就好了;同樣,生產手機的廠商也不必顧慮將來誰來提供增值服務。可以看出,採用Java技術,可以建立完整、高效的無線數據增值服務產業鏈,從而為用戶提供靈活、個性化、內容方式多樣的服務。

❽ html嵌入java代碼怎麼用

在html中加入java代碼,就是jsp頁面,jsp里可以加入java代碼了,當然也可以調用外部的java。jsp頁面要想運行必須放到容器里,例如最流行的tomcat。
你應該是新手,還不明白概念,所以在網上找些視頻教程看吧,搜索j2ee或者jsp的教程,jsp就是用java程序動態生成html頁面,瀏覽器不能解析java代碼,所以tomcat這種伺服器負責解析,生成最終的html

閱讀全文

與java嵌入html相關的資料

熱點內容
登錄伺服器發生錯誤怎麼回事 瀏覽:272
松下空氣能壓縮機 瀏覽:938
萬能源碼播放器 瀏覽:968
串口伺服器如何轉發 瀏覽:359
如何下載Ck電影部app 瀏覽:744
解壓文具筆袋簡單 瀏覽:288
android百度坐標轉換 瀏覽:367
文件公私鑰加密傳輸 瀏覽:665
python矩陣維度 瀏覽:927
華佗舌診源碼 瀏覽:897
解壓壓縮包有一個錯誤怎麼辦 瀏覽:966
怎麼在手機上設立文件夾 瀏覽:232
雲幫手伺服器搭建教程 瀏覽:785
惠普默認存在哪個文件夾 瀏覽:493
建立桌面圖標文件夾 瀏覽:86
python怎麼跳過異常繼續執行 瀏覽:315
單片機驅動可控硅 瀏覽:294
遼寧沈陽最新代理伺服器ip地址 瀏覽:565
如何安裝用友通伺服器 瀏覽:827
python怎麼將輸入轉為整數類型 瀏覽:608