JSPÖÐ×Ô¶¨Òå±êÇ©ÊôÐÔÅäÖÃ˵Ã÷
required ÊÇÊÇ·ñΪ±ØÑ¡ÊôÐÔ
rtexprvalueµÄÈ«³ÆÊÇ Run-time Expression Value£¬ ËüÓÃÓÚ±íʾÊÇ·ñ¿ÉÒÔʹÓÃJSP±í´ïʽ.
µ±ÔÚ<attribute>±êÇ©ÀïÖ¸¶¨<rtexprvalue>true</rtexprvalue>ʱ£¬ ±íʾ¸Ã×Ô¶¨Òå±êÇ©µÄijÊôÐÔµÄÖµ¿ÉÒÔÖ±½ÓÖ¸¶¨»òÕßͨ¹ý¶¯Ì¬¼ÆËãÖ¸¶¨, example as follow:
<sql:query var="result" >
select * from mytable order by nameid
</sql:query>
<%request.setAttribute("nameid", "2"); %>
<myTag:cupSize cupSize="1" cupSizes="${result}"></myTag:cupSize>
<myTag:cupSize cupSize="${nameid}" cupSizes="${result}"></myTag:cupSize>
µ±ÔÚ<attribute>±êÇ©ÀïÖ¸¶¨<rtexprvalue>false</rtexprvalue>ʱ£¬ ±íʾ¸Ã×Ô¶¨Òå±êÇ©µÄijÊôÐÔµÄÖµÖ»ÄÜÖ±½ÓÖ¸¶¨, example as follow:
<myTag:cupSize cupSize="1" cupSizes="${result}"></myTag:cupSize>
Ïà¹ØÎĵµ£º
jsp±íµ¥Ìá½»µÄÊý¾ÝÓÐÖÐÎÄʱ³öÏÖÂÒÂ룬²¢·Ç¶ÁÈ¡Êý¾Ý¿âÊý¾ÝºóÏÔʾÂÒÂ룬ÒÔÏÂÊǽâ¾öµÄ·½·¨¡£
netbeans´´½¨jspµÄÄ£°æÖÐÊÇ£º<%@page contentType="text/html" pageEncoding="UTF-8"%>£¬½«ÕâÐиijÉÒÔÏÂÕâÑù¾Í¿ÉÒÔÕý³£ÏÔʾÖÐÎÄ£º
<%@page language="java" pageEncoding=utf-8" %>
<%@page contentType=” ......
<%
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
List stafflist = ((StaffDAO)ctx.getBean("StaffDAO")).findAll();
request.setAttribute("stafflist",stafflist);
%> ......
servletÖлñµÃÏîÄ¿¾ø¶Ô·¾¶
String filePath=this.getServletConfig().getServletContext().getRealPath("/");
¸ùĿ¼Ëù¶ÔÓ¦µÄ¾ø¶Ô·¾¶:request.getServletPath();
ÎļþµÄ¾ø¶Ô·¾¶ :request.getSession().getServletContext().getRealPath(request.getRequestURI())
µ±Ç°webÓ¦Óõľø¶Ô·¾¶ :servletConfig.getServletCo ......
JAVA×ÛºÏÃæÊÔÌâ£ºÒ³ÃæµÄץȡ¡¢½âÎö¡¢±£´æÊý¾Ý¿âºÍÉú³ÉHTMLµÄÒ³ÃæÕ¹Ê¾ ÊÕ²Ø
´ÎÀý×Ó¿ÉÒÔÓÃÀ´Ñ§Ï°ÍøÂç±à³Ì£¬ÕýÔò±í´ïʽµÄʹÓ㬷ºÐÍ£¬Êý¾Ý¿âµÄ»ù±¾²Ù×÷µÈJAVA֪ʶ
ÎÊÌâÈçÏ£ºÀ´Ô´ÓÚÂÛ̳
http://topic.csdn.net/u/20090616/13/59aa4e2d-3752-45df-9c1b-c65c46c3e4d7.html
дһ¸öjspÒ³Ãæ£¬·ÃÎÊʱÏÔʾ´ÓÏÂÃæµÄÒ³ÃæÌ ......