在项目中新建Helpers文件夹,创建CheckBoxListHelper和RadioBoxListHelper类。

CheckBoxListHelper代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Web;
using System.Web.Mvc; namespace SHH.Helpers
{
public static class CheckBoxListHelper
{
public static MvcHtmlString CheckBoxList(this HtmlHelper helper, string name, bool isHorizon = true)
{
return CheckBoxList(helper, name, helper.ViewData[name] as IEnumerable<SelectListItem>, new { }, isHorizon);
} public static MvcHtmlString CheckBoxList(this HtmlHelper helper, string name, IEnumerable<SelectListItem> selectList, bool isHorizon = true)
{
return CheckBoxList(helper, name, selectList, new { }, isHorizon);
} public static MvcHtmlString CheckBoxListFor<TModel, TProperty>(this HtmlHelper helper, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList, bool isHorizon = true)
{
string[] propertys = expression.ToString().Split(".".ToCharArray());
string id = string.Join("_", propertys, , propertys.Length - );
string name = string.Join(".", propertys, , propertys.Length - ); return CheckBoxList(helper, id, name, selectList, new { }, isHorizon);
} public static MvcHtmlString CheckBoxList(this HtmlHelper helper, string name, IEnumerable<SelectListItem> selectList, object htmlAttributes, bool isHorizon = true)
{
return CheckBoxList(helper, name, name, selectList, htmlAttributes, isHorizon);
} public static MvcHtmlString CheckBoxList(this HtmlHelper helper, string id, string name, IEnumerable<SelectListItem> selectList, object htmlAttributes, bool isHorizon = true)
{
IDictionary<string, object> HtmlAttributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); HashSet<string> set = new HashSet<string>();
List<SelectListItem> list = new List<SelectListItem>();
string selectedValues = (selectList as SelectList).SelectedValue == null ? string.Empty : Convert.ToString((selectList as SelectList).SelectedValue);
if (!string.IsNullOrEmpty(selectedValues))
{
if (selectedValues.Contains(","))
{
string[] tempStr = selectedValues.Split(',');
for (int i = ; i < tempStr.Length; i++)
{
set.Add(tempStr[i].Trim());
} }
else
{
set.Add(selectedValues);
}
} foreach (SelectListItem item in selectList)
{
item.Selected = (item.Value != null) ? set.Contains(item.Value) : set.Contains(item.Text);
list.Add(item);
}
selectList = list; HtmlAttributes.Add("type", "checkbox");
HtmlAttributes.Add("id", id);
HtmlAttributes.Add("name", name);
HtmlAttributes.Add("style", "border:none;"); StringBuilder stringBuilder = new StringBuilder(); foreach (SelectListItem selectItem in selectList)
{
IDictionary<string, object> newHtmlAttributes = HtmlAttributes.DeepCopy();
newHtmlAttributes.Add("value", selectItem.Value);
if (selectItem.Selected)
{
newHtmlAttributes.Add("checked", "checked");
} TagBuilder tagBuilder = new TagBuilder("input");
tagBuilder.MergeAttributes<string, object>(newHtmlAttributes);
string inputAllHtml = tagBuilder.ToString(TagRenderMode.SelfClosing);
string containerFormat = isHorizon ? @"<label> {0} {1}</label>" : @"<p><label> {0} {1}</label></p>";
stringBuilder.AppendFormat(containerFormat,
inputAllHtml, selectItem.Text);
}
return MvcHtmlString.Create(stringBuilder.ToString()); }
private static IDictionary<string, object> DeepCopy(this IDictionary<string, object> ht)
{
Dictionary<string, object> _ht = new Dictionary<string, object>(); foreach (var p in ht)
{
_ht.Add(p.Key, p.Value);
}
return _ht;
}
}
}

RadioBoxListHelper代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc; namespace SHH.Helpers
{
public static class RadioBoxListHelper
{
public static MvcHtmlString RadioBoxList(this HtmlHelper helper, string name)
{
return RadioBoxList(helper, name, helper.ViewData[name] as IEnumerable<SelectListItem>, new { });
} public static MvcHtmlString RadioBoxList(this HtmlHelper helper, string name, IEnumerable<SelectListItem> selectList)
{
return RadioBoxList(helper, name, selectList, new { });
} public static MvcHtmlString RadioBoxList(this HtmlHelper helper, string name, IEnumerable<SelectListItem> selectList, object htmlAttributes)
{
IDictionary<string, object> HtmlAttributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); HtmlAttributes.Add("type", "radio");
HtmlAttributes.Add("name", name); StringBuilder stringBuilder = new StringBuilder();
int i = ;
int j = ;
foreach (SelectListItem selectItem in selectList)
{
string id = string.Format("{0}{1}", name, j++); IDictionary<string, object> newHtmlAttributes = HtmlAttributes.DeepCopy();
newHtmlAttributes.Add("value", selectItem.Value);
newHtmlAttributes.Add("id", id);
var selectedValue = (selectList as SelectList).SelectedValue;
if (selectedValue == null)
{
if (i++ == )
newHtmlAttributes.Add("checked", null);
}
else if (selectItem.Value == selectedValue.ToString())
{
newHtmlAttributes.Add("checked", null);
} TagBuilder tagBuilder = new TagBuilder("input");
tagBuilder.MergeAttributes<string, object>(newHtmlAttributes);
string inputAllHtml = tagBuilder.ToString(TagRenderMode.SelfClosing);
stringBuilder.AppendFormat(@" {0} <label for='{2}'>{1}</label>",
inputAllHtml, selectItem.Text, id);
}
return MvcHtmlString.Create(stringBuilder.ToString()); }
private static IDictionary<string, object> DeepCopy(this IDictionary<string, object> ht)
{
Dictionary<string, object> _ht = new Dictionary<string, object>(); foreach (var p in ht)
{
_ht.Add(p.Key, p.Value);
}
return _ht;
}
}
}

枚举帮助类代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; namespace SHH.Helpers
{
/// <summary>
/// 枚举帮助类
/// </summary>
public class EnumHelper
{
/// <summary>
/// 转换如:"enum1,enum2,enum3"字符串到枚举值
/// </summary>
/// <typeparam name="T">枚举类型</typeparam>
/// <param name="obj">枚举字符串</param>
/// <returns></returns>
public static T Parse<T>(string obj)
{
if (string.IsNullOrEmpty(obj))
return default(T);
else
return (T)Enum.Parse(typeof(T), obj);
} public static T TryParse<T>(string obj, T defT = default(T))
{
try
{
return Parse<T>(obj);
}
catch
{
return defT;
}
} public static readonly string ENUM_TITLE_SEPARATOR = ",";
/// <summary>
/// 根据枚举值,返回描述字符串
/// 如果多选枚举,返回以","分割的字符串
/// </summary>
/// <param name="e"></param>
/// <returns></returns>
public static string GetEnumTitle(Enum e, Enum language = null)
{
if (e == null)
{
return "";
}
string[] valueArray = e.ToString().Split(ENUM_TITLE_SEPARATOR.ToArray(), StringSplitOptions.RemoveEmptyEntries);
Type type = e.GetType();
string ret = "";
foreach (string enumValue in valueArray)
{
System.Reflection.FieldInfo fi = type.GetField(enumValue.Trim());
if (fi == null)
continue;
EnumTitleAttribute[] attrs = fi.GetCustomAttributes(typeof(EnumTitleAttribute), false) as EnumTitleAttribute[];
if (attrs != null && attrs.Length > && attrs[].IsDisplay)
{
ret += attrs[].Title + ENUM_TITLE_SEPARATOR;
}
}
return ret.TrimEnd(ENUM_TITLE_SEPARATOR.ToArray());
} /// <summary>
/// 根据枚举值,返回描述字符串
/// 如果多选枚举,返回以","分割的字符串
/// </summary>
/// <param name="e"></param>
/// <returns></returns>
public static string GetAllEnumTitle(Enum e, Enum language = null)
{
if (e == null)
{
return "";
}
string[] valueArray = e.ToString().Split(ENUM_TITLE_SEPARATOR.ToArray(), StringSplitOptions.RemoveEmptyEntries);
Type type = e.GetType();
string ret = "";
foreach (string enumValue in valueArray)
{
System.Reflection.FieldInfo fi = type.GetField(enumValue.Trim());
if (fi == null)
continue;
EnumTitleAttribute[] attrs = fi.GetCustomAttributes(typeof(EnumTitleAttribute), false) as EnumTitleAttribute[];
if (attrs != null && attrs.Length > )
{
ret += attrs[].Title + ENUM_TITLE_SEPARATOR;
}
}
return ret.TrimEnd(ENUM_TITLE_SEPARATOR.ToArray());
} public static EnumTitleAttribute GetEnumTitleAttribute(Enum e, Enum language = null)
{
if (e == null)
{
return null;
}
string[] valueArray = e.ToString().Split(ENUM_TITLE_SEPARATOR.ToArray(), StringSplitOptions.RemoveEmptyEntries);
Type type = e.GetType();
EnumTitleAttribute ret = null;
foreach (string enumValue in valueArray)
{
System.Reflection.FieldInfo fi = type.GetField(enumValue.Trim());
if (fi == null)
continue;
EnumTitleAttribute[] attrs = fi.GetCustomAttributes(typeof(EnumTitleAttribute), false) as EnumTitleAttribute[];
if (attrs != null && attrs.Length > )
{
ret = attrs[];
break;
}
}
return ret;
} public static string GetDayOfWeekTitle(DayOfWeek day, Enum language = null)
{
switch (day)
{
case DayOfWeek.Monday:
return "周一";
case DayOfWeek.Tuesday:
return "周二";
case DayOfWeek.Wednesday:
return "周三";
case DayOfWeek.Thursday:
return "周四";
case DayOfWeek.Friday:
return "周五";
case DayOfWeek.Saturday:
return "周六";
case DayOfWeek.Sunday:
return "周日";
default:
return "";
}
} /// <summary>
/// 返回键值对,建为枚举的EnumTitle中指定的名称和近义词名称,值为枚举项
/// </summary>
/// <typeparam name="T">枚举类型</typeparam>
/// <param name="language"></param>
/// <returns></returns>
public static Dictionary<string, T> GetTitleAndSynonyms<T>(Enum language = null) where T : struct
{
Dictionary<string, T> ret = new Dictionary<string, T>();
//枚举值
Array arrEnumValue = typeof(T).GetEnumValues();
foreach (object enumValue in arrEnumValue)
{
System.Reflection.FieldInfo fi = typeof(T).GetField(enumValue.ToString());
if (fi == null)
{
continue;
} EnumTitleAttribute[] arrEnumTitleAttr = fi.GetCustomAttributes(typeof(EnumTitleAttribute), false) as EnumTitleAttribute[];
if (arrEnumTitleAttr == null || arrEnumTitleAttr.Length < || !arrEnumTitleAttr[].IsDisplay)
{
continue;
} if (!ret.ContainsKey(arrEnumTitleAttr[].Title))
{
ret.Add(arrEnumTitleAttr[].Title, (T)enumValue);
} if (arrEnumTitleAttr[].Synonyms == null || arrEnumTitleAttr[].Synonyms.Length < )
{
continue;
} foreach (string s in arrEnumTitleAttr[].Synonyms)
{
if (!ret.ContainsKey(s))
{
ret.Add(s, (T)enumValue);
}
}
}//using
return ret;
} /// <summary>
/// 根据枚举获取包含所有所有值和描述的哈希表,其文本是由应用在枚举值上的EnumTitleAttribute设定
/// </summary>
/// <returns></returns>
public static Dictionary<T, string> GetItemList<T>(Enum language = null) where T : struct
{
return GetItemValueList<T, T>(false, language);
} /// <summary>
/// 根据枚举获取包含所有所有值和描述的哈希表,其文本是由应用在枚举值上的EnumTitleAttribute设定
/// </summary>
/// <returns></returns>
public static Dictionary<T, string> GetAllItemList<T>(Enum language = null) where T : struct
{
return GetItemValueList<T, T>(true, language);
} /// <summary>
/// 获取枚举所有项的标题,其文本是由应用在枚举值上的EnumTitleAttribute设定
/// </summary>
/// <typeparam name="T">枚举类型</typeparam>
/// <param name="language">语言</param>
/// <returns></returns>
public static Dictionary<int, string> GetItemValueList<T>(Enum language = null) where T : struct
{
return GetItemValueList<T, int>(false, language);
} /// <summary>
/// 获取枚举所有项的标题,其文本是由应用在枚举值上的EnumTitleAttribute设定
/// </summary>
/// <typeparam name="T">枚举类型</typeparam>
/// <param name="isAll">是否生成“全部”项</param>
/// <param name="language">语言</param>
/// <returns></returns>
public static Dictionary<TKey, string> GetItemValueList<T, TKey>(bool isAll, Enum language = null) where T : struct
{
if (!typeof(T).IsEnum)
{
throw new Exception("参数必须是枚举!");
}
Dictionary<TKey, string> ret = new Dictionary<TKey, string>(); var titles = EnumHelper.GetItemAttributeList<T>().OrderBy(t => t.Value.Order);
foreach (var t in titles)
{
if (!isAll && (!t.Value.IsDisplay || t.Key.ToString() == "None"))
continue; if (t.Key.ToString() == "None" && isAll)
{
ret.Add((TKey)(object)t.Key, "全部");
}
else
{
if (!string.IsNullOrEmpty(t.Value.Title))
ret.Add((TKey)(object)t.Key, t.Value.Title);
}
} return ret;
} public static List<T> GetItemKeyList<T>(Enum language = null) where T : struct
{
List<T> list = new List<T>();
Array array = typeof(T).GetEnumValues();
foreach (object t in array)
{
list.Add((T)t);
}
return list;
} public static Dictionary<T, EnumTitleAttribute> GetItemAttributeList<T>(Enum language = null) where T : struct
{
if (!typeof(T).IsEnum)
{
throw new Exception("参数必须是枚举!");
}
Dictionary<T, EnumTitleAttribute> ret = new Dictionary<T, EnumTitleAttribute>(); Array array = typeof(T).GetEnumValues();
foreach (object t in array)
{
EnumTitleAttribute att = GetEnumTitleAttribute(t as Enum, language);
if (att != null)
ret.Add((T)t, att);
} return ret;
} /// <summary>
/// 获取枚举所有项的标题,其文本是由应用在枚举值上的EnumTitleAttribute设定
/// </summary>
/// <typeparam name="T">枚举类型</typeparam>
/// <param name="isAll">是否生成“全部”项</param>
/// <param name="language">语言</param>
/// <returns></returns>
public static Dictionary<TKey, string> GetAllItemValueList<T, TKey>(Enum language = null) where T : struct
{
return GetItemValueList<T, TKey>(true, language);
} /// <summary>
/// 获取一个枚举的键值对形式
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <param name="exceptTypes">排除的枚举</param>
/// <returns></returns>
public static Dictionary<int, string> GetEnumDictionary<TEnum>(IEnumerable<TEnum> exceptTypes = null) where TEnum : struct
{
var dic = GetItemList<TEnum>(); Dictionary<int, string> dicNew = new Dictionary<int, string>();
foreach (var d in dic)
{
if (exceptTypes != null && exceptTypes.Contains(d.Key))
{
continue;
}
dicNew.Add(d.Key.GetHashCode(), d.Value);
}
return dicNew;
} } public class EnumTitleAttribute : Attribute
{
private bool _IsDisplay = true; public EnumTitleAttribute(string title, params string[] synonyms)
{
Title = title;
Synonyms = synonyms;
Order = int.MaxValue;
}
public bool IsDisplay { get { return _IsDisplay; } set { _IsDisplay = value; } }
public string Title { get; set; }
public string Description { get; set; }
public string Letter { get; set; }
/// <summary>
/// 近义词
/// </summary>
public string[] Synonyms { get; set; }
public int Category { get; set; }
public int Order { get; set; }
}
}

枚举数据代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; namespace SHH.Helpers
{
public class EnumData
{
/// <summary>
/// 性别
/// </summary>
public enum EnumSex
{
[EnumTitle("先生")]
Sir = , [EnumTitle("女士")]
Miss =
}
/// <summary>
/// 预约时间
/// </summary>
public enum EnumBespeakDate
{
[EnumTitle("工作日(周一到周五)")]
BespeakDate1 = , [EnumTitle("双休日")]
BespeakDate2 = , [EnumTitle("工作日或双休日")]
BespeakDate3 =
}
/// <summary>
/// 预约时段
/// </summary>
public enum EnumBespeakTime
{
[EnumTitle("上午")]
BespeakTime1 = , [EnumTitle("下午")]
BespeakTime2 = , [EnumTitle("晚上")]
BespeakDate3 = , [EnumTitle("随时")]
BespeakDate4=
} /// <summary>
/// 售价
/// </summary>
public enum EnumPriceGroup
{
[EnumTitle("不限", IsDisplay = false)]
None = , [EnumTitle("30万以下")]
Below30 = , [EnumTitle("30-50万")]
From30To50 = , [EnumTitle("50-80万")]
From50To80 = , [EnumTitle("80-100万")]
From80To100 = , [EnumTitle("100-150万")]
From100To50 = , [EnumTitle("150-200万")]
From150To200 = , [EnumTitle("200万以上")]
Above200 =
} /// <summary>
/// 面积
/// </summary>
public enum EnumAcreageGroup
{ [EnumTitle("不限", IsDisplay = false)]
None = , [EnumTitle("50mm以下")]
Below50 = , [EnumTitle("50-70mm")]
From50To70 = , [EnumTitle("70-90mm")]
From70To90 = , [EnumTitle("90-120mm")]
From90To120 = , [EnumTitle("120-150mm")]
From120To150 = , [EnumTitle("150-200mm")]
From150To200 = , [EnumTitle("200-300mm")]
From200To300 = , [EnumTitle("300mm以上")]
Above300 =
} /// <summary>
/// 房型 二室 三室 四室 五室 五室以上
/// </summary>
public enum EnumRoomGroup
{
[EnumTitle("不限", IsDisplay = false)]
None = , [EnumTitle("一室")]
Room1 = , [EnumTitle("二室")]
Room2 = , [EnumTitle("三室")]
Room3 = , [EnumTitle("四室")]
Room4 = , [EnumTitle("五室")]
Room5 = , [EnumTitle("五室以上")]
Above5 =
}
}
}

Controller代码[RadioBox]

            ViewData.Add("EnumPriceGroup", new SelectList(EnumHelper.GetItemValueList<EnumData.EnumPriceGroup>(), "Key", "Value"));
ViewData.Add("EnumAcreageGroup", new SelectList(EnumHelper.GetItemValueList<EnumData.EnumAcreageGroup>(), "Key", "Value"));
ViewData.Add("EnumRoomGroup", new SelectList(EnumHelper.GetItemValueList<EnumData.EnumRoomGroup>(), "Key", "Value"));

View代码[RadioBox]

@Html.RadioBoxList("EnumPriceGroup")
@Html.RadioBoxList("EnumAcreageGroup")
@Html.RadioBoxList("EnumRoomGroup")

Controller代码[CheckBox]

TagRepository tagrep = new TagRepository(); 
            var tag = tagrep.GetModelList().Where(d=>d.TypeID==);
ViewBag.Tags = new SelectList(tag, "TagID", "TagName");
var tag1 = tagrep.GetModelList().Where(d => d.TypeID == );
ViewBag.Tags1 = new SelectList(tag1, "TagID", "TagName");
var tag2 = tagrep.GetModelList().Where(d => d.TypeID == );
ViewBag.Tags2 = new SelectList(tag2, "TagID", "TagName");
 /// <summary>
/// 添加 GET: /admin/House/Add
/// </summary>
/// <param name="model">实体类</param>
/// <param name="fc"></param>
/// <returns></returns>
[Authorize, HttpPost, ValidateInput(false)]
public ActionResult Add(House model, FormCollection fc,int[] Tags, int[] Tags1,int[] Tags2)
{ model.State = ;
model.CreateTime = DateTime.Now;
HouseControllerrep.SaveOrEditModel(model); if (Tags.Length > )
{ foreach (int gsi in Tags){
TagHouseMapping thmtag = new TagHouseMapping();
thmtag.TagID=gsi;
thmtag.HouseID = model.HouseID;
thmtag.State = ;
thmtag.CreateTime = DateTime.Now;
TagCrep.SaveOrEditModel(thmtag);
}
}
if (Tags1.Length > )
{ foreach (int gsi in Tags1)
{
TagHouseMapping thmtag = new TagHouseMapping();
thmtag.TagID = gsi;
thmtag.HouseID = model.HouseID;
thmtag.State = ;
thmtag.CreateTime = DateTime.Now;
TagCrep.SaveOrEditModel(thmtag);
}
}
if (Tags2.Length > )
{ foreach (int gsi in Tags2)
{
TagHouseMapping thmtag = new TagHouseMapping();
thmtag.TagID = gsi;
thmtag.HouseID = model.HouseID;
thmtag.State = ;
thmtag.CreateTime = DateTime.Now;
TagCrep.SaveOrEditModel(thmtag);
}
}
return RedirectToAction("Index");
}
#endregion

View代码[CheckBox]

 @Html.CheckBoxList("Tags")
@Html.CheckBoxList("Tags1")
@Html.CheckBoxList("Tags2")

CheckBoxList效果

RadioBoxList效果

声明:本博客高度重视知识产权保护,发现本博客发布的信息包含有侵犯其著作权的链接内容时,请联系我,我将第一时间做相应处理,联系邮箱ffgign@qq.com

作者:Mark Fan (小念头)    来源:http://cube.cnblogs.com
说明:未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。如有疑问,可以通过 ffgign@qq.com 联系作者,本文章采用 知识共享署名-非商业性使用-相同方式共享 2.5 中国大陆许可协议进行许可

主攻ASP.NET MVC4.0之重生:CheckBoxListHelper和RadioBoxListHelper的使用的更多相关文章

  1. 主攻ASP.NET MVC4.0之重生:ASP.NET MVC使用JSONP

    原文:主攻ASP.NET MVC4.0之重生:ASP.NET MVC使用JSONP 原文地址 http://www.codeguru.com/csharp/.net/net_asp/using-jso ...

  2. 主攻ASP.NET MVC4.0之重生:Asp.Net MVC WebApi OData

    1.新建MVC项目,安装OData Install-Package Microsoft.AspNet.WebApi.OData -Version 4.0.0 2.新建WebAPI Controller ...

  3. 主攻ASP.NET MVC4.0之重生:ASP.NET MVC Web API

    UserController代码: using GignSoft.Models; using System; using System.Collections.Generic; using Syste ...

  4. 主攻ASP.NET MVC4.0之重生:Jquery Mobile 列表

    代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title ...

  5. 主攻ASP.NET MVC4.0之重生:Jquery Mobile 表单元素

    相关代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <tit ...

  6. 主攻ASP.NET MVC4.0之重生:Jquery Mobile 按钮+对话框使用

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  7. 主攻ASP.NET MVC4.0之重生:MVC Controller修改Controller.tt模版,自动添加版本注释信息

    第一步找到MVC 4.0 CodeTemplates 一般路径在:C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Ite ...

  8. 主攻ASP.NET MVC4.0之重生:上下滑动屏幕动态加载数据

                @{ ViewBag.Title = "Index"; } <!DOCTYPE html> <html> <head> ...

  9. 主攻ASP.NET MVC4.0之重生:使用反射获取Controller的ActionResult

    示例代码 public ActionResult TypeOfForName() { Type typeinfo = typeof(CustomerClassController); //typeof ...

随机推荐

  1. struts.xml文件:

    struts.xml文件中包含的配置信息,你将修改所采取的措施的开发.这个文件可以被用来覆盖默认设置的应用程序,例如struts.devMode=false和其他设置中定义的属性文件.这个文件可以创建 ...

  2. JSP接口浅析

    一.tree型关系 JSP页面继承了org.apache.jasper.runtime.HttpJspBase抽象类并实现了org.apache.jasper.runtime.JspSourceDep ...

  3. java算法学习

    最大公约数 欧几里得算法 描述:计算两个非负整数p和q的最大公约数: 若q是0,则最大公约数为p. 否则,将p除以q得到余数r,p和q的最大公约数即为q和r的最大公约数. 根据算法的自然描述,我们可以 ...

  4. Android-ViewPagerIndicator框架使用——IconPageIndicator

    前言:IconPageIndicator是将自定义的图片作为指示图标的,这里的图片使用xml实现的. 1.自己定义图片: <?xml version="1.0" encodi ...

  5. 红外图像盲元补偿matlab实现源码与效果验证

    在国内红外公司绝大多数一直以来国外进口的成像芯片,能够进行红外芯片自助开发的电学应该只有大立光电和广微积电光学方法只有上海巨哥和一直未能产 品化的昆山光微电子.由于政治和历史原因,欧美对中国大陆还是实 ...

  6. Android WebView-应用内嵌入浏览器

    移动应用开发,web app.Native app的讨论已经很久了,纯粹的web app还很少,多少能见到Native + web混合的app,混合的app是在Native app中写一个浏览器加载 ...

  7. HTML学习笔记——标准网页设计+使用CSS、Javascript

    一.标准网页设计 1.标准网页概述: 标准网页设计要遵循,内容与表现相分离.   内容 + 表现 = 页面  ---  即 :XHTML + CSS = PAGE 内容与变现相分离,也就是内容使用HT ...

  8. 动软生成的WCP DAO层模板(不使用接口)

    本实战是博主初次学习Java,分析WCP源码时,学习HibernateTools部分的实战,由于初次接触,难免错误,仅供参考,希望批评指正. 开发环境: Eclipse Version: Photon ...

  9. hihocoder 1279(状压)

    坑爹的题目.不过不能说不是一道挺好的题目. 坑主要坑在,妹的我一样的复杂度,写的姿势略差了点然后就一直超时. 比赛的时候我还直接就看错题目,把AND运算看成了OR...还敲完交了一发. 这题很容易想到 ...

  10. JavaScript Observer Pattern

    var Users = { list: [], listeners: {}, add: function(name) { this.list.push({name: name}); this.disp ...