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]

Reply via email to