Announcement Announcement Module
Collapse
No announcement yet.
Adding own controller and views Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding own controller and views

    I have created an entity person with the fields longitude and latitude and would like to display the instances on google maps. What is the recommended way to create controllers and views manually and access entities?

  • #2
    found the solution. Thank you.

    Comment


    • #3
      The 'controller class' command provides a good starting point when developing custom views. I guess you have seen that command?

      Comment


      • #4
        Originally posted by revolred View Post
        found the solution. Thank you.
        It'd be great if you could share the technique you used, to help others. I am sure many people would like to do this. I saw an app yesterday with latitude and longitude features and it's increasingly common.

        Comment


        • #5
          Ben: Since I wanted to access all instances of my entity used

          controller scaffold --class ~.view.MyController --entity ~.domain.Person --path mypath --disallowOperations create,update,delete

          to create a new controller. I then changed the template under views/mypath/list.jspx.

          Regarding the map functionality I simply followed the examples given by google.

          Comment


          • #6
            Ben: I need to return a list of all instances of my entity person in a format other than xhtml. Is there a way I can reuse the list.jspx file but to define what content type is returned?

            Comment


            • #7
              You can try Spring ContentNegotiation to return diferent formats of the same data, it works like a charm.

              But i donīt understand how you intend to use reuse a JSPX page (wich is a view, not content returned by any controller) to show anything but (X)HTML

              Maybe you want for example that with the same java code the url http://myapp/person.pdf returns a pdf file with the same list of persons that you can see in persons.jspx?? if so take a look at Content negotiation, itīs very easy.

              HTH

              Comment

              Working...
              X