Re: MVC2 way to stick a collection in page scope?

2003-08-15 Thread jack beany
Thanks for the offer Keith :)

Seems to be like getting blood from many stones at times hehe.  Not sure if 
I want to venture into pure EJB's just yet - think I'll just code it how I'm 
comfortable, using frameworks as and when I need.

Dont spose you know the answer to the question below, gone awfully quiet 
round here? ;)

Cheers

From: Keith Pemberton <[EMAIL PROTECTED]>
I too am working on my own blogging site but I'm using EJBs instead of
DAO objects.  What I did was to create a plugin that is specified in the
struts-config file.  The plugin interface is really easy to implement,
but you put the object in the ServletContext instead of page context.  I
can provide you a code sample if you need it.  I'm grabbing the last
five entries from the database using a Session bean interacting with
entity beans.  This is not the best way to implement a blogging system I
know, but it gives me a good excuse to learn some of the ins and outs of
Enterprise JavaBeans.  Anyway, let me know if I can help further.
On Thu, 2003-08-14 at 09:12, jack beany wrote:
> >From: Vic Cekvenich <[EMAIL PROTECTED]>
> >
> >jack beany wrote:
> >
> >>yup... so i have my Blog bean which calls the DAO for persistance.  
What I
> >>want to know is how to best structure the searching for a bunch of 
blog
> >>beans/records/objects, and then stick that in page scope for 
presentation
> >>with JSTL?
> >>
> >
> >Conder a Struts book, such as Struts in Acton.
> >Struts says this should be done in action.
> >The searching/retrieving happens in DAO.
> >Struts puts in in scope for you if updetable. Else, put it in request 
scope
> >(do so in Action) for JSTL.
>
> ok - getting closer...
>
> to summarise, you're saying I should have an index.do instead of an
> index.jsp and declare all bean/bean collections in the action.
>
> Currently I've not used an action without it being the result of a form
> posting... Do I just create an action mapping without a "name" 
attribute,
> and with an "attribute" attribute of something like "indexPage"? i.e.:
>
> 
>type="project.actions.IndexAction"
>   attribute="indexPage"
>   scope="request"
>validate="false">
> 
>
> then put a check for the indexPage scope in the jsp and redirect to the
> action if it doesnt exist?
_
Express yourself with cool emoticons - download MSN Messenger today! 
http://www.msn.co.uk/messenger

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: MVC2 way to stick a collection in page scope?

2003-08-14 Thread Keith Pemberton
I too am working on my own blogging site but I'm using EJBs instead of
DAO objects.  What I did was to create a plugin that is specified in the
struts-config file.  The plugin interface is really easy to implement,
but you put the object in the ServletContext instead of page context.  I
can provide you a code sample if you need it.  I'm grabbing the last
five entries from the database using a Session bean interacting with
entity beans.  This is not the best way to implement a blogging system I
know, but it gives me a good excuse to learn some of the ins and outs of
Enterprise JavaBeans.  Anyway, let me know if I can help further.  

Keith

On Thu, 2003-08-14 at 09:12, jack beany wrote:
> >From: Vic Cekvenich <[EMAIL PROTECTED]>
> >
> >jack beany wrote:
> >
> >>yup... so i have my Blog bean which calls the DAO for persistance.  What I 
> >>want to know is how to best structure the searching for a bunch of blog 
> >>beans/records/objects, and then stick that in page scope for presentation 
> >>with JSTL?
> >>
> >
> >Conder a Struts book, such as Struts in Acton.
> >Struts says this should be done in action.
> >The searching/retrieving happens in DAO.
> >Struts puts in in scope for you if updetable. Else, put it in request scope 
> >(do so in Action) for JSTL.
> 
> ok - getting closer...
> 
> to summarise, you're saying I should have an index.do instead of an 
> index.jsp and declare all bean/bean collections in the action.
> 
> Currently I've not used an action without it being the result of a form 
> posting... Do I just create an action mapping without a "name" attribute, 
> and with an "attribute" attribute of something like "indexPage"? i.e.:
> 
> type="project.actions.IndexAction"
>   attribute="indexPage"
>   scope="request"
>validate="false">
> 
> 
> then put a check for the indexPage scope in the jsp and redirect to the 
> action if it doesnt exist?
> 
> Cheers
> J
> 
> _
> Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
Keith Pemberton <[EMAIL PROTECTED]>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



MVC2 way to stick a collection in page scope?

2003-08-14 Thread jack beany
Hi All,

I have my index page, and want a blog on it.  Blog entries are in a table, 
and I have all the db query side sorted out.  What I want to know is the 
best practice way of making a DAO which can be called from my index page and 
also from my findblog action.

The index page would pass a few logic/hard coded parameters to the bean, as 
would the findblog action.

I imagine I dont want to create an action for this as the blog is just one 
of half a dozen components on the page, and passive in nature (unlike with 
findblog action which is only thing on page and requiring form input).  I 
dont want to code sql in jsp, which would be fastest but messy.  I am not 
sure it's good practice to make a custom tag for this, to set my Result 
collection in page scope.  Perhaps a DAO bean to do the query and return a 
Result collection, which could then be put into correct scope by both the 
action and a new tag?

Thoughts?

Thanks

_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: MVC2 way to stick a collection in page scope?

2003-08-14 Thread Vic Cekvenich
In an MVC one does not cache data (results) in a view (jsp)
Model is for data layer, and data caching goes in model.
A DAO like iBatis or Hibrenate has configurable auto cache.
Of course, you do not call the DAO from the page. You could call the DAO 
from a bean.

One should avoid custom tags now a days... with JSTL and all.

Here is a similar example page:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bPproj/bP/WEB-INF/portlets/newsBlg/NewsBlgCmntsLst.jsp
hth,

jack beany wrote:
Hi All,

I have my index page, and want a blog on it.  Blog entries are in a 
table, and I have all the db query side sorted out.  What I want to know 
is the best practice way of making a DAO which can be called from my 
index page and also from my findblog action.

The index page would pass a few logic/hard coded parameters to the bean, 
as would the findblog action.

I imagine I dont want to create an action for this as the blog is just 
one of half a dozen components on the page, and passive in nature 
(unlike with findblog action which is only thing on page and requiring 
form input).  I dont want to code sql in jsp, which would be fastest but 
messy.  I am not sure it's good practice to make a custom tag for this, 
to set my Result collection in page scope.  Perhaps a DAO bean to do the 
query and return a Result collection, which could then be put into 
correct scope by both the action and a new tag?

Thoughts?

Thanks

_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger
--
Vic Cekvenich,
Struts Instructor,
1-800-917-JAVA
Advanced Struts Training, mentoring and 
project recovery in North East.
Struts conversion and  fixed bid development.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: MVC2 way to stick a collection in page scope?

2003-08-14 Thread jack beany
From: Vic Cekvenich <[EMAIL PROTECTED]>
In an MVC one does not cache data (results) in a view (jsp)
Model is for data layer, and data caching goes in model.
A DAO like iBatis or Hibrenate has configurable auto cache.
iBatis certainly looks good... Currently using JNDI, but this could save 
hassle in long term...

Of course, you do not call the DAO from the page. You could call the DAO 
from a bean.
yup... so i have my Blog bean which calls the DAO for persistance.  What I 
want to know is how to best structure the searching for a bunch of blog 
beans/records/objects, and then stick that in page scope for presentation 
with JSTL?

One should avoid custom tags now a days... with JSTL and all.
Can understand that!

Here is a similar example page:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bPproj/bP/WEB-INF/portlets/newsBlg/NewsBlgCmntsLst.jsp
thanks, probably going to use the ibatis examples too.

J

_
On the move? Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: MVC2 way to stick a collection in page scope?

2003-08-14 Thread jack beany
From: Vic Cekvenich <[EMAIL PROTECTED]>

jack beany wrote:

yup... so i have my Blog bean which calls the DAO for persistance.  What I 
want to know is how to best structure the searching for a bunch of blog 
beans/records/objects, and then stick that in page scope for presentation 
with JSTL?

Conder a Struts book, such as Struts in Acton.
Struts says this should be done in action.
The searching/retrieving happens in DAO.
Struts puts in in scope for you if updetable. Else, put it in request scope 
(do so in Action) for JSTL.
ok - getting closer...

to summarise, you're saying I should have an index.do instead of an 
index.jsp and declare all bean/bean collections in the action.

Currently I've not used an action without it being the result of a form 
posting... Do I just create an action mapping without a "name" attribute, 
and with an "attribute" attribute of something like "indexPage"? i.e.:

   
   
then put a check for the indexPage scope in the jsp and redirect to the 
action if it doesnt exist?

Cheers
J
_
Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: MVC2 way to stick a collection in page scope?

2003-08-14 Thread Vic Cekvenich


jack beany wrote:

yup... so i have my Blog bean which calls the DAO for persistance.  What 
I want to know is how to best structure the searching for a bunch of 
blog beans/records/objects, and then stick that in page scope for 
presentation with JSTL?

Conder a Struts book, such as Struts in Acton.
Struts says this should be done in action.
The searching/retrieving happens in DAO.
Struts puts in in scope for you if updetable. Else, put it in request 
scope (do so in Action) for JSTL.

--
Vic Cekvenich,
Struts Instructor,
1-800-917-JAVA
Advanced Struts Training, mentoring and 
project recovery in North East.
Struts conversion and  fixed bid development.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]