Announcement Announcement Module
Collapse
No announcement yet.
How to change the base-url of all scaffolded views? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to change the base-url of all scaffolded views?

    I want to use the scaffolded views as my admin interface and therefore point all of them to /admin/ instead of / .

    How can I do this?

  • #2
    The "web mvc scaffold" command that creates the controller and views for a single entity has an optional "path" argument that lets you specify the base URL for that entity (defaults to e.g. "person" for the Person entity). So you could set this to "admin/foo" when scaffolding the UI for the Foo entity.

    The "web mvc all" command that creates the controller and views for the whole application at once has no such option, as it's intended for a simpler use case.

    If you have existing controllers and views and want to rebase your application's URLs, I'm afraid you'll have to update them all manually.

    Comment


    • #3
      Thanks Andrew,

      I'll create a new entity, do web mvc scaffold with path to it to see where I need to change my existing classes.

      How do I change the directory of the index-page to /admin/ as well?

      Comment


      • #4
        Originally posted by Alimdoener View Post
        How do I change the directory of the index-page to /admin/ as well?
        In your webmvc-config.xml, add this element alongside the others of this type (or edit the existing one that points to this view name):
        Code:
        <mvc:view-controller path="/admin" view-name="index"/>

        Comment


        • #5
          Thanks, it worked perfectly.

          Comment

          Working...
          X