Changes for page Your First Rest Project
Last modified by Steve Peery on 2013/09/06 11:02
From version 32.1
edited by Pascal Robert
on 2011/12/29 08:31
on 2011/12/29 08:31
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. probert1 +XWiki.franc - Content
-
... ... @@ -88,7 +88,7 @@ 88 88 89 89 Final list of attributes should look like this: 90 90 91 -Now, it's time to link the two entities together. A Author can have multiple blog entries, and a BlogEntry can only have one author. To create the relationship (the join), right-click on **Author** and select **New Relationship**. On your right, select **BlogEntry** in the list. On your left, select **to many BlogEntries**, and on your left, select **to one Author**. Now, in BlogEntry, we need to store the primary key of the author so that we can make the join. The relationship builder allow us to add that attribute, so make sure **and a new foreign key named** is checked (it is checked by default). The **Create Relationship** pane should look like this:91 +Now, it's time to link the two entities together. A Author can have multiple blog entries, and a BlogEntry can only have one author. To create the relationship (the join), right-click on **Author** and select **New Relationship**. On your right, select **BlogEntry** in the list. On your left, select **to many BlogEntries**, and on your right, select **to one Author**. Now, in BlogEntry, we need to store the primary key of the author so that we can make the join. The relationship builder allow us to add that attribute, so make sure **and a new foreign key named** is checked (it is checked by default). The **Create Relationship** pane should look like this: 92 92 93 93 If you check in the **Outline** tab, you should see that **Author** now have a **blogEntries** relationship, and **BlogEntry** have a **author** relationship. 94 94 ... ... @@ -369,7 +369,7 @@ 369 369 370 370 That component code will loop over the blog entries and display the title of the entry + the name of the author. Save everything and run the application. 371 371 372 -If you go to http: ~/~/192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html, you will see the list of blog entries372 +If you go to [[http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html]], you will see the list of blog entries 373 373 374 374 Now that we have a list of blog entries, let's make a page to show the content of a blog entry. Create a new component named **BlogEntryShowPage**. 375 375 ... ... @@ -387,13 +387,13 @@ 387 387 388 388 {{code}} 389 389 390 - 391 - 390 +private BlogEntry blogEntry; 391 + 392 392 @ERXRouteParameter 393 393 public void setBlogEntry(BlogEntry blogEntryFromController) { 394 394 this.blogEntry = blogEntryFromController; 395 395 } 396 - 396 + 397 397 public BlogEntry blogEntry() { 398 398 return this.blogEntry; 399 399 } ... ... @@ -406,7 +406,7 @@ 406 406 407 407 {{code}} 408 408 409 - 409 +<h1><wo:str value="$blogEntry.title" /></h1> 410 410 <p><wo:str value="$blogEntry.content" /></p> 411 411 <p>Created on: <wo:str value="$blogEntry.creationDate" dateformat="%Y/%m/%d" /></p> 412 412 <p>Added by: <wo:str value="$blogEntry.author.fullName" /></p> ... ... @@ -429,6 +429,6 @@ 429 429 430 430 {{/code}} 431 431 432 -Save the component and run the app. Go to http: ~/~/192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html to get the list of posts, and you should see a link on the title. Click on it, and now you get the full details of the blog entry!432 +Save the component and run the app. Go to [[http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html]] to get the list of posts, and you should see a link on the title. Click on it, and now you get the full details of the blog entry 433 433 434 -The REST part of this tutorial is now complete, you can now switch to the next part of the tutorial. 434 +The REST part of this tutorial is now complete, you can now switch to the next part of the tutorial.