我们常常把一组集合放到每个页面的下拉框中,这里利用struts1的html:optionsCollection可以省很多事。
举个例子:
写一个公共静态方法:
public static Collection<LabelValueBean> getAllType() {
Collection<LabelValueBean> col = new ArrayList<LabelValueBean>();
col.add(new LabelValueBean("所有终端", ""));
col.add(new LabelValueBean("2G全部", "1%"));
col.add(new LabelValueBean("2G手机", "101"));
col.add(new LabelValueBean("3G全部", "2%"));
col.add(new LabelValueBean("3G手机", "201"));
col.add(new LabelValueBean("3G数据卡", "202"));
col.add(new LabelValueBean("3G上网本", "203"));
col.add(new LabelValueBean("3G家庭网关", "204"));
col.add(new LabelValueBean("3G无线固话", "205"));
return col;
}
然后在请求action的时候放到request中。如:request.setAttribute("types",xxx.getAllType());
在页面上可以显示为:
<nested:select property="yourproperty">
<html:optionsCollection name="types"/>
</nested:select>
这样就可以在页面上得到一个下拉列表,这样做的好处之一就是书写简单,方便后期维护
CSS是DHTML的基础,CSS用于设定HTML元素在页面上的显示风格,而CSS-P则是CSS的一个扩展,它可用来控制HTML元素在网页上或者说在窗口的位置。下面的两个链接提供了CSS和CSS-P详尽的技术手册:
W3C CSS-Positioning
Builder.com's CSS Guide
在本课程中,将会反复地对CSS进行介绍。
使用DIV标签
......
测试语法高亮的 C# 代码的 html fragment 生成:
用csdn blog API 发布.
下面是:
public class HtmlWriter
{
static Dictionary _colors;
static int _colorNum;
static StringBuilder _colorString;
*/
-->
Author:
Thinkhy
Date:
2010.04.11.
Url:
http://www.disandu.com/?p=714
Keyword:
HTML空元素 DIV XSLT jQuery
今天有个HTML空元素的问题折腾了我两个小时,问题是这样的,我要处理一段描述结构化文本的HTML片断:
<div class='paper'>
<div class='questio ......
//回车:[\n\r\t]
$reg="|typeid=\"(.*)\" onsel.*[\n\r\t]*<a href="\" mce_href="\""#\">(.*)</a>|";
preg_match_all ($reg,
$html,
$out, PREG_PATTERN_ORDER);
foreach ($out as $value){
foreach ($value as $value2){
if(strlen($value2)<20)
echo ($value2."<br>");
}
} ......