You are getting error because the account won't exist. this code only works for existing account records. you have to insert the account and have to use conditional if statement like this
public class MyController {
private final Account account;
public list<Account> allaccount= new list<Account>();
public MyController() {
allaccount = [select id, name, site from Account where id =
:ApexPages.currentPage().getParameters().get('id') limit 1];
if(!allaccount.isEmpty() )
account = allaccount[0];
else
account = new account();
}
public Account getAccount() {
return account;
}
public PageReference save() {
if(!allaccount.isEmpty() )
insert account;
else
update account;
return null;
}
}
this will defiantly work fine for both new and existing accounts. Let me know if face any other problem
Rohit