小编mmu*_*rch的帖子

Nustache视图引擎ArrayTypeMismatchException

尝试使用Nustache来共享客户端和服务器胡子模板,但Nustache只是不能很好地使用我的应用程序.我在源代码中直接使用了他们的MVC应用程序示例中的代码,但每次尝试设置或添加视图引擎时都会出错.这是一个代码片段(来自一个动作方法,我也试过在global.asax中全局添加视图引擎并且有相同的错误):

ViewResult viewResult = View(new { test = "Jawesome" });

viewResult.ViewEngineCollection = new ViewEngineCollection
                                  {
                                      new NustacheViewEngine()
                                  };
Run Code Online (Sandbox Code Playgroud)

这是错误:

[ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.]
   System.Collections.Generic.List`1.Insert(Int32 index, T item) +62
   MyController.Index() in C:\src\projects\myproject\myproject.Web\Controllers\MyController.cs:83
   lambda_method(Closure , ControllerBase , Object[] ) +79
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
   ...
Run Code Online (Sandbox Code Playgroud)

.net c# viewengine mustache asp.net-mvc-3

5
推荐指数
1
解决办法
1060
查看次数

Wicket TextField具有默认值

在wicket中创建TextField的优雅方法是什么,除了使用SimpleAttributeModifier手动设置组件的"value"属性之外,还使用默认值进行渲染?

例如,这有效:

TextField<String> headline = new TextField<String>("headline", new PropertyModel(backingObject, "headline"));
headline.add(new SimpleAttributeModifier("value", "default value"));
add(headline);
Run Code Online (Sandbox Code Playgroud)

但有更好的方法吗?

java wicket

1
推荐指数
1
解决办法
8915
查看次数

标签 统计

.net ×1

asp.net-mvc-3 ×1

c# ×1

java ×1

mustache ×1

viewengine ×1

wicket ×1