guestbook application with database update

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

guestbook application with database update

Daniel Watrous-2
I'm creating a small app based on the guestbook:
http://www.wicket-library.com/wicket-examples/guestbook/?1

In the guestbook app, the page view is updated every time a new
comment is added. The variable commentList is initialized at the top
like this

private static final List<Comment> commentList = new ArrayList<Comment>();

        // Add commentListView of existing comments
        add(new PropertyListView<Comment>("comments", commentList)
        {
            @Override
            public void populateItem(final ListItem<Comment> listItem)
            {
                listItem.add(new Label("date"));
                listItem.add(new MultiLineLabel("text"));
            }
        }).setVersioned(false);

I wanted to use a database instead, so I made the following changes

private List<Movie> movieList = new ArrayList<Movie>();

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        movieList = session.createQuery("from Movie").list();
        session.getTransaction().commit();

        // Add commentListView of existing comments
        add(new PropertyListView<Movie>("movies", movieList) {

            @Override
            public void populateItem(final ListItem<Movie> listItem) {
                listItem.add(new
TextField<String>("name").setType(String.class));
                listItem.add(new DropDownChoice<Category>("category",
Arrays.asList(Category.values()), new
EnumChoiceRenderer<Category>(this)));
                listItem.add(new Label("rating"));
            }
        }).setVersioned(false);

With this change, all the items in the database come up when the page
first loads, but not after each new item is added to the database. I
have to clear out the URL and load the page fresh to see what has been
added since the last fresh load.

I did try resetting movieList in the onSubmit function to load the
current database items into the variable movieList, but that still
doesn't update the list.

Any idea how to update movieList after each new item is submitted.

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

Sven Meier
Use a LoadableDetachableModel to load a fresh list of movies on each
request.

Sven

On 01/21/2012 10:35 PM, Daniel Watrous wrote:

> I'm creating a small app based on the guestbook:
> http://www.wicket-library.com/wicket-examples/guestbook/?1
>
> In the guestbook app, the page view is updated every time a new
> comment is added. The variable commentList is initialized at the top
> like this
>
> private static final List<Comment>  commentList = new ArrayList<Comment>();
>
>          // Add commentListView of existing comments
>          add(new PropertyListView<Comment>("comments", commentList)
>          {
>              @Override
>              public void populateItem(final ListItem<Comment>  listItem)
>              {
>                  listItem.add(new Label("date"));
>                  listItem.add(new MultiLineLabel("text"));
>              }
>          }).setVersioned(false);
>
> I wanted to use a database instead, so I made the following changes
>
> private List<Movie>  movieList = new ArrayList<Movie>();
>
>          Session session = HibernateUtil.getSessionFactory().getCurrentSession();
>          session.beginTransaction();
>          movieList = session.createQuery("from Movie").list();
>          session.getTransaction().commit();
>
>          // Add commentListView of existing comments
>          add(new PropertyListView<Movie>("movies", movieList) {
>
>              @Override
>              public void populateItem(final ListItem<Movie>  listItem) {
>                  listItem.add(new
> TextField<String>("name").setType(String.class));
>                  listItem.add(new DropDownChoice<Category>("category",
> Arrays.asList(Category.values()), new
> EnumChoiceRenderer<Category>(this)));
>                  listItem.add(new Label("rating"));
>              }
>          }).setVersioned(false);
>
> With this change, all the items in the database come up when the page
> first loads, but not after each new item is added to the database. I
> have to clear out the URL and load the page fresh to see what has been
> added since the last fresh load.
>
> I did try resetting movieList in the onSubmit function to load the
> current database items into the variable movieList, but that still
> doesn't update the list.
>
> Any idea how to update movieList after each new item is submitted.
>
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

kamiseq
it really doesnt matter where you get your data - from ArrayList or db
- wrap code to access db into some function that return List and use
LoadableDetachableModel as sven advised

pozdrawiam
Paweł Kamiński

[hidden email]
[hidden email]
______________________

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

Daniel Watrous-2
In reply to this post by Sven Meier
This worked GREAT! Thank you.

On Sat, Jan 21, 2012 at 2:51 PM, Sven Meier <[hidden email]> wrote:

> Use a LoadableDetachableModel to load a fresh list of movies on each
> request.
>
> Sven
>
>
> On 01/21/2012 10:35 PM, Daniel Watrous wrote:
>>
>> I'm creating a small app based on the guestbook:
>> http://www.wicket-library.com/wicket-examples/guestbook/?1
>>
>> In the guestbook app, the page view is updated every time a new
>> comment is added. The variable commentList is initialized at the top
>> like this
>>
>> private static final List<Comment>  commentList = new
>> ArrayList<Comment>();
>>
>>         // Add commentListView of existing comments
>>         add(new PropertyListView<Comment>("comments", commentList)
>>         {
>>             @Override
>>             public void populateItem(final ListItem<Comment>  listItem)
>>             {
>>                 listItem.add(new Label("date"));
>>                 listItem.add(new MultiLineLabel("text"));
>>             }
>>         }).setVersioned(false);
>>
>> I wanted to use a database instead, so I made the following changes
>>
>> private List<Movie>  movieList = new ArrayList<Movie>();
>>
>>         Session session =
>> HibernateUtil.getSessionFactory().getCurrentSession();
>>         session.beginTransaction();
>>         movieList = session.createQuery("from Movie").list();
>>         session.getTransaction().commit();
>>
>>         // Add commentListView of existing comments
>>         add(new PropertyListView<Movie>("movies", movieList) {
>>
>>             @Override
>>             public void populateItem(final ListItem<Movie>  listItem) {
>>                 listItem.add(new
>> TextField<String>("name").setType(String.class));
>>                 listItem.add(new DropDownChoice<Category>("category",
>> Arrays.asList(Category.values()), new
>> EnumChoiceRenderer<Category>(this)));
>>                 listItem.add(new Label("rating"));
>>             }
>>         }).setVersioned(false);
>>
>> With this change, all the items in the database come up when the page
>> first loads, but not after each new item is added to the database. I
>> have to clear out the URL and load the page fresh to see what has been
>> added since the last fresh load.
>>
>> I did try resetting movieList in the onSubmit function to load the
>> current database items into the variable movieList, but that still
>> doesn't update the list.
>>
>> Any idea how to update movieList after each new item is submitted.
>>
>> Daniel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

jaffa
This post has NOT been accepted by the mailing list yet.
In the earliest database systems, efficiency was perhaps the primary concern, but it was already recognized that there were other important objectives. One of the key aims was to make the data independent of the logic of application programs, so that the same data could be made available to different applications. Thanks.
Regards,
WEB DESIGN COMPANY

Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

jaffa
The graph database is a kind of NoSQL database that uses graph structures with nodes, edges, and properties to represent and store information. General graph databases that can store any graph are distinct from specialized graph databases such as triplestores and network databases. Thanks.
Regards,
essay writing help
Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

jaffa
This post was updated on .
Graph databases are based on graph theory. Graph databases employ nodes, properties, and edges. Nodes are very similar in nature to the objects that object oriented programmers will be familiar with. Thanks.
Regards,
Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

jaffa
In reply to this post by kamiseq
Names and addresses provided in guestbooks, paper based or electronic, are frequently recorded and collated for use in providing statistics about visitors to the site, and to contact visitors to the site in the future. Thanks.
Regards,
toronto online marketing
Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

Martin Grigorov-4
This looks like a spam.
Third mail in this thread with unrelated content.
Who has the karma to block this user ?

On Thu, Jun 21, 2012 at 3:23 PM, jaffa <[hidden email]> wrote:

> Names and addresses provided in guestbooks, paper based or electronic, are
> frequently recorded and collated for use in providing statistics about
> visitors to the site, and to contact visitors to the site in the future.
> Thanks.
> Regards,
> http://www.webryze.com toronto online marketing
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/guestbook-application-with-database-update-tp4316943p4650155.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

jeremy@wickettraining.com
All list moderators do.  I just emails to users-unsubscribe-jaffa.wify=
[hidden email] and users-deny-subscribe-jaffa.wify=
[hidden email] which I think will block this guy.

More info: http://www.apache.org/dev/committers.html#problem_posts

--
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*



On Thu, Jun 21, 2012 at 7:30 AM, Martin Grigorov <[hidden email]>wrote:

> This looks like a spam.
> Third mail in this thread with unrelated content.
> Who has the karma to block this user ?
>
> On Thu, Jun 21, 2012 at 3:23 PM, jaffa <[hidden email]> wrote:
> > Names and addresses provided in guestbooks, paper based or electronic,
> are
> > frequently recorded and collated for use in providing statistics about
> > visitors to the site, and to contact visitors to the site in the future.
> > Thanks.
> > Regards,
> > http://www.webryze.com toronto online marketing
> >
> >
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/guestbook-application-with-database-update-tp4316943p4650155.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

jaffa
This post was updated on .
In reply to this post by Daniel Watrous-2
Renaissance painters used the camera obscura which, in fact, gives the optical rendering in color that dominates Western Art. The camera obscura literally means dark chamber in Latin. It is a box with a hole in it which allows light to go through and create an image onto the piece of paper. Thanks.
Regards,
dating sites
Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

jeremy@wickettraining.com
In reply to this post by jeremy@wickettraining.com
For future reference in case somebody stumbles across this post: this guy
was moderated through, which requires a different remove command.  Martijn
pointed out that the command for that is for a list moderator to email:
users-allow-unsubscribe-jaffa.wify=[hidden email]

Thanks Martijn!

--
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

On Mon, Jun 25, 2012 at 3:08 PM, Jeremy Thomerson <[hidden email]
> wrote:

> All list moderators do.  I just emails to users-unsubscribe-jaffa.wify=
> [hidden email] and users-deny-subscribe-jaffa.wify=
> [hidden email] which I think will block this guy.
>
> More info: http://www.apache.org/dev/committers.html#problem_posts
>
> --
> Jeremy Thomerson
> http://wickettraining.com
> *Need a CMS for Wicket?  Use Brix! http://brixcms.org*
>
>
>
> On Thu, Jun 21, 2012 at 7:30 AM, Martin Grigorov <[hidden email]>wrote:
>
>> This looks like a spam.
>> Third mail in this thread with unrelated content.
>> Who has the karma to block this user ?
>>
>> On Thu, Jun 21, 2012 at 3:23 PM, jaffa <[hidden email]> wrote:
>> > Names and addresses provided in guestbooks, paper based or electronic,
>> are
>> > frequently recorded and collated for use in providing statistics about
>> > visitors to the site, and to contact visitors to the site in the future.
>> > Thanks.
>> > Regards,
>> > http://www.webryze.com toronto online marketing
>> >
>> >
>> > --
>> > View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/guestbook-application-with-database-update-tp4316943p4650155.html
>> > Sent from the Users forum mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]
>> > For additional commands, e-mail: [hidden email]
>> >
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: guestbook application with database update

lebron23185
This post has NOT been accepted by the mailing list yet.
In reply to this post by Daniel Watrous-2
This is a nice blog. Thanks for the information you post.Keep posting. resume generatorThanks for sharing. http://www.resumegenerator.net/