pdurbin / addressbookmvc

http://todomvc.com but for the back end
4 stars 5 forks source link

Ozark (MVC 1.0) example #16

Open pdurbin opened 9 years ago

pdurbin commented 9 years ago

In 8c2678d I stubbed out an example using Ozark (MVC 1.0): https://ozark.java.net

I'm not done, however. The biggest problem I'm having is that I'm not sure how to populate the home page with the list contacts (people in the address book).

I'm able to list all contacts by hitting a URL under "resources" such as http://localhost:8080/ozarkaddressbook-1.0-SNAPSHOT/resources/contacts (which is handled by https://github.com/pdurbin/addressbookmvc/blob/8c2678de54e23cdd32b914967ce3e8930495f272/examples/ozark/src/main/java/com/greptilian/addressbookmvc/ozark/PeopleController.java ) but it's not clear to me how I would list the contacts at the home page at http://localhost:8080/ozarkaddressbook-1.0-SNAPSHOT/ (which is https://github.com/pdurbin/addressbookmvc/blob/8c2678de54e23cdd32b914967ce3e8930495f272/examples/ozark/src/main/webapp/index.html ).

pdurbin commented 9 years ago

@turini do you have a moment to look at this? I'm using Mustache and I'm trying to put a list of people/contacts on the home page, sort of like how I use a dataTable in the JSF version: https://github.com/pdurbin/addressbookmvc/blob/master/examples/javaee7/src/main/webapp/index.xhtml

I might switch to JSP and try a jsp:include from the home page to the controller.

I hear that I may be able to set the context-root to my controller in the future.

Turini commented 9 years ago

hi @pdurbin, i'll take o look on it tonight, ok? cheers

Turini commented 9 years ago

@pdurbin i did clone your app and it's looking to work correctly here.

image

Or maybe I didn't get the problem. What exactly isn't working in this code? kind regards

Turini commented 9 years ago

BTW it's a great idea, nice to know this project. I'd love to see VRaptor 4 as an option here too, it's an amazing MVC framework. http://www.vraptor.org/

pdurbin commented 9 years ago

@Turini thanks for taking a look! (And for pointing out VRaptor.)

It's working for you at http://localhost:8080/ozarkaddressbook/resources/contacts (the controller) but can you get the same output at http://localhost:8080/ozarkaddressbook (the home page) ? How would I do this? That's really the question.

Turini commented 9 years ago

oh, now I see @pdurbin. Take o look on https://java.net/jira/browse/MVC_SPEC-32 It has been solved, and will be available soon (in 1.0-edr2). Let me know if you need any help integrating MVC and VRaptor here. Cheers

pdurbin commented 9 years ago

@Turini ok, you seem to be saying that in the future I should try an ApplicationPath of "/" instead of "resources" like I'm doing at https://github.com/pdurbin/addressbookmvc/blob/master/examples/ozark/src/main/java/com/greptilian/addressbookmvc/ozark/MyApplication.java

I'll keep an eye out for the next release of Ozark. Thanks!

Turini commented 9 years ago

Yes, exactly @pdurbin! I'll look just like this:

@ApplicationPath("/")
public class MyApplication extends Application {
    //...
}

that was my pleasure. Kind regards

pdurbin commented 9 years ago

@Turini cool. I tried it with 1.0.0-m01 but it didn't work, as expected. I tried building https://github.com/spericas/ozark but it didn't work.

https://java.net/jira/browse/ozark seems to indicate that 1.0.0-m02 will be released in October which is soon enough. :)

Also, please feel free to fork this repo if you'd like to add an example using https://github.com/caelum/vraptor4

Turini commented 9 years ago

@pdurbin I've just added an issue! I'm planning to do that next week ;)