Last modified by Bastian Triller on 2021/08/07 03:59

From version 16.1
edited by Pascal Robert
on 2012/12/12 07:59
Change comment: There is no comment for this version
To version 12.1
edited by Pascal Robert
on 2012/08/09 04:59
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,3 +1,7 @@
1 +{{info}}
2 +Work in progress
3 +{{/info}}
4 +
1 1  So far, we have seen two of the technologies, D2W and ERRest, that Project Wonder offers for viewing and managing the data. In this tutorial, we will show how to do it with the "stateful" way of doing things. Stateful have been around since the beginning of WebObjects in 1996, so it's the oldest way of presenting data and constructing pages.
2 2  
3 3  Stateful means that you don't have to worry about creating sessions and keeping track of data coming from HTML input fields and controls. In fact, D2W is also stateful.
... ... @@ -134,18 +134,8 @@
134 134  
135 135  {{/code}}
136 136  
137 -Save the file. Now open Author.java and add the following method:
141 +Save the file. Next: we need to add a component to present the login form to the user. Right-click on the **Components** folder in the project, and select **New** > **WOComponent**. Change the name of the component to be **AdminMainPage** and change the superclass to **er.extensions.components.ERXComponent**.
138 138  
139 -{{code}}
140 -public static Author validateLogin(EOEditingContext editingContext, String _emailAddress) {
141 -     Author user = Author.fetchAuthor(ERXEC.newEditingContext(), Author.EMAIL.eq(_emailAddress));
142 - return user;
143 -}
144 -
145 -{{/code}}
146 -
147 -Next: we need to add a component to present the login form to the user. Right-click on the **Components** folder in the project, and select **New** > **WOComponent**. Change the name of the component to be **AdminMainPage** and change the superclass to **er.extensions.components.ERXComponent**.
148 -
149 149  After the component have been created, open **AdminMainPage.java** and override the content of the class with the following code:
150 150  
151 151  {{code}}
... ... @@ -245,16 +245,16 @@
245 245  
246 246  {{code}}
247 247  
248 -<wo:AjaxUpdateContainer id="main">
242 + <wo:AjaxUpdateContainer id="main">
249 249   <wo:if condition="$isLogged">
250 250   <wo:if condition="$displayGroup.hasMultipleBatches">
251 251   <div>
252 252   <wo:link action="$displayGroup.displayPreviousBatch">Previous</wo:link>
253 - | Batch
247 + | Batch
254 254   <wo:str value="$displayGroup.currentBatchIndex" />
255 - of
249 + of
256 256   <wo:str value="$displayGroup.batchCount" />
257 - |
251 + |
258 258   <wo:link action="$displayGroup.displayNextBatch">Next</wo:link>
259 259   </div>
260 260   </wo:if>
... ... @@ -371,7 +371,7 @@
371 371  
372 372  {{code}}
373 373  
374 -<wo:form>
368 + <wo:form>
375 375   <div>
376 376   <label>Title:</label>
377 377   <wo:textfield value="$blogEntry.title" />
... ... @@ -390,16 +390,16 @@
390 390  
391 391  {{code}}
392 392  
393 -public WOActionResults editBlogEntry() {
387 + public WOActionResults editBlogEntry() {
394 394   EditBlogEntry nextPage = pageWithName(EditBlogEntry.class);
395 395   nextPage.setBlogEntry(_blogEntryItem);
396 396   return nextPage;
397 397   }
398 -
392 +
399 399   public WOActionResults createBlogEntry() {
400 400   EditBlogEntry nextPage = pageWithName(EditBlogEntry.class);
401 401   nextPage.setBlogEntry(null);
402 - return nextPage;
396 + return nextPage;
403 403   }
404 404  
405 405  {{/code}}
... ... @@ -428,4 +428,4 @@
428 428  
429 429  {{/code}}
430 430  
431 -Save everything, run the app, click on the "admin" link, login and check if you can create or edit a blog entry. Everything should be working, and just created your first stateful Project Wonder application [[It's time to deploy an application>>Your First Deployment]].
425 +Save everything, run the app, click on the "admin" link, login and check if you can create or edit a blog entry. Everything should be working, and just created your first stateful Project Wonder application!