Announcement Announcement Module
No announcement yet.
Adding own controller and views Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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.


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


      • #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.


        • #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.


          • #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?


            • #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.