logic:Iterator标签(以下简称“该标签”)是Struts里非常常用的一个标签,其作用在于循环显示给定容器对象中的值。
如此常用的标签,其源代码当然需要拿出来研究一下,以下列举几条研究成果:
1、该标签内部使用Collection来表示给定的容器,所有的给定容器对象(如ArrayList,Map等)都会被其转化成为Collection,Collection实际就是Map和List的父类。
2、该标签自己维护循环索引,不用程序员管理索引
3、该标签常见的几个属性如下:name、property、scope、id
对应Struts给出的Api说明如下:
name:包括要遍历Collection的Jsp页面的bean的名字(如果property没有被定义),或者是那些通过getter方法获得属性的Jsp中的Bean的名字,这些getter方法返回的是Collection(如果property定义了)。
property:在name命名的Jsp bean中定义的属性的名字,通过getter方法返回一个Collection
scope:指示到哪里去寻找name为名字的bean,如果没有定义缺省为"any scope"
id:如果Collection非空的话,在每次遍历时候Collection中每个元素的名字。
其中除了id每个元素均为Rt expr,这儿的rt expr的意思就是Run Time Expression。明确的说就是,如果你对一个Attribute的<rtexprvalue>指定为true,你就可以在这样的属性中使用<%=%>之类的东东。这个配置文件在tld中。
只有id是必须要说明的。
关于Api说明的说明:
id只是一个临时标识,在下面的<bean:write里面出现的name属性要和id一致才能打印出<bean:write的property,而此property就是在iterator中的属性。
举例说明
以下代码生成一个阶梯状表格
系统 资源 操作
soft3
res3
opt3
soft12
res12
opt1211
soft11
res11
opt1111
在此之前传来一个request.getAttribute("userPurview"),所以有在第一个logic中的userPurview,就是在这个request里面寻找userPurview
返回的是一个list
<table width="300" border="0">
<tr><td>系统</td>
<td>资源</td>
<td>操作</td>
</tr>
<logic:iterate id="targetSys" name="userPurview" scope="request"> //这个id可以随便起名,但是要注意下文使用的一致性
<tr bgcolor="#cccccc"><td height="21" class="unnamed2">
<bean:write name="targetSys" property="cn"/> //此处name和上面id保持一致,property就是第一个list里面的元素
</td>
<td height="21" class="unnamed2"> </td>
<td height="21" class="unnamed3"> </td>
</tr>
<logic:iterate id="targetRes" name="targetSys" property="purviewResList">
<tr><td height="21" class="unnamed2"> </td><td height="21" class="unnamed5">
<bean:write name="targetRes" property="cn"/>
</td>
<td height="21" class="unnamed6"> </td>
</tr>
<logic:iterate id="targetOpr" name="targetRes" property="purviewOprList">
<tr><td height="21" class="unnamed4"> </td><td height="21" class="unnamed4"> </td>
<td height="21" class="redzi">
<bean:write property="cn" name="targetOpr"/></td>
</tr>
</logic:iterate>
</logic:iterate>
</logic:iterate>
</table>
结论:
多级迭代和单层差不多,唯一注意的就是id和<bean:write中的name的对应,上级logic的id与下级logic的name对应,并且取出来的要是个Collection,name和id不一定实际需要这个bean,都是虚拟的
相关推荐
ibatis标签
NULL 博文链接:https://duqiangcise.iteye.com/blog/286764
logic:iterate
是Logic 标签库中最复杂的标签,也是用途最广的一个标签,它能够在一个循环中遍历数组、Collection、Enumeration、Iterator 或 Map 中的所有元素。 1. 遍历集合 的 name 属性指定需要进行遍历的集合对象, 它每次从集合中检索出一个元素, 然后把它放在page 范围内, 并以id 属性指定的字符串来命名这个元素, 例如: ...
struts 标签 logic:iterate使用 logic:iterate
我就是靠这个文档实现logic:iterate的循环的<br>struts 标签 logic:iterate使用 logic:iterate<br><br>第一页 是struts官方的说明,<br>第二页 是个例子<br>第三页 是我实现的arrayList放入标签的方法。<br>这是页面文件<br><%@ page language="java"<br> import="java.util.*,cn.edu.bit.zgc2d.accountQuery.*" pageEncoding="GBK"%><br><%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"<br> prefix="bean"%><br><%@ taglib uri="http://jakarta.apache.org/struts/tags-html"<br> prefix="html"%><br><%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"<br> prefix="logic"%><br><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><br><html><br> <head><br> </head><br> <body><br> <table><br> <tr><br> <td><%@ include file="../menu.txt"%><br> </td><br> </tr><br> </table><br> <table width=800><br> <tr><br> <td height=100 width=30><br> <img src=../images/small_2.gif><br> </td><br> <td><br> 账务查询<br> <br><br> 基本信息查询。<br> </td><br> </tr><br> </table><br> <table width=800><br> <tr><br> <td height=1 width=700 bgcolor=gray colspan=2></td><br> </tr><br> </table><br> <table width=800><br> <tr><br> <td height=100 width=30><br> <img src=../images/small_2.gif><br> </td><br> <td><br> 基本信息查询。<br> </td><br> </tr><br> </table><br> <table><br> <tr><br> <td WIDTH=100 bgcolor=#bfbfbf><br> 帐号<br> </td><br> <td WIDTH=100 bgcolor=#bfbfbf><br> 帐户别名<br> </td><br> <td WIDTH=100 bgcolor=#bfbfbf><br> 是否为主帐户<br> </td><br> </tr><br> <logic:iterate id="item" name="list" indexId="index"><br> <tr><br> <td WIDTH=100 bgcolor=F2F2F2><br> <a href="www.sina.com.cn?abc=<bean:write name="item" property="account" />"><bean:write name="item" property="account" /><br> </td><br> <td WIDTH=100 bgcolor=F2F2F2><br> <bean:write name="item" property="other_name" /><br> </td><br> <td WIDTH=100 bgcolor=F2F2F2><br> <bean:write name="item" property="is_main_account" /><br> </td><br> </tr><br> </logic:iterate><br> </table><br> </body><br></html><br>这是action<br>public class InformationAction extends Action {<br> public ActionForward execute(ActionMapping mapping, ActionForm form,<br> HttpServletRequest request, HttpServletResponse response) {<br> InformationForm informationForm = (InformationForm) form;// TODO Auto-generated method stub<br> //业务开始<br> Connection conn = null; Statement st = null; ResultSet rs = null;<br> try {<br> db db = new db();<br> // 打开数据库<br> conn = db.conn();<br> // 创建st<br> st = conn.createStatement();<br> // 组织sql并执行<br> HttpSession session_account = request.getSession();<br> String account = (String) session_account.getAttribute("account");<br> String sql = "select * from account where main_account=" + account<br> + "order by is_main_account desc";<br> rs = st.executeQuery(sql);<br> // 组建arrayList列表<br> ArrayList list = new ArrayList();<br> while (rs.next()) {<br> accountBean bean = new accountBean();<br> bean.setArea(rs.getString("area")); bean.setKind(rs.getInt("kind")); bean.setAccount(rs.getString("account")); bean.setMain_account(rs.getString("main_account")); bean.setType(rs.getInt("type")); bean.setOther_name(rs.getString("other_name")); bean.setPassword(rs.getString("password")); bean.setIs_main_account(rs.getInt("is_main_account")); bean.setMoney(rs.getString("money")); bean.setId(rs.getInt("id"));<br> list.add(bean);<br> }<br> HttpSession session = request.getSession();<br> session.setAttribute("list", list);<br> return mapping.findForward("success");<br> } catch (Exception e) { e.printStackTrace(); } <br> //业务结束<br> return null;<br> }<br>}//自己将需要的包导入<br>bean文件<br>package cn.edu.bit.zgc2d.accountQuery;<br><br>public class accountBean {<br> private String area;<br> private int kind;<br> private String account;<br> private String main_account;<br> private int type;<br> private String other_name;<br> private String password;<br> private int is_main_account;<br> private String money;<br> private int id;<br> public String getArea() {<br> return area;<br> }<br> public void setArea(String area) {<br> this.area = area;<br> }<br> public int getKind() {<br> return kind;<br> }<br> public void setKind(int kind) {<br> this.kind = kind;<br> }<br> public String getAccount() {<br> return account;<br> }<br> public void setAccount(String account) {<br> this.account = account;<br> }<br> public String getMain_account() {<br> return main_account;<br> }<br> public void setMain_account(String main_account) {<br> this.main_account = main_account;<br> }<br> public int getType() {<br> return type;<br> }<br> public void setType(int type) {<br> this.type = type;<br> }<br> public String getOther_name() {<br> return other_name;<br> }<br> public void setOther_name(String other_name) {<br> this.other_name = other_name;<br> }<br> public String getPassword() {<br> return password;<br> }<br> public void setPassword(String password) {<br> this.password = password;<br> }<br> public int getIs_main_account() {<br> return is_main_account;<br> }<br> public void setIs_main_account(int is_main_account) {<br> this.is_main_account = is_main_account;<br> }<br> public String getMoney() {<br> return money;<br> }<br> public void setMoney(String money) {<br> this.money = money;<br> }<br> public int getId() {<br> return id;<br> }<br> public void setId(int id) {<br> this.id = id;<br> }<br>}<br>
logic:itertae标签的使用
logic:iterate logic:iterate标记用于在页面中创建一个循环,以此来遍历如数组,Collection,Map这样的对象。该标记的功能强大,在 Struts应用的页面中经常使用到。 对数组进行循环遍历 使用logic:iterate标记可以用于遍历数组。以下是一段示例代码: 在上面的代码中,首先定义了一个字符串数组,并为其初始化。接着...
免安装版Notepad++终极配置:右键菜单+图标美化+多文件批量处理(2024新版)
本文详细介绍了如何为免安装版Notepad++进行终极配置,包括右键菜单添加、图标美化以及多文件批量处理功能。通过注册表编辑和高级定制,用户可以在便携版中实现与安装版相同的功能体验,同时保持系统整洁。特别适合开发者、系统管理员和效率追求者使用。
【抖音】a_bogus参数逆向分析
点击——展开xxx条回复﹀就会出现。可以看到这个栈是有请求相关的数据的。所以就是在bdms.js里面生成的。
struts--logic标签
标记用于在页面中创建一个循环,以此来遍历如数组、Collection、Map这样的对象。该标记的功能强大,在Struts应用的页面中经常使用到。 1、对数组进行循环遍历 使用标记可以用于遍历数组,以下是一段示例代码: String[] testArray={"str1","str2","str3"}; pageContext.setAttribute("test",testArray)
深入解析i2cdetect:从基础命令到高级读写操作
本文深入解析Linux下i2cdetect工具,从基础安装、总线扫描到高级读写操作。作为i2c-tools的核心组件,i2cdetect是硬件调试的得力侦探,能快速识别I2C总线上的设备地址。文章还涵盖了i2cdump、i2cset、i2cget等进阶工具,并介绍了如何在C程序中调用读写接口进行嵌入式开发,是掌握I2C通信调试的实用指南。
struts中logic:iterate标签的使用
通常我们通过查询数据库获取到的数据最终会通过页面显示给用户,通常我们会将这些数据存放在list集合中使用,这里有多种方法来迭代显示数据 首先,我们需要在Action中将这个list集合存储起来,通过setAttribute()方法或放到session中或放到request中 1、在jsp页面中写java代码,遍历输出集合中的对象信息,如下
Qt绘图实战:用QGraphicsItem实现可拖拽箭头连接(附完整代码)
本文详细介绍了如何使用Qt的QGraphicsItem框架实现一个功能完备的可拖拽箭头连接组件。通过核心代码示例,讲解了如何创建自定义图形项、实现智能吸附、碰撞检测以及实时拖拽编辑路径,为构建流程图、拓扑图等专业图形编辑器提供了完整的解决方案。
RH850_U2A系列HSM安全核开启但是固件未烧录导致无法启动也无法再烧入固件废板问题分析解决
hsm核导致的安全锁死补救方案
logic:iterate标签
id是迭代时的临时变量名称 两种查找迭代对象的方式: 1,name:所指代的bean必须是一个集合类型 2,name+property:该bean的property属性必须是一个集合类型 <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getSe
双目视觉三维重构(一)————简介
优快云中关于立三维重构的介绍层出不穷,CNKI中也有各类综述对三维重构进行总结,撰写这篇博客仅作为本人对该类博客、论文的总结学习,加深自身学习的印象、作为学习的笔记。如有错误的地方,欢迎指正。 1、三维重构 1.1、三维重构到底是什么? 首先要了解立体匹配算法,首先要知道立体匹配算法主要具体应用于什么方向。 三维重构又被称为三维重建,百度百科中对它的定义为:指对三维物体建立适合...
Struts标签中的多层logic:iterator详解(原创)
logic:Iterator标签(以下简称“该标签”)是Struts里非常常用的一个标签,其作用在于循环显示给定容器对象中的值。如此常用的标签,其源代码当然需要拿出来研究一下,以下列举几条研究成果:1、该标签内部使用Collection来表示给定的容器,所有的给定容器对象(如ArrayList,Map等)都会被其转化成为Collection,Collection实际就是Map和List的父类。2、
Unity2D像素刀光实现:粒子方向控制与像素级渲染规范
像素风游戏中的刀光特效并非普通粒子动画,而是需严格遵循像素艺术原理的视觉暂留模拟。其核心在于将‘瞬时切割感’转化为程序可执行的渲染逻辑:通过禁用纹理滤波保障1:1像素锐度,绑定刀锋向量控制粒子运动方向,限定≤0.15秒生命周期匹配人眼暂留阈值,并采用Stretched Billboard实现动态拉伸拖影。该方案兼顾美术语义(如直劈、横扫、突刺)与工程约束(Sorting Layer分层、对象池复用、单粒子GPU优化),广泛适用于Unity2D平台的动作反馈系统,尤其适配《空洞骑士》《死亡细胞》类高节奏像素R
基于Python实现人脸识别相似度对比
随着人工智能技术的不断进步,人脸识别成为了一种广泛应用的技术。人脸相似度对比是其中的一个重要应用场景,可以用于人脸搜索、身份验证等方面。本文将介绍如何使用Python实现人脸相似度对比。
Struts源码研究 - logic-Iterator标签篇[转载]
http://www.7880.com/Info/Article-44a0f840.htmllogic:Iterator标签(以下简称“该标签”)是Struts里非常常用的一个标签,其作用在于循环显示给定容器对象中的值如此常用的标签,其源代码当然需要拿出来研究一下,以下列举几条研究成果:1、该标签内部使用Collection来表示给定的容器,所有的给定容器对象(如ArrayList,Map等)都会
计算机控制技术及应用
《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。
Struts源码研究 - logic-Iterator标签篇
logic:Iterator标签(以下简称“该标签”)是Struts里非常常用的一个标签,其作用在于循环显示给定容器对象中的值如此常用的标签,其源代码当然需要拿出来研究一下,以下列举几条研究成果:1、该标签内部使用Collection来表示给定的容器,所有的给定容器对象(如ArrayList,Map等)都会被其转化成为Collection2、该标签自己维护循环索引3、该标签常见的几个属性如下:na
TMS_WebGMaps_1.9.8.0_Full_Source
TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder
老版QQ原生表情gif动态
这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。
struts技术的logic标签
(转自)struts技术的logic标签 开源项目最好的是可以让我们从项目的源码本身角度看项目,通过对源码的了解更多的是对设计思想融会贯通达提升整体能力的目的。 一、定义标签文件(web.xml) /tags/struts-logic /WEB-INF/struts-logic.tld 二、引用标签文件(jsp文件)
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
Struts标签中的多层logic:iterator详解
logic:Iterator标签(以下简称“该标签”)是Struts里非经常用的一个标签,其作用在于循环显示给定容器对象中的值。 如此常用的标签,其源代码当然需要拿出来研究一下,以下列举几条研究成果: 1、该标签内部使用Collection来表示给定的容器,所有的给定容器对象(如ArrayList,Map等)都会被其转化成为Collection,Collection实际就是Map和Li...
logic-Iterator
logic:Iterator标签(以下简称“该标签”)是Struts里非常常用的一个标签,其作用在于循环显示给定容器对象中的值 如此常用的标签,其源代码当然需要拿出来研究一下,以下列举几条研究成果: 1、该标签内部使用Collection来表示给定的容器,所有的给定容器对象(如ArrayList,Map等)都会被其转化成为Collection 2、该标签自己维护循环索引 3
Struts logic:iterate标签的总结
是Logic 标签库中最复杂的标签,也是用途最广的一个标签,它能够在一个循环中遍历数组、Collection、Enumeration、Iterator 或 Map 中的所有元素。 1. 遍历集合 的 name 属性指定需要进行遍历的集合对象, 它每次从集合中检索出一个元素, 然后把它放在page 范围内, 并以id 属性指定的字符串来命名这个元素, 例如: Vector animals =
logic:iterator标签用法
[color=indigo][/color]logic:iterate> 是Logic 标签库中最复杂的标签,也是用途最广的一个标签,它能够在一个循环中遍历数组、Collection、Enumeration、Iterator 或 Map 中的所有元素。 1. 遍历集合 的 name 属性指定需要进行遍历的集合对象, 它每次从集合中检索出一个元素, 然后把它放在page 范围内, 并以id 属...
Struts源码研究 - logic-Iterator标签
logic:Iterator标签(以下简称“该标签”)是Struts里非常常用的一个标签,其作用在于循环显示给定容器对象中的值如此常用的标签,其源代码当然需要拿出来研究一下,以下列举几条研究成果:1、该标签内部使用Collection来表示给定的容器,所有的给定容器对象(如ArrayList,Map等)都会被其转化成为Collection2、该标签自己维护循环索引3、该标签常见的几个属性如下:na
Struts的logic标签
开源项目最好的是可以让我们从项目的源码本身角度看项目,通过对源码的了解更多的是对设计思想融会贯通达提升整体能力的目的。blog也是一个好的项目,可以让不从事网页制作人们也可以通过简单的配置实现在网上发布文章的目的。先前也用struts做过两个项目,现在只是想从另一个角度来理解它。每天看了一点儿struts的源码,记录下自已的理解。一、定义标签文件(web.xml)/tags/str
struts标签--logic总结
struts标签--logic总结 1. logic:empty 该标签是用来判断是否为空的。如果为空,该标签体中嵌入的内容就会被处理。该标签用于以下情况: 1)当Java对象为null时; 2)当String对象为""时; 3)当java.util.Collection对象中的isEmpty()返回true时;
280



被折叠的 条评论
为什么被折叠?



