小编JOT*_*OTN的帖子

提交后发生验证错误时,保持p:对话框打开

最小示例对话框:

<p:dialog header="Test Dialog"  
          widgetVar="testDialog"> 
  <h:form> 
    <p:inputText value="#{mbean.someValue}"/> 

    <p:commandButton value="Save" 
                     onsuccess="testDialog.hide()" 
                     actionListener="#{mbean.saveMethod}"/> 
  </h:form>       
</p:dialog> 
Run Code Online (Sandbox Code Playgroud)

我想要做的是让mbean.saveMethod以某种方式阻止对话框关闭,如果有问题并且只通过growl输出消息.这是验证器无法帮助的情况,因为在将保存提交给后端服务器之前无法判断someValue是否有效.目前我使用visible属性执行此操作,并将其指向mbean中的布尔字段.这有效,但它使用户界面变慢,因为弹出或关闭对话框需要命中服务器.

validation ajax jsf dialog primefaces

64
推荐指数
4
解决办法
7万
查看次数

Azure 通知中心注册 WNS 的原始模板

我有一个从 WNS 接收通知的 C#/UWP 应用程序,我可以使用 Azure 通知中心测试页向其发送原始通知。唯一的问题是我无法向集线器注册设备以在发送模板通知时接收原始通知。这是基本代码:

PushNotificationChannel channel = await PushNotificationChannelManager.
  CreatePushNotificationChannelForApplicationAsync();
NotificationHub hub = new NotificationHub(NotificationSettings.HubName,
  NotificationSettings.HubListenConnectionString);
TemplateRegistration registration = await hub.
  RegisterTemplateAsync(channel.Uri, template, "data", tags);
Run Code Online (Sandbox Code Playgroud)

我想要弄清楚的是我需要什么模板值才能让它将数据作为原始数据传递。这是我在注册时遇到的错误:

The bodyTemplate is not in accepted XML format. The first node of the bodyTemplate should be Badge/Tile/Toast, except wns/raw template, which need to be an valid XML
Run Code Online (Sandbox Code Playgroud)

通过该消息,显然有一个“wns/raw template”选项,但我找不到有关如何注册选项的文档。如果重要的话,原始数据的实际格式是 JSON。

Dave Smits 的帮助中修复了代码:

PushNotificationChannel channel = await PushNotificationChannelManager.
  CreatePushNotificationChannelForApplicationAsync();
NotificationHub hub = new NotificationHub(NotificationSettings.HubName,
  NotificationSettings.HubListenConnectionString);
WnsHeaderCollection wnsHeaderCollection = new WnsHeaderCollection();
wnsHeaderCollection.Add("X-WNS-Type", …
Run Code Online (Sandbox Code Playgroud)

c# azure-notificationhub wns uwp

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

标签 统计

ajax ×1

azure-notificationhub ×1

c# ×1

dialog ×1

jsf ×1

primefaces ×1

uwp ×1

validation ×1

wns ×1