我试图配置我的AngularJs的第一个花絮是一个微不足道的东西,但不幸的是,经过相当长的时间后,它没有成功.
我的前提:
用户从下拉列表中选择一个选项,并将相应的模板加载到选择下方的div中.我已经设置了服务,一个自定义指令(通过@Josh David Miller在这篇文章中关注ans ,以及一个控制器到位.服务中的ajax调用工作正常,除了我传递给服务器的params是硬编码的我希望这是用户选择的下拉列表中的"密钥".目前我没有将此代码传递给服务.
我的配置:
var firstModule = angular.module('myNgApp', []);
// service that will request a server for a template
firstModule.factory( 'katTplLoadingService', function ($http) {
return function() {
$http.get("${createLink(controller:'kats', action:'loadBreedInfo')}", {params:{'b1'}}
).success(function(template, status, headers, config){
return template
})
};
});
firstModule.controller('KatController', function($scope, katTplLoadingService) {
$scope.breed = {code:''}
// here I am unsuccessfully trying to set the user selected code to a var in service,
//var objService = new katTplLoadingService();
//objService.breedCode({code: $scope.breed.code});
$scope.loadBreedData = function(){
$scope.template = …Run Code Online (Sandbox Code Playgroud) 在我的 grails 应用程序中,unicode 字符没有正确编码。
我正在使用 grails 1.3.7 和 tomcat 7.0.22。以下是我在我的应用程序中为 unicode 支持配置的设置:
- Set grails.views.gsp.encoding and grails.converters.encoding="UTF-8" in Config.groovy
- Set encoding to UTF-8 in meta tag in the .gsp pages
- Specified 'useUnicode=true&characterEncoding=UTF-8' to the MySql connection URL (DB has characterset set to UTF-8)
- Set URIEncoding="UTF-8" useBodyEncodingForURI="true" to the server.xml file in tomcat
- Specified the attribute accept-charset="UTF-8" of the form tag.
Run Code Online (Sandbox Code Playgroud)
但是,当我提交一个 unicode 字符时,grails 不支持该字符并且正在保存乱码值。我已经用谷歌搜索并阅读了 ppl 在同一问题上寻求帮助,但不幸的是,这些解决方案对我不利。尽管如此,我已经找到了解决此问题的方法。下面的表达式
params.detail = params.detail ? new String(params.detail.getBytes("8859_1"), "UTF8") : null
Run Code Online (Sandbox Code Playgroud)
将正确编码 …
我正在构建一个 Quartz cron 表达式来安排一个作业从今天起每两年在特定的一天运行。我已经测试了很多,但我认为以下之一应该可以完成工作:
53 18 23 12 ? 2013/2 => starting on year 2013 and on every two years later on
53 18 23 12 ? */2
Run Code Online (Sandbox Code Playgroud)
但是他们都没有通过 Quartz cron 表达式验证测试。什么是正确的 cron 表达式?