The simplest demonstration of using indexed properties in Struts can be shown with the following simple bean and JSP page:
package org.apache.struts.webapp.exercise;
import org.apache.struts.action.ActionForm;
public class StringBean extends ActionForm {
private String strAry[] = { "String 0", "String 1", "String 2", "String 3", "String 4" };
public String getStringIndexed(int index) {
return strAry[index];
}
public void setStringIndexed(int index, String value) {
strAry[index] = value;
}
}
First note the two methods in the StringBean class, "getStringIndexed()" and "setStringIndexed()". Note that the "get" method takes an "int" and the "set" method takes an "int" and "String". The Beanutils package and Struts recognizes this arrangement of signatures as an "indexed property", in this case with the property name "stringIndexed".
<!-- indexedtest.jsp -->
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<jsp:useBean id="bean" class="org.apache.struts.webapp.exercise.StringBean"/>
<bean:write name="bean" property="stringIndexed[1]"/>
Note the property value of "stringIndexed[1]". This is intended to reference the indexed property "stringIndexed", and the 1st (zero-based) entry of whatever array or collection which the indexed property represents.
As you might be able to guess, when this page is executed, it will print just the string "String 1", which is the corresponding array entry at that index value.
This is a simple demonstration of what indexed properties can provide.
分享到:
相关推荐
但是如果在浏览器上需要用到数据库一般会使用Indexed DB数据库,webSQL基本上已经废弃了,具体原因小伙伴可以下来自己查查。 IndexedDB 是一种底层 API,用于在客户端存储大量的结构化数据(也包括文件/二进制大型...
前段时间项目需要本地存储聊天数据,使用到indexedDB,经查阅大量文章,终于完成。感觉网上indexedDB的文章不够多,也不够完善,因此把代码分享出来,帮助需要的小伙伴。
IndexedDB 基本使用
非常简单的indexedDB例子,自己按照书上面写的, 用的是 visual studio 2012 做的 mvc3 程序。
indexeddb-promiseIndexedDB的所有操作都是异步的,API都是在回调函数中执行的,为了便于对其进行操作,使用ES6中的Promise来封装。1. 安装npm包// use npmnpm install --save-dev indexeddb-promise// use yarnyarn...
html5 indexeddb 存储
ngx-indexed-db ngx-indexed-db是一项服务,结合了ngx-indexed-db ,将IndexedDB数据库包装在Angular服务中。安装$ npm install ngx-indexed-db或者$ yarn add ngx-indexed-db用法导入NgxIndexedDBModule并启动它: ...
IndexedDB详细
These instructions provide indexed DCR accesses where the address of the DCR is taken from the contents of a specified register rather than being hard coded in the instruction. This permits DCR ...
一个本地数据库(Web SQL IndexedDB)实现的通信录;介绍怎样创建打开数据库,创建表,添加数据,更新数据,删除数据,删除表 等等。
一个超级简单小型的,基于promise采用IndexedDB的健值存储
用于管理您的客户端缓存,是IndexedDB微小封装支持版本控制和max age
好用的mui索引列表插件,我的博客中有详细教程,博客地址: https://blog.csdn.net/lianzhang861/article/details/80505799
even bit indexed chips. Following this bipolar data formatting is performed and signal modulated with a 2.4 GHz carrier on the In Phase and QuadraturePhase data stream and adds it to get the required ...
indexedDB.html
浏览器端 indexed db 封装成更简洁易操作的接口, 数据库变化监控!
lovefield 是建立在 IndexedDB 上的关系查询引擎。它提供了类似 SQL 的语法,并且可以跨浏览器工作(目前支持 Chrome 37 及以上版本,Firefox 31 及以上版本,IE 10 及以上版本)。示例代码:<!doctype html> <...
NULL 博文链接:https://liuna718-163-com.iteye.com/blog/2178433
一个用于React的小型React式IndexedDB绑定。 npm i indexeddb-hooked初始化数据库您将React应用程序与IndexedDBProvider组件连接起来,并在config对象中定义您的模式。 import React from 'react' ;import { ...
解压即用。解压即用。解压即用。解压即用。解压即用。解压即用。解压即用。