Results 1 to 7 of 7

Thread: Adding own controller and views

  1. #1
    Join Date
    Aug 2009
    Posts
    16

    Default 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. #2
    Join Date
    Aug 2009
    Posts
    16

    Default

    found the solution. Thank you.

  3. #3
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    The 'controller class' command provides a good starting point when developing custom views. I guess you have seen that command?
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  4. #4
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Quote 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.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  5. #5
    Join Date
    Aug 2009
    Posts
    16

    Default

    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. #6
    Join Date
    Aug 2009
    Posts
    16

    Default

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

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •