ÎÒµÄJSPѧϰ±Ê¼Ç JSPÒ³ÃæÖеÄÈýÀà»ù±¾ÔªËØ
JSPÒ³ÃæµÄÈýÀà»ù±¾ÔªËØ
1.ÉùÃ÷
ÐÎÈç
<%!
int a;
int add(int a,int b)
{
return a+b;
}
%>
ÉùÃ÷ÔªËØ<%!.....%>¿ÉÔÚjspÒ³ÃæÖжà´Î³öÏÖ£¬µ«²»Ç¶Ì×£¬ÀïÃæÀ´ÉùÃ÷Ò³Ãæ±äÁ¿ºÍÒ³Ã溯Êý£¬À´ÎªÕû¸öÒ³ÃæʹÓã¬ÈçͬjavaÀàÀïÃæµÄÀà±äÁ¿ºÍÀà·½·¨
2.´úÂë
ÐÎÈç
<%
int a;
%>
ÀïÃæÊÇjspµÄ´úÂ룬Èçͬº¯ÊýÄÚ²¿£¬Ëù¶¨ÒåµÄ±äÁ¿£¬ËäÈ»¿ÉÒÔдÈë¶à¸ö<%..%>£¬µ«ÊDz»ÄÜǶÌ×£¬²¢ÇÒÒ»µ©´úÂëÀﶨÒå±äÁ¿£¬ÄÇô¸Ã´úÂëÒÔϵĴúÂ벿·Ö¶¼ÄÜ·ÃÎÊ£¨ÓÐЧ£©£¬²»¹ÜÊDz»ÊÇÔÚͬһ¸ö<%.........%>ÄÚ²¿
3.±í´ïʽ
ÐÎÈç<%=a%>
ÆäÖÐaÊDZäÁ¿»òÕß³£Á¿£¬´ËÓï¾ä½«Ïò¿Í»§¶ËÍøÒ³ÖÐÊä³öaµÄÖµ
Ïà¹ØÎĵµ£º
Ê×ÏÈ,˵һÏÂ301Öض¨ÏòµÄÒâÒåÓë×÷ÓÃ(ÍøÉÏÕÒµÄÏà¹Ø×ÊÁÏ)
ÆäʵÕâ¾ÍÉæ¼°µ½ÁËSEOµÄ֪ʶ¡£
ʲôÊÇ301תÏò£¿
´ÓËÑË÷ÒýÇæÓÅ»¯½Ç¶È³ö·¢£¬301Öض¨ÏòÊÇÍøÖ·Öض¨Ïò×îΪ¿ÉÐеÄÒ»ÖÖ°ì·¨¡£µ±ÍøÕ¾µÄÓòÃû·¢Éú±ä¸üºó£¬ËÑË÷ÒýÇæÖ»¶ÔÐÂÍøÖ·½øÐÐË÷Òý£¬Í¬Ê±ÓÖ»á°Ñ¾ÉµØÖ·ÏÂÔÓеÄÍⲿÁ´½ÓÈçÊýתÒƵ½ÐµØÖ·Ï£¬´Ó¶ø²»»áÈÃÍøÕ¾µÄÅÅÃûÒòΪÍøÖ ......
來Ô´£ºhttp://www.diybl.com/course/4_webprogram/jsp/jsp_js/2008229/102031.html
Ò»¡¢JSP ELÓïÑÔ¶¨Òå
E L£¨Expression Language£© Ä¿µÄ£ºÎªÁËʹJSPдÆðÀ´¸ü¼Ó¼òµ¥¡£
±í´ïʽÓïÑÔµÄÁé¸ÐÀ´×ÔÓÚ ECMAScript ºÍ XPath ......
ÏÂÃæÊÇjsp´úÂë<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="com.yourcompany.struts.action.Student" %>
<%@ t ......
<%@ page info="Random Image Show"
pageEncoding="UTF-8" contentType="image/jpg"
autoFlush="true" buffer="16kb" session="false" import="java.io.FileInputStream"
%>< ......