You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

XPages自动登出时如何在$$LoginUserForm中设置ReasonType字段

XPages登录超时后设置登录表单字段的方法
  • 可以通过URL参数的方式传递值给$$LoginUserForm的reasontype字段,只需调整重定向URL即可。
  • 修改后的代码示例:
    URL + "?Logout&redirectto=" + encodeURIComponent(Url + "?opendatabase&login&reasontype=3");
    
    注意必须用encodeURIComponent对redirectto的目标URL进行编码,防止URL参数解析混乱。
  • 在$$LoginUserForm对应的页面中添加参数读取逻辑:
    • 若使用XPage:在页面的beforePageLoad事件中加入以下代码,读取URL参数并赋值给字段:
      var reasontype = context.getParameter("reasontype");
      if (reasontype === "3") {
          getComponent("reasontypeField").setValue("3");
      }
      
    • 若使用传统Notes表单:在表单的WebQueryOpen代理或计算字段中读取URL参数并赋值:
      Dim session As New NotesSession
      Dim doc As NotesDocument
      Set doc = session.DocumentContext
      Dim reasontype As String
      Dim paramPos As Integer
      paramPos = InStr(doc.Query_String(0), "reasontype=")
      If paramPos > 0 Then
          reasontype = Mid(doc.Query_String(0), paramPos + 11)
          ' 处理可能存在的后续参数
          paramPos = InStr(reasontype, "&")
          If paramPos > 0 Then
              reasontype = Left(reasontype, paramPos - 1)
          End If
          doc.reasontype = reasontype
      End If
      
  • 确认登录表单的字段配置允许接收外部传入的值,避免参数被表单逻辑覆盖。

内容的提问来源于stack exchange,提问作者theBastian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 02:57:42