Re: T5.0.6 I'm lost after upgrade T5

2007-11-04 Thread Michael Bernagou
I already tried to add the setters, without success. But Itried to access
Home and I got an error regarding my Logger :



My Home.java
public class Home {
...

  @Inject
  private Logger logger;

  String refreshList() {
try {
  logger.debug(Processiong refreshList...);
  users = applicationService.getUserList().getUserList();
  logger.debug(User lists set to page.);
}
catch (PapoException pe) {
  logger.error(Failed to get the user list. Nothing set in the page!);
  return FAILURE;
}
return SUCCESS;
  }
}

And now I have this error :
org.apache.tapestry.internal.services.TransformationException: Error
obtaining injected value for field papo.pages.Home.logger: No service
implements the interface org.apache.log4j.Logger.

I thought Tapestry know everything about logging and in the documentation it
says   @Inject private Logger logger; was enought.

Usually I used log4j  like that :
private static Logger logger = Logger.getLogger(MyClass.class.getName());
but Howard told me in a old and previous mailing to not use the logging like
that... So, how to use the logger in T5?


2007/11/4, Nick Westgate [EMAIL PROTECTED]:

 Try adding setters to your fields.

 Cheers,
 Nick.


 Josh Canfield wrote:
@InjectPage
private Home home;
 
 
  The error message seems a little strange, but the code above is
 injecting a
  page called Home. Does that page load correctly if accessed directly?
 
  Josh
 
  On 11/3/07, Michael Bernagou [EMAIL PROTECTED] wrote:
  Everything worked perfectly, but since I upgraded to T5.0.6, it fails
 for
  an
  understandable reason!
 
  I replaced my html by tml and placed them in the right place. I upgrade
  log4j to get the latest and add the new logging api (to avoid runtime
  error).
  The thing is really strange...
 
  My Start.tml
 
  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
  html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
  head
  titlePaper and Pen Online - Identification/title
  /head
  body
  p style=color:red;b${message}/b/p
  t:form tracker=login
t:errors/
t:parameter name=password
  t:label for=password/
  t:passwordfield t:id=password t:validate=required value=
  login.password/
/t:parameter
  /t:form
  pSi vous n'avez pas encore de compte, t:pagelink
  page=Registercrees-en
  un!!/t:pagelink/p
  /body
  /html
 
 
  My Start.java
 
  public class Start {
private static final String SUCCESS = Home;
private static final String FAILURE = Start;
 
@ApplicationState
private Login login;
public Login getLogin() { return login; }
 
@Persist
private String message;
public String getMessage() { return message; }
 
@ApplicationState
private User user;
 
@InjectPage
private Home home;
 
@Inject
private UserService userService;
 
@Inject
private ApplicationService applicationService;
 
String onSuccess() {
  message = null;
 
  try {
user = userService.getAuthenticatedUser(login.getLogin(),
  login.getPassword());
if (user != null) {
  home.setUser(user);
  UserLite userLite = new UserLite(user.getLogin());
  applicationService.makeOnline(userLite);
  home.setUsers(applicationService.getUserList().getUserList());
}
else {
  message = Login ou Password inconnue. L'identification a
  échoué.;
  return FAILURE;
}
  }
  catch (PapoException pe) {
message = La procedure d'identification a rencontré un probleme
  !!;
return FAILURE;
  }
  return SUCCESS;
}
  }
 
  And the error :
 
  Could not convert 'message' into a component parameter binding:
  java.lang.NoClassDefFoundError: papo/pages/Home
  location context:Start_fr.tml, line 8, column 363html xmlns:t=
  http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
 4head5titlePaper
  and Pen Online - Identification/title6/head7body8p
  style=color:red;b${message}/b/p9t:form
  tracker=login10t:errors/
  11 t:parameter name=password12 t:label
  for=password/13t:passwordfield t:id=password
  t:validate=required value=
  login.password/So, the tml is found, read, interpreted but for a
 reason
  I
  don't understand it refer to my class Home which is in the same package
  than
  my class Start.
  I have a Register page (tml + java) and it give me exactly the same
 error!
 
  No error at runtime, no compilation error (Inject are the new Inject,
 for
  example).
 
  Thanks
 
  --
  Michael Bernagou
  Java Developper
 
 
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Michael Bernagou
Java Developper


Re: T5.0.6 I'm lost after upgrade T5

2007-11-04 Thread Michael Bernagou
Ok, I got it It was not the right import ;o)
I used this : import org.apache.log4j.Logger; instead of import
org.slf4j.Logger;

Thanks :)

2007/11/4, Michael Bernagou [EMAIL PROTECTED]:

 I already tried to add the setters, without success. But Itried to access
 Home and I got an error regarding my Logger :



 My Home.java
 public class Home {
 ...

   @Inject
   private Logger logger;

   String refreshList() {
 try {
   logger.debug(Processiong refreshList...);
   users = applicationService.getUserList().getUserList();
   logger.debug(User lists set to page.);
 }
 catch (PapoException pe) {
   logger.error(Failed to get the user list. Nothing set in the
 page!);
   return FAILURE;
 }
 return SUCCESS;
   }
 }

 And now I have this error :
 org.apache.tapestry.internal.services.TransformationException: Error
 obtaining injected value for field papo.pages.Home.logger: No service
 implements the interface org.apache.log4j.Logger.

 I thought Tapestry know everything about logging and in the documentation
 it says   @Inject private Logger logger; was enought.

 Usually I used log4j  like that :
 private static Logger logger = Logger.getLogger(MyClass.class.getName());
 but Howard told me in a old and previous mailing to not use the logging
 like that... So, how to use the logger in T5?


 2007/11/4, Nick Westgate [EMAIL PROTECTED]:
 
  Try adding setters to your fields.
 
  Cheers,
  Nick.
 
 
  Josh Canfield wrote:
 @InjectPage
 private Home home;
  
  
   The error message seems a little strange, but the code above is
  injecting a
   page called Home. Does that page load correctly if accessed directly?
  
   Josh
  
   On 11/3/07, Michael Bernagou [EMAIL PROTECTED] wrote:
   Everything worked perfectly, but since I upgraded to T5.0.6, it fails
  for
   an
   understandable reason!
  
   I replaced my html by tml and placed them in the right place. I
  upgrade
   log4j to get the latest and add the new logging api (to avoid runtime
   error).
   The thing is really strange...
  
   My Start.tml
  
   !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
   html xmlns:t= http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
  
   head
   titlePaper and Pen Online - Identification/title
   /head
   body
   p style=color:red;b${message}/b/p
   t:form tracker=login
 t:errors/
 t:parameter name=password
   t:label for=password/
   t:passwordfield t:id=password t:validate=required value=
   login.password/
 /t:parameter
   /t:form
   pSi vous n'avez pas encore de compte, t:pagelink
   page=Registercrees-en
   un!!/t:pagelink/p
   /body
   /html
  
  
   My Start.java
  
   public class Start {
 private static final String SUCCESS = Home;
 private static final String FAILURE = Start;
  
 @ApplicationState
 private Login login;
 public Login getLogin() { return login; }
  
 @Persist
 private String message;
 public String getMessage() { return message; }
  
 @ApplicationState
 private User user;
  
 @InjectPage
 private Home home;
  
 @Inject
 private UserService userService;
  
 @Inject
 private ApplicationService applicationService;
  
 String onSuccess() {
   message = null;
  
   try {
 user = userService.getAuthenticatedUser(login.getLogin(),
   login.getPassword());
 if (user != null) {
   home.setUser(user);
   UserLite userLite = new UserLite(user.getLogin ());
   applicationService.makeOnline(userLite);
   home.setUsers(applicationService.getUserList
  ().getUserList());
 }
 else {
   message = Login ou Password inconnue. L'identification a
   échoué.;
   return FAILURE;
 }
   }
   catch (PapoException pe) {
 message = La procedure d'identification a rencontré un
  probleme
   !!;
 return FAILURE;
   }
   return SUCCESS;
 }
   }
  
   And the error :
  
   Could not convert 'message' into a component parameter binding:
   java.lang.NoClassDefFoundError: papo/pages/Home
   location context:Start_fr.tml, line 8, column 363html xmlns:t=
   http://tapestry.apache.org/schema/tapestry_5_0_0.xsd
  4head5titlePaper
   and Pen Online - Identification/title6/head7body8p
   style=color:red;b${message}/b/p9t:form
   tracker=login10t:errors/
   11 t:parameter name=password12 t:label
   for=password/13t:passwordfield t:id=password
   t:validate=required value=
   login.password/So, the tml is found, read, interpreted but for a
  reason
   I
   don't understand it refer to my class Home which is in the same
  package
   than
   my class Start.
   I have a Register page (tml + java) and it give me exactly the same
  error!
  
   No error at runtime, no compilation error (Inject are the new Inject,
  for
   example).
  
   Thanks
  
   --
   Michael Bernagou
   Java Developper
  
  
  
  

Re: Initialize objects - like in HttpServlet's init()

2007-11-04 Thread Filip S. Adamsen

llonely skrev:

Hi all,



Hi,


I am new on Tapestry and try to become familiar with it, mostly through this
forum and the official site. I am trying to migrate a simple servlet into
tapestry.


While this is a logical approach to trying out something new, Tapestry 
generally works better if you rewrite your code instead of migrating - 
so many things are done differently in Tapestry compared to servlets.



I find myself search for days for tasks that seem simple. Currently I am
trying to achieve the following:

a) Load some init parameters, located in web.xml. I want to (pre)initialize
them once and have access to them from all pages. In a simple servlet i load
them inside servlet's init() method using ServletConfig. How can I do in on
Tapestry?


I'd suggest using symbols for that:
http://tapestry.apache.org/tapestry5/tapestry-ioc/symbols.html


b) Similarly with above, I want to load a datasource (configured on tomcat),
only once and use it on all my pages. In a simple servlet I do a Context
lookup in init() method and have the datasource object available. 


You should definitely create a service for that. If you expose a getter 
to your datasource as part of the service interface you can use the 
PropertyShadowBuilder to expose the datasource as its own service, ready 
for easy injection into your pages:

http://tapestry.apache.org/tapestry5/tapestry-ioc/shadow.html


So to sum up the question is: how do I preload an object once, and have it
available
for all pages (not inside a session)?


Services. : )


I am using version 5.0.6

Thanks in advance


Hope this helps.

-Filip

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: binding id to a property (not a liteal)

2007-11-04 Thread Filip S. Adamsen

Hi,

Try t:select t:id=tapestry-id t:clientid=client-id .../.

You can then refer to the component through its tapestry-id and get 
its client-id through getClientId(). : )


-Filip

Marc A. Donis skrev:

Thanks, but when I put:

t:select t:id=${prop:selectId} ... /

in the template, the generated html then looks like this:

select id=${prop:selectId} name=${prop:selectId}

Again, I can't seem to prevent it from interpreting the id as a literal 
string.


However, if i put:

t:select t:idX=${prop:selectId} ... /

in the template, the generated html then looks like this:

select id=select idX=id_01 name=select

So... it really seems that id is special.  This is troublesome, since it 
is impossible (as far as I can tell) to reference an element in a 
component from outside of that component.


What to do??


- Original Message - From: Christoph Jaeger 
[EMAIL PROTECTED]

To: Tapestry users users@tapestry.apache.org
Sent: Thursday, November 01, 2007 19:05
Subject: Re: binding id to a property (not a liteal)



Try t:select t:id=${prop:refFieldId} ...

Christoph

Marc A. Donis wrote:

Hi again,

I am trying to get a select component to take an id from its component
class, rather than having it staticly defined in the tml.
It seems, however, that no matter what I try, the id is always
interpreted as a literal string.

e.g.:

t:select t:id=prop:refFieldId ... etc

which I would expect to get the id from an accessor named
getRefFieldId() in the component class, but instead it generates the id
as prop:refFieldId.

Is id special in this way?  If so, is there some sort of workaround for
this?

What I want is something like this:

t:label t:for=selectField${message:label1}/t:label
t:ReferenceDropDown t:selectId=literal:selectField ... etc /

and then, ReferenceDropDown.tml:

t:select t:id=prop:selectId  ... etc /

in order to tie the label to the select which is inside my own
ReferenceDropDown component.

Thoughts?

Thanks again,
Marc


-
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]





-
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]



Re: [T5.06] component action context does not support utf8!

2007-11-04 Thread Filip S. Adamsen

Hi Donyee,

Have a look at this, it *might* help:
http://wiki.apache.org/tapestry/Tapestry5Utf8Encoding

-Filip

Donyee skrev:

I use the actionLink, and the context contains utf8 string,
and the onUpdate(string str)...
the str is ???, encoding wrong!



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5.06] component action context does not support utf8!

2007-11-04 Thread Donyee
I got the answer from the sources, because the
ComponentActionDispatcher.java
decode the url with a default charset which doesn't support utf-8!
I'm now trying to create a new dispatcher to solve this question.

2007/11/4, Filip S. Adamsen [EMAIL PROTECTED]:

 Hi Donyee,

 Have a look at this, it *might* help:
 http://wiki.apache.org/tapestry/Tapestry5Utf8Encoding

 -Filip

 Donyee skrev:
  I use the actionLink, and the context contains utf8 string,
  and the onUpdate(string str)...
  the str is ???, encoding wrong!
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
徐 依伟


Re: [T5.06] component action context does not support utf8!

2007-11-04 Thread Filip S. Adamsen
That's odd, to me it looks like the default charset is the one from
org.apache.commons.codec.net.URLCodec - and that one uses UTF-8...

-Filip

Donyee skrev:
 I got the answer from the sources, because the
 ComponentActionDispatcher.java
 decode the url with a default charset which doesn't support utf-8!
 I'm now trying to create a new dispatcher to solve this question.
 
 2007/11/4, Filip S. Adamsen [EMAIL PROTECTED]:
 Hi Donyee,

 Have a look at this, it *might* help:
 http://wiki.apache.org/tapestry/Tapestry5Utf8Encoding

 -Filip

 Donyee skrev:
 I use the actionLink, and the context contains utf8 string,
 and the onUpdate(string str)...
 the str is ???, encoding wrong!

 -
 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]



T5: component with template

2007-11-04 Thread Angelo Chen

Hi,

It is said that component can have a template, and I understand the layout
type component has a template, I'm now looking for a simple/basic component
with template but not the layout type, something that can be included in a
page like:

t:my_simple_one /

is there any?

A.C.
-- 
View this message in context: 
http://www.nabble.com/T5%3A-component-with-template-tf4746951.html#a13573655
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



typo in the documentation

2007-11-04 Thread Michael Courcy

Hi

I think there's a small typo in the documentation in

http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html

In the section : Injecting dependencies

==

For example, let's say the Indexer needs a JobScheduler to control when 
it executes, and a FileSystem to access files and store indexes.


 public static Indexer build(JobScheduler scheduler, FileSystem fileSystem)
 {
   IndexerImpl indexer = new IndexerImpl(fileSystem);
 
   scheduler.scheduleDailyJob(indexer);
 
   return indexer;

 }

Here we've annotated the parameters of the service builder method to 
identify what service to inject for that parameter.



But there's no anotation at all so I think the author meant

==

For example, let's say the Indexer needs a JobScheduler to control when 
it executes, and a FileSystem to access files and store indexes.


 public static Indexer build(@InjectService JobScheduler scheduler, 
@InjectService FileSystem fileSystem)
 {
   IndexerImpl indexer = new IndexerImpl(fileSystem);
 
   scheduler.scheduleDailyJob(indexer);
 
   return indexer;

 }

Here we've annotated the parameters of the service builder method to 
identify what service to inject for that parameter.



Michael.


/ /




Re: Initialize objects - like in HttpServlet's init()

2007-11-04 Thread thanos

Thanks guys!
Will go through the services documentation

BR
Thanos

Filip S. Adamsen-2 wrote:
 
 llonely skrev:
 Hi all,
 
 
 Hi,
 
 I am new on Tapestry and try to become familiar with it, mostly through
 this
 forum and the official site. I am trying to migrate a simple servlet into
 tapestry.
 
 While this is a logical approach to trying out something new, Tapestry 
 generally works better if you rewrite your code instead of migrating - 
 so many things are done differently in Tapestry compared to servlets.
 
 I find myself search for days for tasks that seem simple. Currently I am
 trying to achieve the following:
 
 a) Load some init parameters, located in web.xml. I want to
 (pre)initialize
 them once and have access to them from all pages. In a simple servlet i
 load
 them inside servlet's init() method using ServletConfig. How can I do in
 on
 Tapestry?
 
 I'd suggest using symbols for that:
 http://tapestry.apache.org/tapestry5/tapestry-ioc/symbols.html
 
 b) Similarly with above, I want to load a datasource (configured on
 tomcat),
 only once and use it on all my pages. In a simple servlet I do a Context
 lookup in init() method and have the datasource object available. 
 
 You should definitely create a service for that. If you expose a getter 
 to your datasource as part of the service interface you can use the 
 PropertyShadowBuilder to expose the datasource as its own service, ready 
 for easy injection into your pages:
 http://tapestry.apache.org/tapestry5/tapestry-ioc/shadow.html
 
 So to sum up the question is: how do I preload an object once, and have
 it
 available
 for all pages (not inside a session)?
 
 Services. : )
 
 I am using version 5.0.6
 
 Thanks in advance
 
 Hope this helps.
 
 -Filip
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Initialize-objects---like-in-HttpServlet%27s-init%28%29-tf4743945.html#a13574817
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Newbie: Help me on using Select Component

2007-11-04 Thread Eko S.W.
Dear Community,

I am not able to use Select Component
And I am not succeed on following Select in Tap Wiki,
such as in
http://wiki.apache.org/tapestry/Tapestry5SelectObject?highlight=%28select%29
That is the closest tutorial, but I am not suceed on it

The problem is, the Select in HTML doesn't show up it contents

What happened?
I think I already follow the article
-- 
Best wishes,
Eko SW
http://swdev.blogs.friendster.com/my_blog/


Re: T5: A component returning StreamResponse?

2007-11-04 Thread Britske

Not sure if you solved this already, but anyway:  
Regarding the exception you got: 


Borut Bolčina-2 wrote:
 
 then I get Exception:
 Component ui/dialog/JQModalAjax does not contain an embedded component
 with
 id 'wizardStep1'.
 
 which is true, as I don't have WizardStep1 in my ui/dialog/JQModalAjax.tml
 

As a workaround it's possible to define Wizarstep1 in a block in
JQModalAjax.tml, like so: 

t:block
t:WizardStep1 id=wizardstep1/
/t:block

Since the wizardstep component is included in the block it isn't rendered in
JQModalAjax.tml unless explicitly asked to do so. Now you should be able to
do what you wanted without exceptions.

Cheers,
Geert-Jan





Borut Bolčina-2 wrote:
 
 Hello,
 
 I would like to create an ajax dialog (actually a series of them to act as
 a
 wizard). The content of the dialog should change according to user
 interaction and therefore create a series of steps. If this wizard is
 going
 to have 3 steps then 3 ajax requests for dialog content would be made.
 
 I would like each ajax request to call (different) T5 component returning
 HTML fragment.
 
 I am using jQuery to make a request
 
 * TEMPLATE **
 script
 $().ready(function() {
   $('#ex2').jqm({ajax: '${thelink}'}).jqmShow();
 });
 /script
 
 * CLASS *
 public String getTheLink() {
 Link l = _resources.createActionLink(myAction, false);
 return l.toURI();
 }
 
 StreamResponse onMyAction() {
 String htmlFragment = pparagraph bold/p;
 return new TextStreamResponse(text/html, htmlFragment);
 }
 
 
 I would like the htmlFragment to be generated by T5 component for example
 WizardStep1.
 
 If I declare a component in the class above:
 @Component
 private WizardStep1 wizardStep1;
 
 and modify method onMyAction like this
 
 StreamResponse onMyAction() {
 wizardStep1.setMessage(hello);
 return (StreamResponse) wizardStep1;
 }
 
 then I get Exception:
 Component ui/dialog/JQModalAjax does not contain an embedded component
 with
 id 'wizardStep1'.
 
 which is true, as I don't have WizardStep1 in my ui/dialog/JQModalAjax.tml
 
 
 Any suggestions?
 
 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-A-component-returning-StreamResponse--tf4600101.html#a13575865
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 how to control login state

2007-11-04 Thread lyifan

Thanks a lot everyone. Finally the BasePase way works

But the dispatcher way still doesn't work.



lyifan wrote:
 
 I am a 100% new user for tapestry. Currently I'm working on 5.0.5, but I
 got stuck from the just beginning.
 
 I want to implement a kind of user access controller. All the pages,
 excepts for the login page, can be accessed by authenticated users only.
 users who hasn't passed the authentication will be redirected to the login
 page to input their user name and password, and then, if the user name and
 password are correct, they will see the page they want
 
 I think this is a very very simple thing to do.But after a few days
 working, I am very frustrated.
 
 Firstly, I've tried the onActivate method. My code looks like below:
 
 class BasePage {
 @ApplicationState
  private UserIdentity _userIdentity;
  private boolean _userIdentityExists;
 
 Object onActivate() {
   
  if( !_userIdentityExists)
  return Login; //Login is my login page
 
  return null;
 }
 }
 
 And the I visited http://localhost:8080/myapp(default page is start), I
 got a blank empty page. There is nothing at all on the browser. But I can
 see the login page when I went to http://localhost:8080/myapp/login
 
 After that I found an article at
 http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher. According
 to this, I created my dispatcher. But I found ASO doesn't work in my
 dispatcher class.
 boolean _myIdentityExists always be false.
 
 And if I contribute it use before:PageRender, the dispatch method would
 not be invoked then I visit the default start page. I had to use
 before:RootPath. Following it my dispatcher class code:
 
 public class SessionController implements Dispatcher {
 
   @ApplicationState
   private MyIdentity _myIdentity;
   private boolean _myIdentityExists;
   
   public SessionController() {
   System.out.println(SessionController: SessionController 
 created.);
   }
 
   public boolean dispatch(Request request, Response response) throws
 IOException {
   System.out.println(Requesting  + request.getPath());
 
   if (! _myIdentityExists ) { // _myIdentityExists always be false
   if( _myIdentity == null ) { // here MyIdentity won't be 
 created
   _myIdentity = new MyIdentity(); // I have to 
 create it by myself.
   System.out.println(SessionController: Identity 
 does not exist.);
 response.sendRedirect(login); 
return true; // this works, I can see the
 login page correctly.
   }else
   System.out.println(SessionController: Identity 
 exists.);
   }
   
   return false;
   }
 }
 
 and here is the code in AppModule:
 public void
 contributeMasterDispatcher(OrderedConfigurationDispatcher configuration,
 @InjectService(SessionController) Dispatcher
 sessionController) {
 configuration.add(SessionController, sessionController,
 before:PageRender);
   }
 
 
 before:PageRender and before:Asset do not call dispatch method,
 before:RootPath does
 
 I set the session timeout to 1 min in the web.xml. 
   session-config
   session-timeout1/session-timeout
   /session-config
 
 After 1 min, I came to the start page.supposedly, I would be redirected to
 the login page because session is timeout. But I could still visit the
 start page, which meas _myIdentity is still in the Session after the
 timeout. Is it a bug or I shouldn't create it by myself?
 

-- 
View this message in context: 
http://www.nabble.com/T5-how-to-control-login-state-tf4744201.html#a13576094
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5.0.6 : How to format a number in a TextField

2007-11-04 Thread Shing Hing Man
I have extended DoubleTranslator.java and 
override the method DoubleTranslator.toClient to
format the output.


public class MyDoubleTranslator extends
DoubleTranslator{

@Override
public String toClient(Double value) {
String returnValue = null;

DecimalFormat formatter = new DecimalFormat(0.#);
if (value==null){
returnValue = ;
}
else{
returnValue = formatter.format(value);
}
return returnValue;
}

}

In AppModule, I added 

 public static void contributeTranslatorSource(
MappedConfigurationString, Translator
configuration)
{
  
configuration.add(myDouble, new
MyDoubleTranslator());
}

Now I just add  translate=translate:myDouble
to t:textField to have the displayed number
formatted . The above works. But the format pattern
#.0 is 
hard coded.  

Is there anyway to do something like 
 translate=translate:myDouble,pattern=#.0 ?

Thanks in advance for any assistance!

Shing








--- Shing Hing Man [EMAIL PROTECTED] wrote:

 In Tap 4, I can use translator:number,pattern=0.#
 (which used NumberTranslator.java)
 to format the numeric value  in a TextField
 component.
 
 How can this be done in T5.0.6 ? 
 
 I have checked the  T5.0.6 API, it looks as though
 T5.0.6 has no
 NumberTranslator.java .
 
 Must I implement a NumberTranslator ?
 
 Shing
 
 Home page : http://www.lombok.demon.co.uk/
 
 
 
  

___
 
 Want ideas for reducing your carbon footprint? Visit
 Yahoo! For Good 

http://uk.promotions.yahoo.com/forgood/environment.html
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 


Home page : http://www.lombok.demon.co.uk/



  ___
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



After upgrade to T4.1.3: clientValidationEnabled together with PropertySelection does not work any more

2007-11-04 Thread spot_

Hi 

after upgrading my webapp from Tapestry 4.1.2 to 4.1.3 form components with
clientValidationEnabled attribute set to true, that contain
PropertySelection input fields (StringPropertySelectionModel (first array
entry is an emtpy String: )) with validators set to 'required' do not work
any more. After pressing the submit button, an empty validation popup is
shown (both in firefox and ie) and the the submit is not executed.

Any help on that?

Thanks in advance
Christoph
-- 
View this message in context: 
http://www.nabble.com/After-upgrade-to-T4.1.3%3A-clientValidationEnabled-together-with-PropertySelection-does-not-work-any-more-tf4748161.html#a13576989
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



NPE loading default.css?

2007-11-04 Thread Chris Campbell
Hi, new to Tapesty 5 here, using 5.0.6

I am setting up a simple webapp along the lines of the tutorial.
Running in tomcat, I get the following error. The strange thing is
that the tutorial itself runs fine in the same environment. It seems
that the TapestryModule cannot find a default asset ? I can see the
default.css in the core jar file and it appears to be in the correct
place... any ideas?

java.lang.NullPointerException
$Request_1160c0a2185.getContextPath($Request_1160c0a2185.java)
$Request_1160c0a213b.getContextPath($Request_1160c0a213b.java)

org.apache.tapestry.internal.services.ClasspathAssetAliasManagerImpl.toClientURL(ClasspathAssetAliasManagerImpl.java:87)

$ClasspathAssetAliasManager_1160c0a2181.toClientURL($ClasspathAssetAliasManager_1160c0a2181.java)

org.apache.tapestry.internal.services.ClasspathAssetFactory.buildClientURL(ClasspathAssetFactory.java:85)

org.apache.tapestry.internal.services.ClasspathAssetFactory.clientURL(ClasspathAssetFactory.java:60)

org.apache.tapestry.internal.services.ClasspathAssetFactory.access$000(ClasspathAssetFactory.java:34)

org.apache.tapestry.internal.services.ClasspathAssetFactory$1.toClientURL(ClasspathAssetFactory.java:103)

org.apache.tapestry.internal.services.PageRenderSupportImpl.addStylesheetLink(PageRenderSupportImpl.java:114)

org.apache.tapestry.services.TapestryModule$19.setup(TapestryModule.java:1484)

org.apache.tapestry.services.TapestryModule$10.setup(TapestryModule.java:1048)

$PageRenderInitializer_1160c0a217e.setup($PageRenderInitializer_1160c0a217e.java)

org.apache.tapestry.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:32)

$PageMarkupRenderer_1160c0a217b.renderPageMarkup($PageMarkupRenderer_1160c0a217b.java)

org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:71)

$PageResponseRenderer_1160c0a214f.renderPageResponse($PageResponseRenderer_1160c0a214f.java)

org.apache.tapestry.internal.services.DefaultRequestExceptionHandler.handleRequestException(DefaultRequestExceptionHandler.java:60)

$RequestExceptionHandler_1160c0a2145.handleRequestException($RequestExceptionHandler_1160c0a2145.java)

org.apache.tapestry.services.TapestryModule$2.service(TapestryModule.java:697)
$RequestHandler_1160c0a2149.service($RequestHandler_1160c0a2149.java)

org.apache.tapestry.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:84)
$RequestHandler_1160c0a2149.service($RequestHandler_1160c0a2149.java)

org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:97)

org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:88)

org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:77)

org.apache.tapestry.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:110)
$RequestHandler_1160c0a2149.service($RequestHandler_1160c0a2149.java)
$RequestHandler_1160c0a2141.service($RequestHandler_1160c0a2141.java)

org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:1086)

$HttpServletRequestHandler_1160c0a2140.service($HttpServletRequestHandler_1160c0a2140.java)
org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:135)

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: NPE loading default.css?

2007-11-04 Thread Chris Campbell
Never mind, I found that my AppModule was failing.

Chris Campbell wrote:
 Hi, new to Tapesty 5 here, using 5.0.6
 
 I am setting up a simple webapp along the lines of the tutorial.
 Running in tomcat, I get the following error. The strange thing is
 that the tutorial itself runs fine in the same environment. It seems
 that the TapestryModule cannot find a default asset ? I can see the
 default.css in the core jar file and it appears to be in the correct
 place... any ideas?
 
 java.lang.NullPointerException
   $Request_1160c0a2185.getContextPath($Request_1160c0a2185.java)
   $Request_1160c0a213b.getContextPath($Request_1160c0a213b.java)
   
 org.apache.tapestry.internal.services.ClasspathAssetAliasManagerImpl.toClientURL(ClasspathAssetAliasManagerImpl.java:87)
   
 $ClasspathAssetAliasManager_1160c0a2181.toClientURL($ClasspathAssetAliasManager_1160c0a2181.java)
   
 org.apache.tapestry.internal.services.ClasspathAssetFactory.buildClientURL(ClasspathAssetFactory.java:85)
   
 org.apache.tapestry.internal.services.ClasspathAssetFactory.clientURL(ClasspathAssetFactory.java:60)
   
 org.apache.tapestry.internal.services.ClasspathAssetFactory.access$000(ClasspathAssetFactory.java:34)
   
 org.apache.tapestry.internal.services.ClasspathAssetFactory$1.toClientURL(ClasspathAssetFactory.java:103)
   
 org.apache.tapestry.internal.services.PageRenderSupportImpl.addStylesheetLink(PageRenderSupportImpl.java:114)
   
 org.apache.tapestry.services.TapestryModule$19.setup(TapestryModule.java:1484)
   
 org.apache.tapestry.services.TapestryModule$10.setup(TapestryModule.java:1048)
   
 $PageRenderInitializer_1160c0a217e.setup($PageRenderInitializer_1160c0a217e.java)
   
 org.apache.tapestry.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:32)
   
 $PageMarkupRenderer_1160c0a217b.renderPageMarkup($PageMarkupRenderer_1160c0a217b.java)
   
 org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:71)
   
 $PageResponseRenderer_1160c0a214f.renderPageResponse($PageResponseRenderer_1160c0a214f.java)
   
 org.apache.tapestry.internal.services.DefaultRequestExceptionHandler.handleRequestException(DefaultRequestExceptionHandler.java:60)
   
 $RequestExceptionHandler_1160c0a2145.handleRequestException($RequestExceptionHandler_1160c0a2145.java)
   
 org.apache.tapestry.services.TapestryModule$2.service(TapestryModule.java:697)
   $RequestHandler_1160c0a2149.service($RequestHandler_1160c0a2149.java)
   
 org.apache.tapestry.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:84)
   $RequestHandler_1160c0a2149.service($RequestHandler_1160c0a2149.java)
   
 org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:97)
   
 org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:88)
   
 org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:77)
   
 org.apache.tapestry.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:110)
   $RequestHandler_1160c0a2149.service($RequestHandler_1160c0a2149.java)
   $RequestHandler_1160c0a2141.service($RequestHandler_1160c0a2141.java)
   
 org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:1086)
   
 $HttpServletRequestHandler_1160c0a2140.service($HttpServletRequestHandler_1160c0a2140.java)
   org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:135)
 
 -
 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]



T5: Property binding

2007-11-04 Thread Christoph Jaeger
Hi,

Tapestry seems to only accept properties with getXxx() and setXxx()
accessor methods, or isXxx() for boolean values. This is ok when using
your own bean classes, but I just tried to output the number of entries
in a java.util.List using

${list.size}

in my .tml file (with a public List getList() method in the
corresponding java class), and I get an exception page with the
following error message:

Class java.util.List does not contain a property named 'size' (within
property expression 'list.size'). Available properties: empty.

This is because java.util.List does not provide a getSize() method, only
a size() method.

Is it a design decision to only go for getXxx() accessor methods, or
would you think about trying xxx() if getXxx() can not be found?

Christoph

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: Property binding

2007-11-04 Thread Michael Courcy

did you try ${list.size()} ?

Christoph Jaeger a écrit :

Hi,

Tapestry seems to only accept properties with getXxx() and setXxx()
accessor methods, or isXxx() for boolean values. This is ok when using
your own bean classes, but I just tried to output the number of entries
in a java.util.List using

${list.size}

in my .tml file (with a public List getList() method in the
corresponding java class), and I get an exception page with the
following error message:

Class java.util.List does not contain a property named 'size' (within
property expression 'list.size'). Available properties: empty.

This is because java.util.List does not provide a getSize() method, only
a size() method.

Is it a design decision to only go for getXxx() accessor methods, or
would you think about trying xxx() if getXxx() can not be found?

Christoph

-
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]



Re: T5: Property binding

2007-11-04 Thread Christoph Jaeger
I knew there had to be an easy solution :)

Thanks, works great.

Christoph

Michael Courcy wrote:
 did you try ${list.size()} ?
 
 Christoph Jaeger a écrit :
 Hi,

 Tapestry seems to only accept properties with getXxx() and setXxx()
 accessor methods, or isXxx() for boolean values. This is ok when using
 your own bean classes, but I just tried to output the number of entries
 in a java.util.List using

 ${list.size}

 in my .tml file (with a public List getList() method in the
 corresponding java class), and I get an exception page with the
 following error message:

 Class java.util.List does not contain a property named 'size' (within
 property expression 'list.size'). Available properties: empty.

 This is because java.util.List does not provide a getSize() method, only
 a size() method.

 Is it a design decision to only go for getXxx() accessor methods, or
 would you think about trying xxx() if getXxx() can not be found?

 Christoph

 -
 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]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to contribute a new Request Handler

2007-11-04 Thread Michael Courcy

Hi

I'm  really new to tapestry, and I was trying to contribute a new 
request Handler


So I follow the documentation and the example provided by the archetype

first I provide a builder for my RequestHandlerService :

public RequestFilter buildMichaelFilter(final Logger log){
   return new RequestFilter(){

   public boolean service(Request request, Response response, 
RequestHandler requestHandler) throws IOException {

   try{
   log.info(Mic before);
   return requestHandler.service(request, response);
   }finally{
   log.info(Mic after);
   }
   }
  
   };

   }


And then I contribute it :

public void contributeRequestHandler(OrderedConfigurationRequestFilter 
configuration,   
   @InjectService(MichaelFilter)

   RequestFilter michaelFilter,
   @InjectService(TimingFilter)
   RequestFilter timingFilter
   )
   {
   // Each contribution to an ordered configuration has a name, 
When necessary, you may
   // set constraints to precisely control the invocation order of 
the contributed filter
   // within the pipeline.   
  
   configuration.add(Michael, michaelFilter);

   configuration.add(Timing, timingFilter);
  
   }


And nothing is logged from the michaelFilter ... while the timingFilter 
keep on working like before.


I probably misunderstood something.

Any idea ?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Newbie: Help me on using Select Component

2007-11-04 Thread Angelo Chen

Hi Eko,

try this:

http://ac960.blogspot.com/2007/10/tapestry-5-using-select-component.html

that's where I keep my note about how to use Select in T5.

A.C.


Eko S.W. wrote:
 
 Dear Community,
 
 I am not able to use Select Component
 And I am not succeed on following Select in Tap Wiki,
 such as in
 http://wiki.apache.org/tapestry/Tapestry5SelectObject?highlight=%28select%29
 That is the closest tutorial, but I am not suceed on it
 
 The problem is, the Select in HTML doesn't show up it contents
 
 What happened?
 I think I already follow the article
 -- 
 Best wishes,
 Eko SW
 http://swdev.blogs.friendster.com/my_blog/
 
 

-- 
View this message in context: 
http://www.nabble.com/Newbie%3A-Help-me-on-using-Select-Component-tf4747705.html#a13578323
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



beaneditforms and email address

2007-11-04 Thread Michael Shoemaker
So I'm an expert Tapestry developer.  Okay, I've been using it for a  
few weeks part time on a side project :)


I'm loving the beaneditform but wonder why obvious validations like  
alpha, numeric and email were not included.  I realize that regular  
expressions can be used but then you would duplicate the expression on  
multiple domain objects if you had that situation causing a conflict  
with the DRY principal.  I'm probably missing something so feel free  
to tell me to shut up and RTFD if appropriate.  To be fair, I've done  
a fair amount of googling and didn't find anything.


Thanks in advance

Mike

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T5: disable javascript

2007-11-04 Thread Angelo Chen

Hi,

Is there a way to disable or exclude those default javascripts(that's around
200k in size)? I notice if there is form in a page T5 will include some
javascript files. I disable the browser's javascript and the page still
works with those validations done in the server, that means we don't really
need javascript for the form, right?

The reason I will disable the javascript is, when you load a page using
jQuery/Thickbox, if the page has form with javascript, it will fail, Firebug
reports 6 errors on those js files, I have to use pure html form now for
that so I can't use the onValidate event in the server side for validation,
any idea? Thanks,

A.C.
-- 
View this message in context: 
http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13581181
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: disable javascript

2007-11-04 Thread Angelo Chen

found a workaround on this, surround the body with div

div
body
/body
/div

T5 will not include javascript in the rendered page, but not sure if this
works with 5.06.


Angelo Chen wrote:
 
 Hi,
 
 Is there a way to disable or exclude those default javascripts(that's
 around 200k in size)? I notice if there is form in a page T5 will include
 some javascript files. I disable the browser's javascript and the page
 still works with those validations done in the server, that means we don't
 really need javascript for the form, right?
 
 The reason I will disable the javascript is, when you load a page using
 jQuery/Thickbox, if the page has form with javascript, it will fail,
 Firebug reports 6 errors on those js files, I have to use pure html form
 now for that so I can't use the onValidate event in the server side for
 validation, any idea? Thanks,
 
 A.C.
 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13581860
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tapestry 4.1.3 and hibernate integration

2007-11-04 Thread trainee24

Hi,
I am new to tapestry. I would like to ask is it possible for me to integrate
hibernate in Tapestry 4.1.3? Can you please
provide me some hints on how to start it.  Any help given will be greatly
appreciated. Thanks in advance.


Regards,
trainee24
-- 
View this message in context: 
http://www.nabble.com/Tapestry-4.1.3-and-hibernate-integration-tf4749870.html#a13581949
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: disable javascript

2007-11-04 Thread Kristian Marinkovic
hi angelo,

you reached a point where you have to digg a little deeper :)

in order to achieve what you want you'll have to 
provide your own DocumentScriptBuilder ( 5.0.5) 
or DocumentHeadBuilder (= 5.0.6)

please checkout the source and search for the class
you'll see it is not that complicated :)

g,
kris




Angelo Chen [EMAIL PROTECTED] 
05.11.2007 07:23
Bitte antworten an
Tapestry users users@tapestry.apache.org


An
users@tapestry.apache.org
Kopie

Thema
Re: T5: disable javascript








found a workaround on this, surround the body with div

div
body
/body
/div

T5 will not include javascript in the rendered page, but not sure if this
works with 5.06.


Angelo Chen wrote:
 
 Hi,
 
 Is there a way to disable or exclude those default javascripts(that's
 around 200k in size)? I notice if there is form in a page T5 will 
include
 some javascript files. I disable the browser's javascript and the page
 still works with those validations done in the server, that means we 
don't
 really need javascript for the form, right?
 
 The reason I will disable the javascript is, when you load a page using
 jQuery/Thickbox, if the page has form with javascript, it will fail,
 Firebug reports 6 errors on those js files, I have to use pure html form
 now for that so I can't use the onValidate event in the server side for
 validation, any idea? Thanks,
 
 A.C.
 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-disable-javascript-tf4749556.html#a13581860
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]