我正在使用jquery ui对话框实现便签.在一个按钮上单击一个大的全屏ui对话框打开,在该大对话框内是一个添加小对话框(注释)的按钮.
HTML:
<body>
<button id="opener">open the dialog</button>
<div id="outter-dialog" title="Notes">
<button id = "add-note">Add Note</button>
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
$( "#outter-dialog" ).dialog({
autoOpen: false,
title: "Success Message",
width: $(window).width(),
height: $(window).height(),
modal: false,
buttons: {
Cancel: function() {
$(this).dialog('close');
}
}
});
$("#opener").click(function(){
$( "#outter-dialog" ).dialog('open');
});
var prevelement;
$("#add-note").click(function () {
var dynamicDialog = $('<div id="MyDialog"> <textarea>Hello</textarea> </div>');
var pos;
if (prevelement) {
pos = {
my: "left",
at: "bottom",
of: prevelement
}
}
dynamicDialog.dialog({
title: "Note",
modal: false, …Run Code Online (Sandbox Code Playgroud) 我有一个CustomSerializer用于编写特定字段.我呼吁的自定义序列化ObjectMapper与像某些配置WRAP_ROOT_VALUE,PropertyNameStrategy,Inclusion.NON_NULL.
现在在我的自定义序列化程序中,除了one(WRAP_ROOT_VALUE)之外,我在序列化自定义类时需要所有这些属性.
public class CustomSerializer extends JsonSerializer<Object>{
@Override
public void serialize(Object obj, JsonGenerator jgen,
SerializerProvider arg2) throws IOException,
JsonProcessingException {
//.......
jgen.writeObject(obj);
//...
}
Run Code Online (Sandbox Code Playgroud)
所以我的obj这里被序列化了root值包装,我不想要.
我出于某种原因无法编辑我的POJO.
如何禁用ObjectmapperCustomSerializer中的单个(或某些)属性???
在这段代码中,我使用ActionContext从Request对象获取Session和ServletActionContext.我觉得这是不好的做法,因为必须只对Request对象使用ActionContext.
ActionContext的Request对象是否等同于Servlets中的Request对象?如果是,如何使用它获取请求参数?
Map session = (Map) ActionContext.getContext().getSession();
HttpServletRequest request = ServletActionContext.getRequest();
String operatorId = request.getParameter("operatorId");
session.put("OperatorId", operatorId);
// getting hashmap from Bean
analysisNames= slsLoginDetailsRemote.getAnalysisNamesIdMap();
// sending map for multiselect
session.put("AnalysisNames",analysisNames);
Run Code Online (Sandbox Code Playgroud) 我正在使用validate()我的Action类中的方法进行struts2验证.我使用addFieldError()方法添加FieldErrors .字段错误显示在表单的每个字段的顶部.
Action类:(这验证了setMapServerDetails动作)
/*---------------------VALIDATION------------------------------------*/
public void validateSetMapServerDetails(){
if(getMapServer().getServerName().length() == 0){
addFieldError("mapServer.serverName", "Name is Required");
}
}
Run Code Online (Sandbox Code Playgroud)
问题是错误以纯文本显示,我希望错误为红色.
我应该如何将其更改为红色?
编辑: JSP:
<title>Configure Map Server</title>
<s:head />
</head>
<body>
<s:form action="setMapServerDetails" validate="true">
<s:textfield name="mapServer.serverName" label="Server Name"></s:textfield>
<s:textfield name="mapServer.serverIp" label="Server IP"></s:textfield>
<s:textfield name="mapServer.serverPort" label="Server Port"></s:textfield>
<s:textfield name="mapServer.applicationName" label="Application Name"></s:textfield>
<s:textfield name="mapServer.remarks" label="Remarks"></s:textfield>
<s:submit value="Save"></s:submit>
</s:form>
Run Code Online (Sandbox Code Playgroud) 我使用此配置读取了我的日志文件(cron_log,auth_log,mail_log等):
file{
path => '/path/to/log/file/*_log'
}
Run Code Online (Sandbox Code Playgroud)
所以我读了我的日志文件并检查:
if(path) ~= "cron" -----match--------
if(path) ~= "auth" -----match--------
Run Code Online (Sandbox Code Playgroud)
现在我有一个目录,如:Server1 Server2 Server3......在Server 1子目录中:authlog cronlog.....在authlog内部有子目录日期明智(如2014.05.26, 2014.05.27)最终包含当天的日志文件,我必须解析.
所以目前我有一个用于读取文件的配置文件, *_log 我用它来运行该配置文件并/path/to/log/file/*_log解析了所有存在的日志文件.
现在我必须从许多目录中读取(如上所述).
我是否必须为每个目录编写单独的配置文件?
使用logstash实现这一目标的最佳方法是什么?
我想从各种目录中读取我的日志文件,例如:Server1, Server2...
Server1有子目录为cron, auth......这些子目录中log file分别是.
所以我正在考虑阅读这样的文件:
input{
file{
#path/to/folders/server1/cronLog/cron_log
path => "path/to/folders/**/*_log"
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我很难过滤它们,即要知道哪个server(Server1)和logtype(cron),我必须应用grok模式:
例如:我想做这样的事情
if [path] =~ "auth"{
grok{
match => ["message", ***patteren****]
}
}else if [path] =~ "cron"{
grok{
match => ["message", ***pattern***]
}
Run Code Online (Sandbox Code Playgroud)
以上cron是日志文件(不是cronLog目录).但是,这样的我也想过滤的server name,因为每个服务器都会有cron,auth等日志.
如何过滤两者?
有没有办法从path输入中获取目录名?喜欢这里
path => "path/to/folders/**/*_log"
Run Code Online (Sandbox Code Playgroud)
我该怎么办?任何帮助表示赞赏?