Joshua Marker's book: chapter 7
Joshua Marker's book: chapter 7
- Subject: Joshua Marker's book: chapter 7
- From: Jeremy Matthews <email@hidden>
- Date: Fri, 4 Jun 2004 23:30:23 -0400
For some odd reason, I just can't get the project to compile
correctly..not sure where I'm messing things up. I've nailed it down to
a single error. When I run my version of the "WebPublisher" app, I hit
the following error:
Error:
com.webobjects.appserver._private.WODynamicElementCreationException:
Missing 'list' or 'count' attribute.
Reason:
<com.webobjects.appserver._private.WORepetition> Missing 'list' or
'count' attribute.
Here's my main code; I know I'm missing something small, but I've
checked the bindings for all my keys and actions to WOElements. I must
be missing something small
//
// Main.java: Class file for WO Component 'Main'
// Project WebPublisher
//
// Created by jeremym on Fri Jun 04 2004
//
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
public class Main extends WOComponent {
/** @TypeInfo Author */
public NSArray authorList;
public Author anAuthor;
public String newAuthorName;
public Main(WOContext context) {
super(context);
}
public WOComponent deleteAuthor()
{
EOEditingContext ec = session().defaultEditingContext();
ec.deleteObject(anAuthor);
ec.saveChanges();
return null;
}
public WOComponent addAuthor()
{
Author newAuthor = new Author();
EOEditingContext ec = session().defaultEditingContext();
ec.insertObject(newAuthor);
newAuthor.setAuthorName(newAuthorName);
ec.saveChanges();
return null;
}
public void
appendToResponse (WOResponse response, WOContext context)
{
EOFetchSpecification fetchSpec;
EOEditingContext ec = session().defaultEditingContext();
fetchSpec = new EOFetchSpecification ("Author", null, null);
authorList = ec.objectsWithFetchSpecification(fetchSpec);
super.appendToResponse(response, context);
}
public AuthorEdit editAuthor()
{
AuthorEdit nextPage = (AuthorEdit)pageWithName("AuthorEdit");
nextPage.setTheAuthor(anAuthor);
return nextPage;
}
public ArticleEdit addArticle()
{
ArticleEdit nextPage = (ArticleEdit)pageWithName("ArticleEdit");
Article newArticle = new Article();
session().defaultEditingContext().insertObject(newArticle);
nextPage.setAnArticle(newArticle);
// Initialize your component here
return nextPage;
}
}
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.