Announcement Announcement Module
Collapse
No announcement yet.
dynamic tiles2 definitions with spring 3 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic tiles2 definitions with spring 3

    Hi all,
    Am doing some work in Spring 3, together with tiles2. I am using the MVC, and am kind of stuck. I have a method in a controller, defined as :

    @RequestMapping("/content/stories/view/{storyid}")
    public ModelAndView editStoryPage(HttpServletRequest request, @PathVariable("storyid") int storyid) {
    ...
    }


    In my tiles xml definition, how do i dynamically map the {storyid} to a definition: the following is not working

    <definition name="content/stories/**" extends="classic.definition">
    <put-attribute name="title" value="View story" />
    <put-attribute name="body" value="/WEB-INF/jsp/content/stories/viewstory.jsp" />
    </definition>

    So in short, if execute something like:
    localhost/content/stories/1
    localhost/content/stories/2
    localhost/content/stories/3

    all these should map to the definition in tiles.xml.
    hope this explains my dilema.

    Thanks a mill.

  • #2
    Originally posted by davidwaf View Post
    Hi all,
    Am doing some work in Spring 3, together with tiles2. I am using the MVC, and am kind of stuck. I have a method in a controller, defined as :

    @RequestMapping("/content/stories/view/{storyid}")
    public ModelAndView editStoryPage(HttpServletRequest request, @PathVariable("storyid") int storyid) {
    ...
    }


    In my tiles xml definition, how do i dynamically map the {storyid} to a definition: the following is not working

    <definition name="content/stories/**" extends="classic.definition">
    <put-attribute name="title" value="View story" />
    <put-attribute name="body" value="/WEB-INF/jsp/content/stories/viewstory.jsp" />
    </definition>

    So in short, if execute something like:
    localhost/content/stories/1
    localhost/content/stories/2
    localhost/content/stories/3

    all these should map to the definition in tiles.xml.
    hope this explains my dilema.

    Thanks a mill.
    I don't follow your question neither whether it is a valid view name definition in Tiles. You can definite your view as content/stories/1, content/stories/2 and so on and return the different views based on the path variable. BTW what is the point to have various views while its components always are the same?

    Comment


    • #3
      @davidwaf, you should be returning a String instead of a ModelAndView and make sure you have the Tiles2 View Resolver.

      Here's a tutorial I've setup using Tiles 2:

      http://krams915.blogspot.com/2010/12...tegration.html

      Comment


      • #4
        dynamic tiles2 definitions with spring 3'

        Thanks @skram. It turns out the problem was somewhere else..anyway, @wv729, basically i had wanted to dynamically generate tiles definitions:

        localhost/content/stories/1
        localhost/content/stories/2
        ...
        localhost/content/stories/n,

        but decided to do it differently, with just once definition and handing parameters from controller.

        Comment


        • #5
          davidwaf, I am trying to achieve the same what was your solution?

          Thanks

          Comment

          Working...
          X