Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone



Clound SSD Virtual Server

JSP and Tag XML Style (Java)

JSP and Tag XML Style (Java) ในการเขียน JSP นอกจากเราจะใช้ Scriptlets ด้วยการเริ่มต้น Tags ของ <% แล้วตามด้วยชนิดของ Directives แล้ว เรายังสามารถเขียนชนิดของ Directives ในรูปแบบของ XML Style ได้เช่นเดียวกัน รวมถึงยังสามารถกำหนด Custom Tags (ซึ่งจะได้พูดถึงในบทความถัดไป) โดยในรูปแบบของ XML Style จะใช้งานด้วย

Code
<jsp:tag></jsp:tag>

หรือ

<jsp:tag />


Example 1 การใช้ XML Style กับการ jsp:include และ jsp:directive.include

banner.jsp
<table width="400px">
<tr>
<td bgcolor="red">
	<center><h1>Banner ThaiCreate.Com</h1></center>
</td>
<tr>
</table>

index.jsp
<html>
<head>
	<title>ThaiCreate.Com JSP Tutorial</title>
</head>
<body>
	<jsp:include page="banner.jsp"/>
	
	Welcome to ThaiCreate.Com

	<jsp:directive.include file="banner.html" />
</body>
</html>

Output

JSP and Tag  XML Style



Example 2 การใช้ XML Style กับ jsp:forward

newpage.jsp
<html>
<head>
	<title>ThaiCreate.Com JSP Tutorial</title>
</head>
<body>
	<h1>Welcome to New Page</h1>
</body>
</html>

index.jsp
<html>
<head>
	<title>ThaiCreate.Com JSP Tutorial</title>
</head>
<body>
	<jsp:forward page="newpage.jsp" />
	
	Display ThaiCreate.Com
</body>
</html>

Output

JSP and Tag  XML Style



Example 3 การใช้ XML Style กับ jsp:directive.page import

index.jsp
<jsp:directive.page import="java.util.ArrayList" />
<html>
<head>
	<title>ThaiCreate.Com JSP Tutorial</title>
</head>
<body>
	<%
	
	    ArrayList<String> myArrList = new ArrayList<String>();
	    myArrList.add("Belgium");
	    myArrList.add("France");
	    myArrList.add("Italy");
	    myArrList.add("Germany");
    
		for (int i = 0; i < myArrList.size(); i++) {
			out.print(myArrList.get(i) + "<br>");
		}
	%>
</body>
</html>

Output

JSP and Tag  XML Style






   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2013-05-26 11:46:46 / 2013-08-20 21:29:27
  Download : Download  JSP and Tag  XML Style (Java)
 Sponsored Links / Related

 
JSP and Eclipse IDE Create Web Project and Run Project
Rating :

 
JSP and Netbeans IDE Create Web Project and Run Project
Rating :

 
ในการเขียน JSP (Java) ใช้เครื่องมืออะไรดี ระหว่าง Eclipse IDE กับ Netbeans IDE
Rating :

 
JSP and Scriptlets คืออะไร ทำไมจะต้องใช้ Scriptlets ในการเขียน JSP
Rating :

 
JSP and Basic Webpage , Basic HTML and JSP Scriptlets (Java)
Rating :

 
JSP and Block Variable and Declaration Variable for JSP (Java)
Rating :

 
JSP and Comment Code Single Line and Multiple Line (Java)
Rating :

 
JSP and Directives page,include,taglib (Java)
Rating :

 
JSP and Import Package Library and Using Libraries (Java)
Rating :

 
JSP and Include JSP file / Include page (Java)
Rating :

 
JSP and errorPage / isErrorPage (Java)
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่