You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul <pa...@merge-solutions.com> on 2007/05/07 15:20:10 UTC

[S2] Spring Bean + ?

Hi,
 
Having some issues getting this the above working. I have a defined spring bean as follows:
 
<bean id="roleDao" class="com.paul.project.system.dao.impl.RoleDaoImpl">
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
 
 
Now the RoleDaoImpl contains a method 'findAll()' which I would like to iterate over the results and display them.
 
In my jsp I have tried:
 
<s:iterator value="roleDao.findAll()">
            <s:property value="name"/>
            <s:property value="description"/>
</s:iterator>
 
But I don't think that would work since roleDao isn't on the stack?
 
I've tried declaring:
<s:bean name="com.paul.project.system.dao.impl.RoleDaoImpl"  id="roleBean"/>
 
<s:iterator value="roleBean.findAll"">
etc.etc.
 
Basically I have a userform for an admin, that has a UserModel on the stack. Part of the userform though is selecting which user roles (RoleModel) to add the user to and I need to render all available roles. I think my issue is strictly syntax? I hope someone could point me in the right direction? 
 
Regards,
Paul

Re: [S2] Spring Bean + ?

Posted by Martin Gainty <mg...@hotmail.com>.
what is the value of singleton= in spring config?
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "Paul" <pa...@merge-solutions.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, May 08, 2007 9:15 AM
Subject: RE: [S2] Spring Bean + <s:iterator> ?


Dave,

Took your advice and continued to build out my RoleAction, RoleDao, 
RoleService (all of which I'll need anyway later.)

I have my RoleAction setup with RoleService being passed as a constructor 
(Spring.)

In my JSP now I am just doing,

<s:action name="RoleAction" executeResult="false">

RoleAction class has the private member roles which is the list of all the 
roles I wish to iterate over.

Question now is, does RoleAction not get thrown onto the stack after the 
<s:action...> call? It seems I can only access the 'roles.name' and 
'roles.description' properties from dispatched result page?

hmmmmm


-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com]
Sent: Monday, May 07, 2007 9:32 AM
To: Struts Users Mailing List;Paul
Subject: Re: [S2] Spring Bean + <s:iterator> ?

Why not just supply a list getter in your action and
set its value to the roleDao's findAll result?

In general I don't think using DAO functionality on
the view side is a particularly good idea anyway, but
that's just me :)

d.

--- Paul <pa...@merge-solutions.com> wrote:

> Hi,
>
> Having some issues getting this the above working. I
> have a defined spring bean as follows:
>
> <bean id="roleDao"
>
class="com.paul.project.system.dao.impl.RoleDaoImpl">
>     <property name="entityManagerFactory"
> ref="entityManagerFactory"/>
> </bean>
>
>
> Now the RoleDaoImpl contains a method 'findAll()'
> which I would like to iterate over the results and
> display them.
>
> In my jsp I have tried:
>
> <s:iterator value="roleDao.findAll()">
>             <s:property value="name"/>
>             <s:property value="description"/>
> </s:iterator>
>
> But I don't think that would work since roleDao
> isn't on the stack?
>
> I've tried declaring:
> <s:bean
> name="com.paul.project.system.dao.impl.RoleDaoImpl"
> id="roleBean"/>
>
> <s:iterator value="roleBean.findAll"">
> etc.etc.
>
> Basically I have a userform for an admin, that has a
> UserModel on the stack. Part of the userform though
> is selecting which user roles (RoleModel) to add the
> user to and I need to render all available roles. I
> think my issue is strictly syntax? I hope someone
> could point me in the right direction?
>
> Regards,
> Paul


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [S2] Spring Bean + ?

Posted by Paul <pa...@merge-solutions.com>.
Nevermind all!

Answered my own question finally,

<s:action name="RoleAction" executeResult=false" id="roleAction"/>

<s:iterator value="#roleAction.roles" status="roleStatus">

</s:iterator> did the trick! :)

Regards,
P

-----Original Message-----
From: Paul Saumets | Merge [mailto:paul.saumets@merge-solutions.com] 
Sent: Tuesday, May 08, 2007 9:15 AM
To: Struts Users Mailing List
Subject: RE: [S2] Spring Bean + <s:iterator> ?

Dave,

Took your advice and continued to build out my RoleAction, RoleDao, RoleService (all of which I'll need anyway later.)

I have my RoleAction setup with RoleService being passed as a constructor (Spring.)

In my JSP now I am just doing,

<s:action name="RoleAction" executeResult="false">

RoleAction class has the private member roles which is the list of all the roles I wish to iterate over.

Question now is, does RoleAction not get thrown onto the stack after the <s:action...> call? It seems I can only access the 'roles.name' and 'roles.description' properties from dispatched result page?

hmmmmm


-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Monday, May 07, 2007 9:32 AM
To: Struts Users Mailing List;Paul
Subject: Re: [S2] Spring Bean + <s:iterator> ?

Why not just supply a list getter in your action and
set its value to the roleDao's findAll result?

In general I don't think using DAO functionality on
the view side is a particularly good idea anyway, but
that's just me :)

d.

--- Paul <pa...@merge-solutions.com> wrote:

> Hi,
> 
> Having some issues getting this the above working. I
> have a defined spring bean as follows:
> 
> <bean id="roleDao"
>
class="com.paul.project.system.dao.impl.RoleDaoImpl">
>     <property name="entityManagerFactory"
> ref="entityManagerFactory"/>
> </bean>
> 
> 
> Now the RoleDaoImpl contains a method 'findAll()'
> which I would like to iterate over the results and
> display them.
> 
> In my jsp I have tried:
> 
> <s:iterator value="roleDao.findAll()">
>             <s:property value="name"/>
>             <s:property value="description"/>
> </s:iterator>
> 
> But I don't think that would work since roleDao
> isn't on the stack?
> 
> I've tried declaring:
> <s:bean
> name="com.paul.project.system.dao.impl.RoleDaoImpl" 
> id="roleBean"/>
> 
> <s:iterator value="roleBean.findAll"">
> etc.etc.
> 
> Basically I have a userform for an admin, that has a
> UserModel on the stack. Part of the userform though
> is selecting which user roles (RoleModel) to add the
> user to and I need to render all available roles. I
> think my issue is strictly syntax? I hope someone
> could point me in the right direction?
> 
> Regards,
> Paul


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [S2] Spring Bean + ?

Posted by Paul <pa...@merge-solutions.com>.
Dave,

Took your advice and continued to build out my RoleAction, RoleDao, RoleService (all of which I'll need anyway later.)

I have my RoleAction setup with RoleService being passed as a constructor (Spring.)

In my JSP now I am just doing,

<s:action name="RoleAction" executeResult="false">

RoleAction class has the private member roles which is the list of all the roles I wish to iterate over.

Question now is, does RoleAction not get thrown onto the stack after the <s:action...> call? It seems I can only access the 'roles.name' and 'roles.description' properties from dispatched result page?

hmmmmm


-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Monday, May 07, 2007 9:32 AM
To: Struts Users Mailing List;Paul
Subject: Re: [S2] Spring Bean + <s:iterator> ?

Why not just supply a list getter in your action and
set its value to the roleDao's findAll result?

In general I don't think using DAO functionality on
the view side is a particularly good idea anyway, but
that's just me :)

d.

--- Paul <pa...@merge-solutions.com> wrote:

> Hi,
> 
> Having some issues getting this the above working. I
> have a defined spring bean as follows:
> 
> <bean id="roleDao"
>
class="com.paul.project.system.dao.impl.RoleDaoImpl">
>     <property name="entityManagerFactory"
> ref="entityManagerFactory"/>
> </bean>
> 
> 
> Now the RoleDaoImpl contains a method 'findAll()'
> which I would like to iterate over the results and
> display them.
> 
> In my jsp I have tried:
> 
> <s:iterator value="roleDao.findAll()">
>             <s:property value="name"/>
>             <s:property value="description"/>
> </s:iterator>
> 
> But I don't think that would work since roleDao
> isn't on the stack?
> 
> I've tried declaring:
> <s:bean
> name="com.paul.project.system.dao.impl.RoleDaoImpl" 
> id="roleBean"/>
> 
> <s:iterator value="roleBean.findAll"">
> etc.etc.
> 
> Basically I have a userform for an admin, that has a
> UserModel on the stack. Part of the userform though
> is selecting which user roles (RoleModel) to add the
> user to and I need to render all available roles. I
> think my issue is strictly syntax? I hope someone
> could point me in the right direction?
> 
> Regards,
> Paul


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Spring Bean + ?

Posted by Dave Newton <ne...@yahoo.com>.
Why not just supply a list getter in your action and
set its value to the roleDao's findAll result?

In general I don't think using DAO functionality on
the view side is a particularly good idea anyway, but
that's just me :)

d.

--- Paul <pa...@merge-solutions.com> wrote:

> Hi,
> 
> Having some issues getting this the above working. I
> have a defined spring bean as follows:
> 
> <bean id="roleDao"
>
class="com.paul.project.system.dao.impl.RoleDaoImpl">
>     <property name="entityManagerFactory"
> ref="entityManagerFactory"/>
> </bean>
> 
> 
> Now the RoleDaoImpl contains a method 'findAll()'
> which I would like to iterate over the results and
> display them.
> 
> In my jsp I have tried:
> 
> <s:iterator value="roleDao.findAll()">
>             <s:property value="name"/>
>             <s:property value="description"/>
> </s:iterator>
> 
> But I don't think that would work since roleDao
> isn't on the stack?
> 
> I've tried declaring:
> <s:bean
> name="com.paul.project.system.dao.impl.RoleDaoImpl" 
> id="roleBean"/>
> 
> <s:iterator value="roleBean.findAll"">
> etc.etc.
> 
> Basically I have a userform for an admin, that has a
> UserModel on the stack. Part of the userform though
> is selecting which user roles (RoleModel) to add the
> user to and I need to render all available roles. I
> think my issue is strictly syntax? I hope someone
> could point me in the right direction?
> 
> Regards,
> Paul


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org