Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

Returning @InjectPage does not display set properties

Keith Bottner

2008-11-07

Replies: Find Java Web Hosting

Author LoginPost Reply
Design Problem: To have a single page that can be passed various
notifications instead of having tens if not hundreds of separate
notification pages that just display successful completion, errors, etc.

Our Solution: Was to use a @InjectPage in those pages and use setters
on the page to set the title and the message to be displayed and
return the @InjectPage from the onSuccess method.

Behavior Seen: The values are set on the @InjectPage properly and the
page is displayed but the values are not displayed.

And of course if someone knows of a more excepted pattern for handling
this type of problem then please feel free to share it.

Thanks in advance for any help, I am sure it is something small but I
have been looking at it so long I just can't find the problem.

Keith



Please see code below:

Page wanting to display Notification page:

class Test
{
 @InjectPage
 private Notification notificationPage;
...
 Object onSuccess()
 {
 ...
 notificationPage.setTitle("Enter your title here");
 notificationPage.setNotification("Here is the notification message");
...
 return notificationPage;
 }
...
}

Here is the Notification class.
public class Notification
{

 @Property
 private String title;
 
 @Property
 private String notification;
 
 public String getTitle()
 {
  return title;
 }
 
 public void setTitle( String title )
 {
  this.title = title;
 }

 public String getNotification()
 {
  return notification;
 }

 public void setNotification( String notification )
 {
  this.notification = notification;
 }  
}

And finally the notification template:

<html t:type="vf/MainLayout" t:title="${title}" t:showMainMenu="true"
 xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

<t:vf.wideBarlayout t:id="contentLayout" t:showBackground="false">
 <t:parameter name="innerBody">
   <p>
     ${notification}
   </p>
 </t:parameter>
</t:vf.wideBarlayout>

</html>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.