• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

integrating tapestry and Spring (long)

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am starting a project using Spring, Tapestry and Hibernate. I cannot get off the ground with the Spring/Tapestry part, as I am getting the following exception thrown from Tapestry.

org.apache.tapestry.ApplicationRuntimeException
Unable to update expression '<parsed expression>' of com.crosswind.mha.tapestry.pages.Home$Enhance_0@d5c653[Home] to com.crosswind.mha.services.AuthenticationService@161def0.

ognl.MethodFailedException
Method "setAuthenticationService" failed for object com.crosswind.mha.tapestry.pages.Home$Enhance_0@d5c653[Home]

java.lang.NoSuchMethodException
setAuthenticationService($Proxy9)

Any help would be appreciated. Hopefully I am doing something dumb.

Here is a simplified Home.java, Home.page and Home.html (using Howard's simple login example), all of which seem to do the right thing, per the "Integrating Tapestry and the Spring framework" paper by Colin Sampaleanu.

Home.java
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.crosswind.mha.tapestry.pages;

import com.crosswind.mha.entities.people.Person;
import com.crosswind.mha.services.AuthenticationService;
import com.crosswind.mha.services.AuthenticationServiceException;

import com.crosswind.mha.tapestry.util.Visit;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.html.BasePage;


/**
* Demonstration of very simple form support.
*
* @author Howard Lewis Ship
*/
public abstract class Home extends BasePage
{
// Abstract accessors provided by Tapestry in enhanced
// subclass. We only declare the accessors we need in code,
// but the properties are always read/write.

public abstract String getUserName();
public abstract String getPassword();
public abstract void setMessage(String message);

// our UserService implementation; will come from page definition
// public abstract UserService getUserService();

// our AuthenticationService implementation; will come from page definition
public abstract AuthenticationService getAuthenticationService();

private String errorMessage;

public void login(IRequestCycle cycle)
{
Person person;

person = validateLogin(getUserName(), getPassword());

if (person != null) {
Visit visit = (Visit) getVisit();
java.lang.String newPage = visit.getStartPage(person);
cycle.activate(newPage);
return;
}
setMessage(errorMessage);
}

private Person validateLogin(String userName, String password)
{
Person person = null;

try {
person = getAuthenticationService().authenticate(userName, password);
} catch (AuthenticationServiceException e) {
errorMessage = e.getMessage();
return null;
}
if (person == null) {
errorMessage = "Invalid user name or password.";
}
return person;
}
}

Home.html:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<html jwcid="@Shell" title="Login">
<body>

<span jwcid="@Conditional" condition="ognl:message">
<font color="red">
<span jwcid="@Insert" value="ognl:message">
Error Message
</span>
</font>
</span>

<p/>

<form jwcid="@Form" listener="ognl:listeners.login">

<table>
<tr>
<th>User Name:</th>
<td>
<input type="text" jwcid="@TextField"
value="ognl:userName"
size="30"/></td>
</tr>
<tr>
<th>Password:</th>
<td>
<input type="password" jwcid="@TextField"
value="ognl assword"
hidden="ognl:true"
size="30"/>
</td>
</tr>
<tr>
<td><input type="submit" value="Login"/></td>
</tr>
</table>

</form>


<hr/>
<p><a href="#" jwcid="@PageLink" page="Home">Return to Home page</a>.</p>
</body>
</html>


Home.page
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

<page-specification class="com.crosswind.mha.tapestry.pages.Home">

<property-specification name="message" type="java.lang.String"/>
<property-specification name="userName" type="java.lang.String"/>
<property-specification name="password" type="java.lang.String"/>

<property-specification name="authenticationService"
type="com.crosswind.mha.services.AuthenticationService">
global.appContext.getBean("authenticationService")
</property-specification>

</page-specification>
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Walt Whitman",

Welcome to JavaRanch. We don't have many rules here, but we do have a naming policy. One of the things that policy states is that obviously ficticious names are not allowed. Please edit your display name to comply with this policy. Thanks in advance, and we look forward to seeing you around the Ranch.
 
Dave Wellington
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Done.
 
Something about .... going for a swim. With this tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic