当前位置:  编程技术>WEB前端
本页文章导读:
    ▪Ext apiDoc 离线版制作      需要几个js包,并修改index.html就可以了。 1. 离线index.html 2. 在线index.html 需要的资源:Ext apidoc 离线.zip 作者:JustOneRoad 发表于2013-3-22 16:32:15 原文链接 .........
    ▪一口一口吃掉Struts(五)——测试Struts标签库      Struts标签库的使用和JSTL标签库使用方式类似。 认识可以了,建议熟练掌握JSTL标签库。struts标签库基本认识就可以了。   核心操作: 配置:  * 配置国际化支持,在struts-config.xml文.........
    ▪项目的部分代码(手写智能提示,无刷新分页)      <div class="content"> <div class="search"> <label class="search-label">搜索项目:</label> <img src=/blog_article/"@Url.Content("~/Content/Images/PMS_b.........

[1]Ext apiDoc 离线版制作
    来源: 互联网  发布时间: 2013-11-06

需要几个js包,并修改index.html就可以了。

1. 离线index.html

2. 在线index.html


需要的资源:Ext apidoc 离线.zip


作者:JustOneRoad 发表于2013-3-22 16:32:15 原文链接
阅读:39 评论:0 查看评论

    
[2]一口一口吃掉Struts(五)——测试Struts标签库
    来源: 互联网  发布时间: 2013-11-06

Struts标签库的使用和JSTL标签库使用方式类似。

认识可以了,建议熟练掌握JSTL标签库。struts标签库基本认识就可以了。

 

核心操作:

配置:
 * 配置国际化支持,在struts-config.xml文件中加入如下配置:
 <message-resources parameter="MessageResources" />
 * 最好提供国际化资源文件(MessageResources.properties),将该文件放到src下
 
使用:
 采用taglib引入
 <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>    
 <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>   

 

测试代码:

ACTION

package com.jialin;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class TestAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		//普通字符串
		request.setAttribute("hello", "helloworld");
		//html文本
		request.setAttribute("world", "<font color='red'>Hello World!</font>");
		//日期
		request.setAttribute("today", new Date());
		//数字
		request.setAttribute("number", 12345.1234);
		
		Group group = new Group();
		group.setName("师院");
		
		User user = new User();
		user.setUsername("张三");
		user.setAge(18);
		user.setGroup(group);
		//结构数据
		request.setAttribute("user", user);
		
		//空
		request.setAttribute("attr1", null);
		request.setAttribute("attr2", "");
		request.setAttribute("attr3", new ArrayList());
		
	
		//List
		List userList = new ArrayList();
		
		for (int i=0; i<10; i++) {
			User user1 = new User();
			user1.setUsername("张三_" + i);
			user1.setAge(18 + i);
			user1.setGroup(group);
			
			userList.add(user1);
		}
		
		request.setAttribute("userlist", userList);
		
		return mapping.findForward("showresult");
	}

}

User

package com.jialin;

public class User {

	private String username;
	
	private int age;
	
	private Group group;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public Group getGroup() {
		return group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}
}

Group

package com.jialin;

public class Group {

	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}

 

JSP

<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>     
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>      

    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
</head>
<body>
<h1>测试beanwrite标签</h1>
	<li>普通字符串</li><br>
hello(标签):<bean:write name="hello"/>
<p></p>
	<li>html文本</li><br>
world(default):<bean:write name="world"/><br/>
world(filter true):<bean:write name="world" filter="true"/><br/>
world(filter false):<bean:write name="world" filter="false"/>
<p>
	<li>格式化日期</li><br>
	today(default):<bean:write name="today"/><br>
	today(format="yyyy-MM-dd HH:mm:ss"):<bean:write name="today" format="yyyy-MM-dd HH:mm:ss"/>
	<p>
	<li>格式化数字</li><br>
	n(default):<bean:write name="number"/><br>
	n(format="###,###.#####"):<bean:write name="number" format="###,###.#####"/><br>
	n(format="###,###.00000"):<bean:write name="number" format="###,###.00000#"/><br>
	<P>
	<li>结构</li><br>
	姓名:<input type="text" name="username" value="<bean:write name="user" property="username"/>"> <br>
	年龄:<input type="text" name="userage" value="<bean:write name="user" property="age"/>"> <br>
	所属组:<input type="text" name="usergroup" value="<bean:write name="user" property="group.name"/>"> <br>
	<h1>测试logic:empty,logic:notEmpty,logic:present,logic:notPresent</h1>
	<hr>
	<logic:empty name="attr1">
		atrr1为空<br>
	</logic:empty>
	<logic:notEmpty name="attr1">
		atrr1不为空<br>
	</logic:notEmpty>
	<logic:present name="attr1">
		atrr1存在<br>
	</logic:present>
	<logic:notPresent name="attr1">
		atrr1不存在<br>
	</logic:notPresent>
	<p>
	<logic:empty name="attr2">
		atrr2为空<br>
	</logic:empty>
	<logic:notEmpty name="attr2">
		atrr2不为空<br>
	</logic:notEmpty>
	<logic:present name="attr2">
		atrr2存在<br>
	</logic:present>
	<logic:notPresent name="attr2">
		atrr2不存在<br>
	</logic:notPresent>
	<p>
	<logic:empty name="attr3">
		atrr3为空<br>
	</logic:empty>
	<logic:notEmpty name="attr3">
		atrr3不为空<br>
	</logic:notEmpty>
	<logic:present name="attr3">
		atrr3存在<br>
	</logic:present>
	<logic:notPresent name="attr3">
		atrr3不存在<br>
	</logic:notPresent>
	<p>
	
	<h1>测试迭代标签</h1>
	<hr>
	<table border="1">
		<tr>
			<td>姓名</td>
			<td>年龄</td>
			<td>所属组</td>
		</tr>
		<logic:empty name="userlist">
			<tr>
				<td colspan="3">没有符合条件的数据</td>
			</tr>
		</logic:empty>
		<logic:notEmpty name="userlist">
			<logic:iterate id="user" name="userlist">
				<tr>
					<td>
						<bean:write name="user" property="username"/>
					</td>
					<td>
						<bean:write name="user" property="age"/>
					</td>
					<td>
						<bean:write name="user" property="group.name"/>
					</td>
				</tr>
			</logic:iterate>
		</logic:notEmpty>
	</table>
</body>
</html>


测试结果:

 

下篇继续……

 

 

作者:shan9liang 发表于2013-3-22 16:29:47 原文链接
阅读:30 评论:0 查看评论

    
[3]项目的部分代码(手写智能提示,无刷新分页)
    来源: 互联网  发布时间: 2013-11-06
<div class="content">
            <div class="search">
                <label class="search-label">搜索项目:</label>
                <img src=/blog_article/"@Url.Content("~/Content/Images/PMS_bb_search.png")" alt="search" id="seacherconfirm"/>
                <div id="autocompletefield">
                    <div class="searchers">
                        <input type="text" id="seachers" name="" tabindex="1" art="textbox" value="" emptytext="名称、拼音、编号、简称" maxlength="10" showmaxlength="true" />
                    </div>
                    <div id='autocomplete'>
                    </div>
                </div>
            </div>
            <div id="pagespace">
                <div id="pagenode">
                </div>
                <div id="pagerspace">
                    <div art="pager" id="pager" totalcount="0" template="textMode" pagesize=""
                        pageindex="" onpageindexchanged="pageIndexChanged">
                    </div>
                    <p id="pagemsg"></p>
                </div>
            </div>
        </div>


 // 开始进入,加载第一页的数据
        $(function () {
            var url = "@this.Url.Action("ProjectDisplayPagerData", "Manager")";
            var pageindex = 1;
            var pagesize = 3;
            var condition = null;
            var projectstatus = null;
            startpage(url, pageindex, pagesize, condition, projectstatus);
        });

        // 在建项按键计数2器
        var constructProjectCounter = 0;
        // 维保期按键计数器
        var maintainceProjectCounter = 0;
        // 在建项和维保期按钮之间的互斥信号量
        var semaphore = 0;
        // 信号量参数
        var statusprovider = null;

        // 初始化智能提示框的位置
        $("#autocomplete").css("left", $("#seachers").offset().left - 180);
        $("#autocomplete").css("top", $("#seachers").offset().top + 23);

        // 监听键盘抬起的事件
        $("#seachers").keyup(function () {
            var len = $(this).val().trim().length;//解决了中文输入法的问题!

            if (len >= 1) {
                var ul = "@this.Url.Action("AutoGet", "Project")";
                var msg = $("#seachers").val().trim();
                uploadautocompletedata(ul, msg);
            } else {
                $("#autocomplete").empty();
            }
        });

        // 失去焦点是清空
        $("#autocompletefield").mouseleave(function () {
            $("#autocomplete").empty();
        });

        // 搜索框获得焦点清空
        $("#seachers").focus(function () {
            $("#seachers").val("");
        });

        // 当页码开始改变的时候调用
        function pageIndexChanged() {
            var url = "@this.Url.Action("ProjectDisplayPagerData", "Manager")";
            var pageindex = $("#pager").pager("pageindex");
            var pagesize = $("#pager").pager("pagesize");

            var condition = $("#seachers").val().trim();
            var projectstatus = statusprovider;

            $("#pagenode").empty();
            startpage(url, pageindex, pagesize, condition, projectstatus);
        }

        // 加载智能提示消息
        function uploadautocompletedata(ul, msg) {
            $.getJSON(ul, { msg: msg }, function (data) {
                $("#autocomplete").empty();
                for (var i = 0; i < data.Total; i++) {
                    var itemsearch = data.Rows[i];
                    var createelement = $("<div >" +
                        "<p >" + itemsearch.ProjectName + "</p>" +
                        "<p ><span>项目简称:</span><span >" + itemsearch.ProjectShortName +
                        "</span><span>项目编号:</span><span >" + itemsearch.ProjectNumber + "</span></p>" +
                        "</div>");
                    $("#autocomplete").append(createelement);
                }
                $(".autoitem").click(function () {
                    $("#seachers").val($(this).find($(".fullname")).text().trim());

                    var url = "@this.Url.Action("ProjectDisplayPagerData", "Manager")";
                    var pageindex = 1;
                    var pagesize = 3;
                    var condition = $("#seachers").val().trim();
                    var projectstatus = statusprovider;

                    $("#pagenode").empty();
                    startpage(url, pageindex, pagesize, condition, projectstatus);
                    $("#autocomplete").empty();
                });
            });
        }

        // 查询在建期项目
        $("#ConstructProject").click(function () {
            constructProjectCounter++;
            $("#seachers").val("");

            var url = "@this.Url.Action("ProjectDisplayPagerData", "Manager")";
            var pageindex = 1;
            var pagesize = 3;

            var condition = null;
            var projectstatus;

            if (semaphore == 1) {
                $("#MaintainceProject").css({ "background-color": "#11AEE1" });
                $(".safeguard").css("color", "white");
                maintainceProjectCounter = 0;
            }

            if (constructProjectCounter % 2 != 0) {
                projectstatus = "在建项";
                $("#ConstructProject").css({ "background-color": "white" });
                $(".creating").css({ "color": "#11AEE1" });
                semaphore = 1;
                statusprovider = projectstatus;
            } else {
                projectstatus = null;
                $("#ConstructProject").css({ "background-color": "#11AEE1", "color": "white" });
                $(".creating").css({ "color": "white" });
                semaphore = 0;
                statusprovider = null;
            }

            $("#pagenode").empty();
            startpage(url, pageindex, pagesize, condition, projectstatus);

        });

        // 维保期项目
        $("#MaintainceProject").click(function () {
            // 计数器自加
            maintainceProjectCounter++;
            $("#seachers").val("");

            var url = "@this.Url.Action("ProjectDisplayPagerData", "Manager")";
            var pageindex = 1;
            var pagesize = 3;

            var condition = null;
            var projectstatus;

            if (semaphore == 1) {
                $("#ConstructProject").css({ "background-color": "#11AEE1" });
                $(".creating").css("color", "white");
                constructProjectCounter = 0;
            }

            if (maintainceProjectCounter % 2 != 0) {
                projectstatus = "维保期";
                $("#MaintainceProject").css({ "background-color": "white" });
                $(".safeguard").css("color", "#11AEE1");
                semaphore = 1;
                statusprovider = projectstatus;
            } else {
                projectstatus = null;
                $("#MaintainceProject").css({ "background-color": "#11AEE1" });
                $(".safeguard").css("color", "white");
                semaphore = 0;
                statusprovider = null;
            }

            $("#pagenode").empty();
            startpage(url, pageindex, pagesize, condition, projectstatus);
        });

        // 确认搜索
        $("#seacherconfirm").click(function () {
            var url = "@this.Url.Action("ProjectDisplayPagerData", "Manager")";
                var pageindex = 1;
                var pagesize = 3;
                var condition = $("#seachers").val().trim();
                var projectstatus = statusprovider;

                $("#pagenode").empty();
                startpage(url, pageindex, pagesize, condition, projectstatus);
            });

            // 获取后台分页数据,并动态创建元素,实现无刷新分页----> 不解释
            function startpage(url, pageindex, pagesize, condition, projectstatus) {
                $.getJSON(url, { pageindex: pageindex, pagesize: pagesize, condition: condition, projectstatus: projectstatus }, function (data) {
                    for (var i = 0; i < data.Rows.length; i++) {
                        var item = data.Rows[i];
                        var projectNumber      
    
最新技术文章:
▪css white-space:nowrap属性用法(可以强制文字不...
▪IE里button设置border:none属性无效解决方法
▪border:none与border:0使用区别
▪html清除浮动的6种方法示例
▪三个不常见的 HTML5 实用新特性简介
▪css代码优化的12个技巧
▪低版本IE正常运行HTML5+CSS3网站的3种解决方案
▪CSS Hack大全-教你如何区分出IE6-IE10、FireFox、Chr...
▪ie6,ie7,ie8完美支持position:fixed的终极解决方案
▪小技巧处理div内容溢出
▪html小技巧之td,div标签里内容不换行
▪纯CSS实现鼠标放上去改变文字内容
▪li中插入img图片间有空隙的解决方案
▪CSS3中Transition属性详解以及示例分享
▪父div高度不能自适应子div高度的解决方案
▪告别AJAX实现无刷新提交表单
▪从零学CSS系列之文本属性
▪HTML 标签
▪CSS3+Js实现响应式导航条
▪CSS3实例分享之多重背景的实现(Multiple background...
▪用css截取字符的几种方法详解(css排版隐藏溢...
▪页面遮罩层,并且阻止页面body滚动。bootstrap...
▪CSS可以做的几个令你叹为观止的实例分享
▪详细分析css float 属性以及position:absolute 的区...
▪IE6/IE7/IE8/IE9中tbody的innerHTML不能赋值的完美解...
▪CSS小例子(只显示下划线的文本框,像文字一...
▪可以给img元素设置背景图
▪不通过JavaScript实现的自动滚动视差效果
▪div+CSS 兼容小摘
▪CSS的inherit与auto使用分析
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3