JSPÓï·¨µÄxml±í´ï
´ó¼Ò×ÜÊDz»Ï²»¶¿´µ½<%ºÍ%>ÔÚjspÒ³ÃæÉÏ£¬ÆäʵÎÒÃÇ¿ÉÒÔʹÓñȽÏÓÅÑŵÄxml·½Ê½À´±í´ï
1£¬Òþº¬µÄ×¢ÊÍ
JSPÓï·¨£º<%-- ÄÚÈÝ --%>
XMLÓï·¨£ºÎÞ
2£¬±äÁ¿»òº¯ÊýµÄÉùÃ÷
JSPÓï·¨:<%! declaration;[declaration;]+... %>
ÀýÈ磺
<%!
int i=0;int a,b,c;
Color red=new Color(255,0,0);
private static final String OK="ok";
public String getAnswer(){
return OK;
}
%>
XMLÓï·¨£º
<jsp:declaration>
declartion;[declaration;]+...
</jsp:declaration>
ÀýÈ磺
<jsp:declaration>
int i=0;int a,b,c;
Color red=new Color(255,0,0);
private static final String OK="ok";
public String getAnswer(){
return OK;
}
</jsp:declaration>
3£¬±í´ïʽ
JSPÓï·¨£º<%=expression%>
ÀýÈ磺
<%=Math.round(Math.random*100)%>
XMLÓï·¨£º
<jsp:expression>
expression
</jsp:expression>
ÀýÈ磺
<jsp:expression>
Math.round(Math.random*100)
</jsp:expression>
4£¬´úÂëÆ¬¶Ï
JSPÓï·¨£º<% your java code %>
ÀýÈ磺
<%
String username=request.getParameter("username").trim();
String password=request.getParameter("password").trim();
%>
XMlÓï·¨£º
<jsp:scriptlet>
your java code
</jsp:scriptlet>
ÀýÈ磺
<jsp:scriptlet>
String username=request.getParameter("username").trim();
String password=request.getParameter("password").trim();
</jsp:scriptlet>
5£¬Ö¸Áinclude
JSPÓï·¨£º<%@include file="relativeURL"%>
ÀýÈ磺<%@include file="static_head.html"%>
XMLÓï·¨£º<jsp:directive.include file="relativeURL"/>
ÀýÈ磺<jsp:directive.include file="static_head.html"/>
6£¬Ö¸Ápage
JSPÓï·¨£º<%@page attribtes%>
ÀýÈ磺<%@page import="java.util.HashMap"%>
XMLÓï·¨£
Ïà¹ØÎĵµ£º
Ò»¡¢°²×°JDK ¡¡¡¡Ê×ÏÈÏÂÔØJDK 5.0£¨JDK 5.0µÄÏÂÔØÒ³ÃæÎª£ºhttp://java.sun.com/j2se/1.5.0/download.jsp£©£» È»ºóÔËÐÐJDK 5.0°²×°³ÌÐòjdk-1_5_0_06-windows-i586-p.exe£¬°²×°¹ý³ÌÖÐËùÓÐÑ¡Ïî±£³ÖĬÈÏ£»×îºóÅäÖÃJDKµÄ»·¾³±äÁ¿£ºÔÚ“ÎҵĵçÄÔ”ÉϵãÓÒ¼ü—>“ÊôÐÔ”—>“¸ß¼¶”& ......
ÓÃÁËcommons-fileupload-1.2.jarºÍcommons-io-1.3.2.jarÕâÁ½¸ö°ü¡£
save.jsp
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.regex.*"%>
<%@ page import="org.apache.co ......
try {
URL url = new URL("http://www.163.com");
InputStream is = url.openStream();
byte[] buffer = new byte[1024];
  ......
struts-config:
<action path="/articleManage" name="articleManageForm" scope="request" type="auction.action.ArticleManageAction" validate="false">
<forward name="atriclesList" path="/WEB-INF/publish/articleManage/atriclesList.jsp"/>
<forward ......