There is no need to define the property in .page
remove <property name="username"/>
Try injecting other simple beans. I know the code I gave you works
because I'm injecting spring beans in that way in one of my project and
those beans implement interfaces as well. Try to setup a very simple
project, and if you can't figure it out zip and send it to
[EMAIL PROTECTED] so that i can take a look at it.
Raul.
Nima Boustanian wrote:
Raul Raja Martinez wrote:
Not totally sure that I understand you but
Have you tried...
Home.java
@InjectObject("spring:personManager")
public abstract PersonManager getPersonManager();
public String getWhatever() {
getPersonManager().getPerson(1L).getWhateverThatReturnsString();
}
Home.html
<span jwcid="@Insert" value="ognl:whatever">replace text</span>
Nima Boustanian wrote:
Hey all
I've been looking at Tapestry4Spring as a way of integrating Tapestry
and Spring in a project but I'm having issues
with figuring out how it's done. The wiki
(http://wiki.apache.org/jakarta-tapestry/Tapestry4Spring) proposes
that you declare something along the lines of this in
applicationContext.xml
<beans>
<bean id="person" class="com.example.model.Person">
<property name="name">
<value>Nanda Firdausi</value>
</property>
</bean>
</beans>
and your Home.page
<page-specification class="org.apache.tapestry.html.BasePage">
<inject property="person" object="spring:person" />
</page-specification>
and finally Home.html grabs the bean value like this:
<span jwcid="@Insert" value="ognl:person.name" />
My problem is that the project I'm working with uses a DAO interface
to set and get properties from a bean so I'm having difficulties
grasping how to configure the three files above which I mentioned. To
get a Person object I'm required
to go via the PersonManager interface like this:
ApplicationContext ctx = new
FileSystemXmlApplicationContext("applicationContext-service.xml");
PersonManager pm = (PersonManager)ctx.getBean("personManager");
Person person = pm.getPerson(1L);
IPage resultPage = getResult();
PropertyUtils.write(resultPage, "username", person);
return resultPage;
And the PersonManager.java is just a regular interface:
public interface PersonManager {
public void setPersonDAO(PersonDAO dao);
public Person getPerson(Long id);
public Person getPersonByUsername(String username);
...etc
and lastly the applicationContext.xml
<bean id="personManager" parent="txProxyTemplate">
<property name="target">
<bean class="com.test.service.PersonManagerImpl">
<property name="personDAO" ref="personDAO"/>
</bean>
</property>
</bean>
So basically the question is - can I use a Tapestry4Spring
implementation even though I'm accessing my Spring beans through an
interface? If yes, what would my applicationContext.xml, Home.page
and Home.html look like?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Thanks for the help Raul - but Tapestry shows a blank screen (no error)
when I try to get the bean property.
Is there anything else I need to to other than:
//Home.java
public String getUsername() {
String username = getPersonManager().getPerson(1L).getUsername();
return username;
}
//Home.html
<span jwcid="@Insert" value="ognl:username">username</span>
//Home.page
<page-specification><property name="username"/></page-specification>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]