「JSP」修訂間的差異

出自ProgWiki
跳至導覽 跳至搜尋
→‎FAQ
→‎FAQ
(未顯示同一使用者於中間所作的 14 次修訂)
行 1: 行 1:
JSP(JavaServer Pages),{{Wikipedia|JSP|lang=zh}}。
+
'''JSP'''(JavaServer Pages),{{Wikipedia|JSP|lang=zh}}。
  
 
==相關網站==
 
==相關網站==
行 5: 行 5:
  
 
==相關技術文件==
 
==相關技術文件==
 +
;Web.xml
 
* [http://java.sun.com/developer/Books/javaserverpages/servlets_javaserver/servlets_javaserver05.pdf CONTROLLING WEB APPLICATION BEHAVIOR WITH WEB.XML]……關於如何寫Web.xml
 
* [http://java.sun.com/developer/Books/javaserverpages/servlets_javaserver/servlets_javaserver05.pdf CONTROLLING WEB APPLICATION BEHAVIOR WITH WEB.XML]……關於如何寫Web.xml
 
* [http://java.sun.com/developer/Books/javaserverpages/servlets_javaserver/servlets_javaserver09.pdf SERVLET AND JSP FILTERS]
 
* [http://java.sun.com/developer/Books/javaserverpages/servlets_javaserver/servlets_javaserver09.pdf SERVLET AND JSP FILTERS]
 
* [http://edocs.bea.com/wls/docs100/webapp/web_xml.html  web.xml Deployment Descriptor Elements]
 
* [http://edocs.bea.com/wls/docs100/webapp/web_xml.html  web.xml Deployment Descriptor Elements]
 +
 +
;JSP Model 2
 +
* [http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html?page=1 Understanding JavaServer Pages Model 2 architecture]
 +
* [http://caterpillar.onlyfun.net/Gossip/Struts/StrutsGossip.htm 開源框架: Struts Gossip]
 +
 +
==相關套件==
 +
;JSP Standard Tag Library (JSTL),{{wikipedia|JavaServer_Pages_Standard_Tag_Library|lang=en}}
 +
*[http://java.sun.com/products/jsp/jstl/ JavaServer Pages Standard Tag Library]
 +
*[http://jstl.java.net/ JSTL Project]
 +
*[http://caterpillar.onlyfun.net/Gossip/JSPServlet/IntroduceJSTL.htm 簡介]
  
 
==討論區==
 
==討論區==
行 15: 行 26:
  
 
===include file時導致中文亂碼===
 
===include file時導致中文亂碼===
 +
* 以下的方法只適用於[[Tomcat]]
 +
* 引入其他頁面的範例
 +
<source lang="java">
 +
<%@ include file="/include/TestInclude.jsp" %>
 +
</source>
 
* 在引入頁與被引入頁,的第一行都加上語系設定,例如:Big5碼
 
* 在引入頁與被引入頁,的第一行都加上語系設定,例如:Big5碼
 
<source lang="java">
 
<source lang="java">
行 27: 行 43:
 
  System.out.println("測試Log");
 
  System.out.println("測試Log");
 
%>
 
%>
 +
</source>
 +
 +
===如何在Jsp檔中做轉址===
 +
<source lang="java">
 +
<%
 +
response.sendRedirect("TestRedirect.jsp");
 +
%>
 +
</source>
 +
 +
===從tomcat移植到weblogic===
 +
* [http://songze39.javaeye.com/blog/288505 tomcat项目移植到weblogic问题]
 +
 +
===JSP取得get模式的傳入參數===
 +
* 例如
 +
<source lang="java">
 +
String strQ = request.getParameter("q");
 +
</source>
 +
 +
===JSP取得utf8格式的傳入參數時亂碼===
 +
*在接收參數之前先使用
 +
<source lang="java">
 +
<%@page pageEncoding="UTF-8" %>
 +
<% request.setCharacterEncoding("UTF-8"); %>
 
</source>
 
</source>
  
行 32: 行 71:
 
* [[Java]]
 
* [[Java]]
 
* [[JSP]]
 
* [[JSP]]
 +
 +
===Web-Server===
 +
* [[Sun Java System Application Server]](J2EE內建)
 
* [[Tomcat]]
 
* [[Tomcat]]
 +
* [[WebLogic Server]]
 +
* [[JBoss application server]]
  
  
  
 
[[Category:程式語言]]
 
[[Category:程式語言]]
 +
[[Category:Java]]
 +
[[Category:Sun]]

於 2019年8月19日 (一) 15:06 的修訂

JSP(JavaServer Pages),參照:『維基百科~JSP』。

相關網站

相關技術文件

Web.xml
JSP Model 2

相關套件

JSP Standard Tag Library (JSTL),參照:『維基百科~JavaServer_Pages_Standard_Tag_Library

討論區

FAQ

include file時導致中文亂碼

  • 以下的方法只適用於Tomcat
  • 引入其他頁面的範例
<%@ include file="/include/TestInclude.jsp" %>
  • 在引入頁與被引入頁,的第一行都加上語系設定,例如:Big5碼
<%@ page contentType="text/html; charset=big5" %>

如何在Jsp檔中輸出自訂的Log訊息到Tomcat 6的Log檔中

  • Tomcat 6的Log檔預設放在 C:\Program Files\Apache Software Foundation\Tomcat 6.0\logs
  • 使用下列方式
<%
 System.out.println("測試Log");
%>

如何在Jsp檔中做轉址

<%
response.sendRedirect("TestRedirect.jsp");
%>

從tomcat移植到weblogic

JSP取得get模式的傳入參數

  • 例如
String strQ = request.getParameter("q");

JSP取得utf8格式的傳入參數時亂碼

  • 在接收參數之前先使用
<%@page pageEncoding="UTF-8" %>
<% request.setCharacterEncoding("UTF-8"); %>

相關

Web-Server