问题列表 - 第15097页

将简单地图注入Grails控制器

我正在尝试将Map注入Grails控制器.我想将相同的地图注入许多控制器,所以想在resources.groovy中定义它.

我在网上看了但是找不到创建简单地图的例子.

在Spring MVC中,我使用过这样的东西:

<util:map id="diplomaPermissions">
   <entry>
      <key>1</key>
      <value>Diploma_AQA_Building_And_Construction</value>
   </entry>
   <entry>
      <key>1</key>
      <value>Diploma_Edexcel_Building_And_Construction</value>
   </entry>
</util:map>
Run Code Online (Sandbox Code Playgroud)

在我的xml标题中:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:p="http://www.springframework.org/schema/p" 
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/util 
        http://www.springframework.org/schema/util/spring-util-2.5.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-2.5.xsd">
Run Code Online (Sandbox Code Playgroud)

但是,如果我使用spring xml文件,这似乎不适用于grails.

任何提示赞赏.

grails config

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

如何索引数字字段并在Lucene.Net中按范围搜索?

我正在寻找一种在Lucene.Net中索引和搜索数字字段的有效方法.现在我的需要只是整数值.

我想按值的范围搜索(在x和y之间,大于x ...).现在我正在按原样索引数字,并为这两个值之间的每个值手动创建子句,但是当我搜索1000和1000之间的值时,它会快速生成大量子句并达到默认限制(1024).例如5000.我相信有更好的方法可以做到这一点......

.net lucene.net numeric-ranges

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

https是否保留在相对表单操作URL上?

考虑一个页面,其中包含通过https访问的表单.如果表单操作具有表单页面的相对URL,则保留https协议吗?

例如:你访问:

https://example.com/cart.html
Run Code Online (Sandbox Code Playgroud)

其中包含表单标记:

<form name="form1" method="post" action="SubmitOrder.aspx" id="form1">
Run Code Online (Sandbox Code Playgroud)

表单是通过https还是http提交的?

html forms url ssl

5
推荐指数
2
解决办法
2527
查看次数

如何使用JSON重新构建Javascript对象?

我有一个像这样的对象:

var someObj = Class.create ({
  initialize: function(objName){
      this.objName = objName;
  }
});
Run Code Online (Sandbox Code Playgroud)

我可以用

o = new someObj("objName");
Run Code Online (Sandbox Code Playgroud)

做一个obj.我可以使用Object.toJSON(o)将o更改为JSON字符串,但我希望JSON字符串转换回someObj,因此,我使用eval()将JSON字符串传递给对象,但问题是是,它可以成为一个JS Obj,但"o"的构造函数不是someObj.如何使用"someObj"作为构造函数来评估JSON字符串?

javascript json

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

包含List <T>的()方法

正是这一个类方法分别负责List<T>Contains()操作?

我班上超载了== 但似乎没有效果.

c# contains generic-list

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

CollectionOfElements上的java.util.ConcurrentModificationException

当我在Embedabble中有一个CollectionOfElements时,我似乎得到了一个ConcurrentModificationException.

如果想拥有它,那么如果我将Route从Embedabble更改为Entity,那么一切正常.我甚至尝试过添加@Version,但这似乎不起作用.

这是我的课程片段.Kart.java:

@Entity
public class Kart {

@Id @GeneratedValue
private Long id;

@Column(nullable=false,length=256)
@NotNull
@Length(max=256)
private String name;

@OneToOne(cascade=CascadeType.ALL)
private File file;

@Version
private int version;

@CollectionOfElements
private Set<Route> route;
Run Code Online (Sandbox Code Playgroud)

Route.java:

@Embeddable
public class Route {

@Parent
private Kart kart;

@NotNull
@Column(nullable = false, length = 256)
private String name;

@NotNull
@Column(nullable = false)
private Boolean visible = Boolean.valueOf(true);

@CollectionOfElements
private Set<Coordinates> coordinates;

@Version
private int version;
Run Code Online (Sandbox Code Playgroud)

Coordinates.java:

@Embeddable
public class Coordinates {

@NotNull
private int x;

@NotNull
private …
Run Code Online (Sandbox Code Playgroud)

java concurrency hibernate jpa

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

保护.net程序集

我想通过将它绑定到特定环境来保护我的程序集(dll).假设我有一个dll(BizLogic.dll),我想让我的共同开发者可以在组织内使用它.但我不希望别人在我的组织外使用它.

有没有办法解决这个问题?

提前致谢.

- 穆罕默德

c# asp.net security assemblies

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

链接器错误:LNK2022

我试图在具有公共语言运行时支持的项目中使用boost线程.我收到以下链接器错误.错误LNK2022:元数据操作失败(8013119F):存在TypeRef,它应该但不具有相应的TypeDef :(虚拟):( 0x01000073).

如果我评论实例化boost线程的行,我不会得到任何链接器错误.

我尝试在线查找修复此错误,在一个这样的地方建议在包含任何boost库之前使用"#define BOOST_THREAD_USE_DLL".我试过这个,但它仍然给我同样的错误.

有一个相关的线程,("LNK2022:元数据操作失败"让我疯狂)但它不是同样的问题,但有点类似.我尝试了修复建议,但仍然没有运气.

有谁知道如何解决这一问题?

c++ visual-c++ lnk2022

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

`void func()throw(type)`有什么意义?

我知道这是一个有效的c ++程序.函数声明中抛出的重点是什么?AFAIK它什么都不做,不用于任何东西.

#include <exception>
void func() throw(std::exception) { }
int main() { return 0; }
Run Code Online (Sandbox Code Playgroud)

c++ standards throw

3
推荐指数
2
解决办法
788
查看次数

使用Output参数执行存储过程?

我有一个我试图测试的存储过程.我试图通过SQL Management Studio测试它.为了运行这个测试,我输入...

exec my_stored_procedure 'param1Value', 'param2Value'
Run Code Online (Sandbox Code Playgroud)

最后一个参数是output parameter.但是,我不知道如何使用输出参数测试存储过程.

如何使用输出参数运行存储过程?

sql-server stored-procedures

185
推荐指数
10
解决办法
69万
查看次数