您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

49 行
1.2KB

  1. <%
  2. Class GreetController
  3. Private m_App
  4. Private m_Name
  5. Private m_Id
  6. Public Sub Init(ByRef app, ByRef routeParams)
  7. Set m_App = app
  8. ' IsObject(Nothing) is True in VBScript, so it can't detect "no object"
  9. ' on its own - it must be paired with an explicit "Is Nothing" check.
  10. If Not (routeParams Is Nothing) Then
  11. If routeParams.Exists("name") Then
  12. m_Name = Trim(CStr(routeParams.Item("name")))
  13. End If
  14. If routeParams.Exists("id") Then
  15. m_Id = Trim(CStr(routeParams.Item("id")))
  16. End If
  17. End If
  18. If Len(m_Name) = 0 Then
  19. m_Name = "there"
  20. End If
  21. End Sub
  22. Public Sub Execute()
  23. ' Nothing further to prepare - the name/id are already resolved in Init.
  24. End Sub
  25. Public Property Get App()
  26. Set App = m_App
  27. End Property
  28. Public Property Get Name()
  29. Name = m_Name
  30. End Property
  31. Public Property Get Id()
  32. Id = m_Id
  33. End Property
  34. ' True only when the route matched /greet/{name}/{id} - the shorter
  35. ' /greet/{name} pattern never captures an "id".
  36. Public Property Get HasId()
  37. HasId = (Len(m_Id) > 0)
  38. End Property
  39. End Class
  40. %>

Powered by TurnKey Linux.