Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

35 рядки
1.2KB

  1. <%
  2. Class Dispatcher
  3. ' Given a Router.Match(...) result (or Nothing), resolves the controller
  4. ' key - falling back to "NotFound" when nothing matched, or when the
  5. ' matched key doesn't map to a known controller - then constructs, Inits,
  6. ' and Executes the corresponding controller. controllerKey and controller
  7. ' are ByRef outputs: Select Case controllerKey after calling this to pick
  8. ' the matching view (its filename must equal the resolved key).
  9. Public Sub Dispatch(ByRef app, ByRef routeMatch, ByRef controllerKey, ByRef controller)
  10. Dim routeParams
  11. If routeMatch Is Nothing Then
  12. controllerKey = "NotFound"
  13. Set routeParams = Nothing
  14. Else
  15. controllerKey = routeMatch.Item("ControllerName")
  16. Set routeParams = routeMatch.Item("Params")
  17. End If
  18. Select Case controllerKey
  19. Case "Home"
  20. Set controller = New HomeController
  21. Case "Greet"
  22. Set controller = New GreetController
  23. Case Else
  24. controllerKey = "NotFound"
  25. Set controller = New NotFoundController
  26. End Select
  27. controller.Init app, routeParams
  28. controller.Execute
  29. End Sub
  30. End Class
  31. %>

Powered by TurnKey Linux.