JSP中的EL表达式如何取值

JSP中的EL表达式如何取值_第1张图片

源代码:

action层:

	// 返回上傳圖片路勁
		public ActionForward getImagePath(ActionMapping mapping, ActionForm form, HttpServletRequest request,
				HttpServletResponse response) throws Exception {
			// 获取顶部图片路径
			HQLInfo tophqlInfo = new HQLInfo();
			tophqlInfo.setWhereBlock("imageuploadmain.isEnable=:isEnable and imageuploadmain.imageLocation=:imageLocation");
			tophqlInfo.setParameter("isEnable", "0");	
			tophqlInfo.setParameter("imageLocation", "0");
			List top_image_list = getServiceImp(request).findList(tophqlInfo);
			request.setAttribute("top_image", top_image_list);
			request.setAttribute("top_image_size", top_image_list.size());
			// 获取底部图片路径
			HQLInfo centerhqlInfo = new HQLInfo();
			centerhqlInfo
					.setWhereBlock("imageuploadmain.isEnable=:isEnable and imageuploadmain.imageLocation=:imageLocation");
			centerhqlInfo.setParameter("isEnable", "0");
			centerhqlInfo.setParameter("imageLocation", "1");
			List center_imagelist = getServiceImp(request).findList(centerhqlInfo);
			request.setAttribute("center_image", center_imagelist);
			request.setAttribute("center_image_size", center_imagelist.size());

			return getActionForward("iamge", mapping, form, request, response);
		}


jsp页面:

    <% List top_image_list = (List) request.getAttribute("top_image"); // System.out.println("size is:"+top_image_list.size()); int image_size = top_image_list.size(); %> ${top_image_size}
  • banner1
  • banner2
  • banner3
  • banner4
页面展示:

JSP中的EL表达式如何取值_第2张图片


你可能感兴趣的:(JSP中的EL表达式如何取值)