RE: T5 turn off form validation

2008-06-19 Thread Ezra Epstein
Simple: the form has no validation and Tapestry + Form ==> server
session ==> drop in scalability.  If I've doing 1M + logins / hour I
can't afford sessions.

-Original Message-
From: Sven Homburg [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 19, 2008 10:58 AM
To: Tapestry users
Subject: Re: T5 turn off form validation

what can that make sense for?

2008/6/19 Ezra Epstein <[EMAIL PROTECTED]>:

> How do I turn off form tracker / validation.  Not just client side but
> the whole thing?  Can I just use a plain HTML (not Tap) form?
>
>
>
>


-- 
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
http://chenillekit.googlecode.com

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



RE: T5: Keep case (upper or lower) in page names and links

2008-06-19 Thread Ezra Epstein
I know that.  But it doesn't have the same effect per the HTTP spec and
I'm orthodox.  

Back to the question: how can one inform Tapestry that when I give the
page name as "Login" and put a form on the page it should not change the
name in the URL to "login"?

-Original Message-
From: Sven Homburg [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 19, 2008 10:50 AM
To: Tapestry users
Subject: Re: T5: Keep case (upper or lower) in page names and links

"Login" or "login" has the same effect with tapestry

2008/6/19 Ezra Epstein <[EMAIL PROTECTED]>:

> I've got a page called "Login" (first char is uppercase).  There's a
> form on it.  When it posts back it takes me to "login" (lowercase)
which
> Tapestry treats as the same being case-insensitive.  That's fine for
> now, but I want to preserve case for the end user.  How do I tell
> Tapestry to send the user to "Login" and not "login"?
>
>


-- 
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
http://chenillekit.googlecode.com

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



T5: Keep case (upper or lower) in page names and links

2008-06-19 Thread Ezra Epstein
I've got a page called "Login" (first char is uppercase).  There's a
form on it.  When it posts back it takes me to "login" (lowercase) which
Tapestry treats as the same being case-insensitive.  That's fine for
now, but I want to preserve case for the end user.  How do I tell
Tapestry to send the user to "Login" and not "login"?



RE: T5 Sending a 302 redirect off-site from within a Form handler

2008-06-19 Thread Ezra Epstein
Thanks.  Where is that documented?

-Original Message-
From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 18, 2008 10:23 PM
To: Tapestry users
Subject: Re: T5 Sending a 302 redirect off-site from within a Form
handler

You should be able to simply return a java.net.URL.

On Wed, Jun 18, 2008 at 9:55 PM, Ezra Epstein
<[EMAIL PROTECTED]> wrote:
> I've got a simple form and an onSubmit() method.  When the form
> submission succeeds I want to redirect to another site (full URL) but
> can't figure out how to do that.
>
>
>
> I've tried:
>
>
>
>@Inject
>
>@Service("Response")
>
>private Response tapestryResponse;
>
>
>
>void onSubmit() {
>
>...
>
>
> tapestryResponse.sendRedirect(offsiteUrlString);
>
>...
>
>}
>
>
>
> No luck.  Also tried:
>
>
>
>@Inject
>
>//@Service("RequestGlobals")
>
>private RequestGlobals requestGlobals;
>
>
>
>void onSubmit() {
>
>...
>
>
>
requestGlobals.getHTTPServletResponse().sendRedirect(offsiteUrlString);
>
>
>...
>
>}
>
>
>
> L
>
> The redirect exception doesn't seem to have made it from Tap4 to T5.
> What is the magical incantation??
>
>
>
> Thx.
>
>
>
> Ezra E.
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

-
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 turn off form validation

2008-06-19 Thread Ezra Epstein
How do I turn off form tracker / validation.  Not just client side but
the whole thing?  Can I just use a plain HTML (not Tap) form?

 



T5 Sending a 302 redirect off-site from within a Form handler

2008-06-18 Thread Ezra Epstein
I've got a simple form and an onSubmit() method.  When the form
submission succeeds I want to redirect to another site (full URL) but
can't figure out how to do that.

 

I've tried:

 

@Inject

@Service("Response")

private Response tapestryResponse;

 

void onSubmit() {

...

 
tapestryResponse.sendRedirect(offsiteUrlString);  

...

}

 

No luck.  Also tried:

 

@Inject

//@Service("RequestGlobals")

private RequestGlobals requestGlobals;

 

void onSubmit() {

...

 
requestGlobals.getHTTPServletResponse().sendRedirect(offsiteUrlString);


...

}

 

L

The redirect exception doesn't seem to have made it from Tap4 to T5.
What is the magical incantation??  

 

Thx.

 

Ezra E.



Re: T5 create a grid with columns dynamics?

2007-11-19 Thread Ezra Epstein
There is no requirement that there be a class.  You can just create your own 
implementation of BeanModel and do whatever you choose.  BeanModel is an 
interface.

Cristian Gonzalo Gary <[EMAIL PROTECTED]> wrote: 
For each name in column needs an attribute of a class.
I need to create a grid, with column names that are not associated with a
class











Vashon-Ez wrote:
> 
> Use the 'model' attribute of the grid to specify a model for the rows. 
> Then in your backing Java class create the model - e.g., on the
> pageLoaded() event, or onActivate() or wherever.  E.g.,
> 
> @Retain
> private BeanModel _model;
> 
> void pageLoaded() {
> _model = _beanModelSource.create(  YOUR_JAVA_CLASS.class, true,
> _resources);
> 
> _model.remove(" NAME_OF_PROPERTY_TO_REMOVE ");
> _model.remove(" NAME_OF_PROPERTY_TO_ADD");
>  
> // Add an "Actions" property / column that does not pull data from
> the bean
>  _model.add("actions", null);
> }
> 
> public BeanModel getModel() {
> return _model;
> }
> 
> 
> You can also create your own BeanModel implementation that stores property
> names however you choose and does with them whatever you want...
> 
> HTH,
> 
> 
> Cristian Gonzalo Gary  wrote: 
> i need to show many column  , every column is  asociated to  an  atribute 
> from objects inside a list. and  the value of this columns is from another
> source list. (i hope you understand better my problem )
> 
> 
> Thanks , Gracias.
> 
> 
> 
> 
> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/T5-create-a-grid-with-columns-dynamics--tf4832954.html#a13836081
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5-create-a-grid-with-columns-dynamics--tf4832954.html#a13844429
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 create a grid with columns dynamics?

2007-11-19 Thread Ezra Epstein
Use the 'model' attribute of the grid to specify a model for the rows.  Then in 
your backing Java class create the model - e.g., on the pageLoaded() event, or 
onActivate() or wherever.  E.g.,

@Retain
private BeanModel _model;

void pageLoaded() {
_model = _beanModelSource.create(  YOUR_JAVA_CLASS.class, true, 
_resources);

_model.remove(" NAME_OF_PROPERTY_TO_REMOVE ");
_model.remove(" NAME_OF_PROPERTY_TO_ADD");
 
// Add an "Actions" property / column that does not pull data from the 
bean
 _model.add("actions", null);
}

public BeanModel getModel() {
return _model;
}


You can also create your own BeanModel implementation that stores property 
names however you choose and does with them whatever you want...

HTH,


Cristian Gonzalo Gary <[EMAIL PROTECTED]> wrote: 
i need to show many column  , every column is  asociated to  an  atribute 
from objects inside a list. and  the value of this columns is from another
source list. (i hope you understand better my problem )


Thanks , Gracias.






-- 
View this message in context: 
http://www.nabble.com/T5-create-a-grid-with-columns-dynamics--tf4832954.html#a13836081
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] tapestry-spring and WebApplicationContext

2007-11-19 Thread Ezra Epstein
And your web.xml file has:


  
org.springframework.web.context.ContextLoaderListener


And if the application context .xml files aren't in the standard place and 
named the standard way you've also included:


contextConfigLocation



?

Steph <[EMAIL PROTECTED]> wrote: I've tried this but my WebApplicationContext 
is null ...

Stephane


SergeEby a �crit :
> Hi,
>
> Just import and inject the WAC in your page:
>
> import org.springframework.web.context.WebApplicationContext;
>
> class Foo {
>
> ...
>  @Inject
>  private WebApplicationContext  wac;
>
> ...
> }
>
>
>
>
> /Serge
>
>
>
> cyrille37 wrote:
>   
>> Fidel Chavarria a �crit :
>> 
>>> Hi
>>> I think this willhelp you,
>>> http://tapestry.apache.org/tapestry5/tapestry-spring/
>>>   
>>>   
>> Thanks,
>> but if you had read my mail, I should see that I'm talked about this page.
>>
>> In this page in "Limitations" chapter it is writte that we can't inject 
>> Spring session bean but we have to retreive the WebApplicationContext 
>> and use it.
>> But I don't know howto retreive this so famous WebApplicationContext 
>> when I'm in a tapestry code page or component.
>>
>> cyrille.
>> 
>>> cyrille37 wrote:
>>>   
>>>   
 Hi,

 In the T5 tapestry-spring documentation it is writed to don't use other 
 Spring beans than Singleton ones.
 Inject the WebApplicationContext instead.
 http://tapestry.apache.org/tapestry5/tapestry-spring/

 But howto inject the WebApplicationContext ?

 thanks
 cyrille

 -
 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: Tapestry-Hibernate, do we have to save()?

2007-11-19 Thread Ezra Epstein
I imagine that if you use Spring's declarative transactions on the service 
layer so that the read()/get() method does not start a read/write transaction 
but the save() method does then changing the object without calling "save()" 
should just work - you won't be in a read/write tx and so the changes to the 
object won't be persisted.  I haven't tested this.

lasitha <[EMAIL PROTECTED]> wrote: On Nov 19, 2007 10:35 PM, Thiago H de Paula 
Figueiredo
 wrote:
> I havent't noticed this problem before. Until now, HiberTapestry opens a
> transaction when a service method annotated with @Transactional is invoked
> and commits it when the method finishes without exceptions. Otherwise, the
> transaction is aborted.

Let me describe the problem in a little more detail. Assuming a
typical OSIV setup, consider the following sequence of events:
1. A form is submitted.
2. The entity that backs the form is retrieved from the db in
onActivate() or onPrepare().
3. The first set of validations pass and the entity's fields are
populated by tapestry.
4. Our onValidate() method finds some problem and records errors on
the validation tracker.
5. Tapestry redirects back to the same page so the user can correct
their inputs.
6. The request ends and the active session is flushed.

In the above sequence, we don't want to commit the modifications to
our entity, but the automatic dirty check initiated when the session
is flushed will detect and commit the changes from step 3.  Note that
the method to save our changes (that is presumably @Transactional) is
not even reached in this scenario because we never hit onSuccess().

Does that make sense?  Max, Jonathan and Ognen seem to confirm that
this is indeed a real consideration.

I suspect the solution is as simple as setting the hibernate flush
mode to MANUAL (and switching it AUTO just for the duration of an
explicitly declared transaction) - the way the spring folks do it.

Cheers, lasitha.

P.S. I goofed up the link to the spring OSIV interceptor in my
previous post.  Here's the correct one:
http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/orm/hibernate3/support/OpenSessionInViewInterceptor.html

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




Re: T5 create a grid with columns dynamics?

2007-11-18 Thread Ezra Epstein
I think the answer is "yes", but I'm not sure what the question is.  What is 
dynamic?  The columns?  The underlying entity/object being displayed?  Or do 
you mean columns that can resize and be moved around via JavaScript?

Cristian Gonzalo Gary <[EMAIL PROTECTED]> wrote:
  
i need a grid with columns dynamics, filled with data from different source
. exist a any way to do this.?

Thanks , Gracias.
-- 
View this message in context: 
http://www.nabble.com/T5-create-a-grid-with-columns-dynamics--tf4832954.html#a13826945
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] Default order by for Grid

2007-11-15 Thread Ezra Epstein
Why @Component of course

(aka, nevermind)



Ezra Epstein <[EMAIL PROTECTED]> wrote: Speaking of which, how does one get a 
reference to a contained component in T5?

Marcelo Lotif  wrote: The grid component have a method called 
setSortColumnId(), but for use it,
you got to have a reference to the component in your page's class

2007/11/13, Christoph Jaeger :
>
> Hi,
>
> is there an easy way of setting the default order by column for the Grid
> component?
>
> Christoph
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Atenciosamente,
Marcelo Lotif




Re: T5 Newbie : populate the value of a form in a bean

2007-11-15 Thread Ezra Epstein
Is it that the user object is null on page load?

If so, see the BeanEditForm's implementation of void onPrepareFromForm()


Michael Courcy <[EMAIL PROTECTED]> wrote: You're right

here it is,  I remove the "offending input"

and use this instead

${user}-- ${user.name}

And I get

[EMAIL PROTECTED] -- A name

Obviously user is not null.

I think the problem does not come from tapestry but from me.
I want to populate from the form directly to the bean. But this require 
to use either the beanEditForm or a custom component.

I 'm just influenced by other framework like struts2 for instance :

If you have something like that in your form

 [input] 

When the form is submitted struts2 tries to find if the controller 
features a user property, and then if user features a name property
If the answer is yes to both it calls controller.getUser().setName("bla");





Ezra Epstein a �crit :
> I always pause when hearing "100% sure."  An easy check/test is to remove the 
> offending  [input]  and stick in a simple ${user} and see if indeed you get 
> the toString() value for your user object.
>
> Michael Courcy  wrote: I'm 100% sure, user is not null
>
> I have a getter and a setter for both : name and user
>
> Thanks
> Thiago H de Paula Figueiredo a �crit :
>   
>> On Wed, 14 Nov 2007 12:47:06 -0200, Michael Courcy 
>>  wrote:
>>
>> 
>>>  [input] 
>>>
>>> I have to provide the setter and the getter for name and I still get 
>>> an error when I submit.
>>>   
>> What error? Make sure your user field is not null when the form is 
>> submited. Also make sure you have public getters and setters, because 
>> otherwise Tapestry cannot access them.
>>
>> 
>
>
>   


-- 
Michael Courcy
http://courcy.blogspot.com




Re: [T5] Default order by for Grid

2007-11-14 Thread Ezra Epstein
Speaking of which, how does one get a reference to a contained component in T5?

Marcelo Lotif <[EMAIL PROTECTED]> wrote: The grid component have a method 
called setSortColumnId(), but for use it,
you got to have a reference to the component in your page's class

2007/11/13, Christoph Jaeger :
>
> Hi,
>
> is there an easy way of setting the default order by column for the Grid
> component?
>
> Christoph
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Atenciosamente,
Marcelo Lotif



Re: T5.0.6 - GirdModelProvider for GridRows - example?

2007-11-14 Thread Ezra Epstein
Maybe you've got a different Model class.  The add() method with a null conduit 
works fine.

That said, I didn't realize you were inside a form.  Howard as mentioned that 
this is an area that needs work.

CarstenM <[EMAIL PROTECTED]> wrote: 
Hi,

the line
model.add("action", null );
caused the NullPointer.
I am not sure if your suggestion is what I ma looking for.
I am looking for a grid inside a form. A grid row (GridRow component?)
should contain
a textfield and a checkbox for example.

Cheers.


Vashon-Ez wrote:
> 
> Maybe you could show more of your .tml (and .java) file(s).  I'm new to
> Tap5 and all I've discovered so far in the realm of models is how to
> supply a one to a BeanEditor and to a Grid.  I've never gone to the level
> of t:gridcell and from what I've learned one generally does not need to --
> you can configure a lot at the t:grid level and via nested t:parameter
> elements.
> 
> Ezra
> 
> CarstenM  wrote: 
> Hi,
> 
> ok, I tried this but I get a NullPointerException (line 4 of .tml).
> 
> 1
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
> 2
> volatile="inherit:volatile">
> 3
> 4
> overrides="componentResources.containerResources"/>
> 5
> 6
> 7
> 
> #
> org.apache.tapestry.corelib.base.AbstractPropertyOutput.readPropertyForObject(AbstractPropertyOutput.java:134)
> #
> org.apache.tapestry.corelib.base.AbstractPropertyOutput.renderPropertyValue(AbstractPropertyOutput.java:117)
> #
> org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java:28)
> #
> org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java)
> 
> Do I forget something?
> 
> Thanks.
> 
> 
> Vashon-Ez wrote:
>> 
>> It's a two step process.
>> 
>> 1.  Define a model in your Java class.  It's easy to just use the
>> standard
>> definition and extend it like so:
>> 
>> @Inject
>> private BeanModelSource _beanModelSource;
>> 
>> @Inject
>> private ComponentResources _resources;
>> 
>> @Retain
>> private BeanModel _model;
>> 
>> void pageLoaded() {
>> _model = _beanModelSource.create(VideoClip.class, true,
>> _resources);
>> 
>> _model.remove("id");
>> 
>> _model.add("action", null);
>> }
>> 
>> public BeanModel getModel() {
>> return _model;
>> }
>> 
>> Note the _model.add("action", null);  that sets a null conduit meaning
>> the
>> grid will not try to pull values for that column from the underlying
>> bean. 
>> In other words, its a utility column where you can put whatever you like. 
>> Note the name of the model is just model as its accessed via the
>> getModel() method.
>> 
>> 2.  Add a model="name-of-your-model-in-your-Java-class" to your grid in
>> your .tml file.  In this case it is model="model" e.g.:
>> 
>> 
>> rowsPerPage="5" pagerPosition="both">
>> 
>> 
>> context="video.id">${video.title}
>> 
>> 
>> 
>> context="video.id">Edit
>> 
>> 
>> 
>> I've added a bunch of other stuff, but you should get the idea. 
>> 
>> HTH
>> 
>> CarstenM  wrote: 
>> Hi again,
>> 
>> no example for this or what's wrong?
>> 
>> Cheers
>> Carsten
>> 
>> 
>> 
>> CarstenM wrote:
>>> 
>>> Hello,
>>> 
>>> still trying to use the GridRows component.
>>> Can someone give an example for a GridModelProvider or the GridRows
>>> component?
>>> Well, the Grid is an implementation of GridModelProvider but I would
>>> like
>>> to
>>> customize my rows.
>>> 
>>> Thanks,
>>> Carsten
>>> 
>>> 
>>> (Thread relates to T5.0.6 - How to use GridRows)
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13729112
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13743083
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.06 Project tree

2007-11-14 Thread Ezra Epstein
The main requirement for folder structure is based on on Tapestry but on the 
servlet specification.  Web accessible files in a .war cannot but in the 
WEB-INF folder.  Tapestry lets you put .tml files either in the the regular 
place for web accessible files or in the WEB-INF at the same location 
(folder/package) as the corresponding .class file.

How one chooses to layout a folder during dev is, for my money, 100% up to the 
developer.  That said, there are certain layouts that work very well with 
certain tools.  For example, I use Eclipse.  I start with a "Dynamic Web 
Project" type, stick all the .tml files in the WebRoot folder, all the .java 
files in the src folder and everything works fine and I can launch the app 
without packaging a .war file.  I can launch it via either Tomcat or Jetty too.

HTH

Michael Bernagou <[EMAIL PROTECTED]> wrote: I have something strange and it 
made me asking this question :

What are the mandatory project tree elements? (sorry for my english I don't
now how to write it differently).

So, my project is :

MyProject/src/papo.pages/[all pages such as Start.java and Start.properties]
MyProject/src/papo.services/[ioc stuff]
MyProject/webroot/[all template such as Start.tml and Start_fr.tml]

But I have this error :

java.lang.RuntimeException Page Start did not generate any markup when
rendered. This could be because its template file could not be located, or
because a render phase method in the page prevented rendering.


Start.tml:

   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>


Paper and Pen Online



  

 [input] 
t:value="login.password" />
  

Si vous n'avez pas encore de compte, crees-en
un!!

${message}



***
Start.java:
package papo.pages;

import org.apache.tapestry.annotations.ApplicationState;
import org.apache.tapestry.annotations.InjectPage;
import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.ioc.annotations.Inject;
import papo.data.Login;
import papo.data.UserLite;
import papo.exception.PapoException;
import papo.model.User;
import papo.services.ApplicationService;
import papo.services.UserService;


/**
 * Start page of application papo.
 */
public class Start {
  private static final String SUCCESS = "Home";
  private static final String FAILURE = "Start";

  @Persist
  private Login login;
  public Login getLogin() { return login; }
  public void setLogin(Login login) { this.login = login; }

  private String message;
  public String getMessage() { return message; }
  public void setMessage(String message) { this.message = message; }

  @ApplicationState
  private User user;

  @InjectPage
  private Home home;

  @Inject
  private UserService userService;

  @Inject
  private ApplicationService applicationService;

  String onSuccess() {
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 null;
}
return SUCCESS;
  }
}

It didn't enter in Start.java (I put a debug point) because it was not able
to "compile" or "find" the Start.tml. Usually, when it found a compilation
problem, the error message explicitely explain where is the line in the
template, but in my case, I have only a stack trace.

When I see the Snapshot for the typicall project, there is something else as
Project tree, and I don't want to follow the architecture. Having the
webroot folder in the src/main and the java in the src/main/java is not
logic for me.
A web application is not defined like that usually, why to change the way?
But this is another subject...


-- 
Michael Bernagou
Java Developper



Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Ezra Epstein
I always pause when hearing "100% sure."  An easy check/test is to remove the 
offending  and stick in a simple ${user} and see if indeed you get the 
toString() value for your user object.

Michael Courcy <[EMAIL PROTECTED]> wrote: I'm 100% sure, user is not null

I have a getter and a setter for both : name and user

Thanks
Thiago H de Paula Figueiredo a écrit :
> On Wed, 14 Nov 2007 12:47:06 -0200, Michael Courcy 
>  wrote:
>
>>  [input] 
>>
>> I have to provide the setter and the getter for name and I still get 
>> an error when I submit.
>
> What error? Make sure your user field is not null when the form is 
> submited. Also make sure you have public getters and setters, because 
> otherwise Tapestry cannot access them.
>


-- 
Michael Courcy
http://courcy.blogspot.com


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




Re: TextStreamResponse and XML and UTF-8

2007-11-13 Thread Ezra Epstein
This is another way to do it.  Look at the code for TextStreamResponse.  Write 
your own StreamResponse impl that's backed by a ByteArrayInputStream.

(The reason I avoid that approach is (a) you create an InputStream to write a 
response, so under the covers Tap5 is reading from it and writing to the actual 
HTTP output stream which means that (b) the performance is a bit degraded and 
(c) you have to hold the whole reply in memory rather than streaming it back to 
the client.)

Fernando Padilla <[EMAIL PROTECTED]> wrote: Essentially, you gave it a string 
(UTF16 in memory), and it is being
converted into bytes ( string.getBytes() within TextStreamResponse ).
And the contentType of the response is set also from TextStreamResponse.

I would double check what the string.getBytes() is returning, maybe it's
actually putting out bytes in UTF-8, but the HTTP response assumes it's
not in UTF-8, but ISO-LATIN-1 or somesuch.  So you're getting the
correct bytes, but they are being interpreted wrong..

1) you might just have to add the charset to the mimetype..
"text/xml;charset=UTF-8"?

2) If you want your 3rd party library to take over more rendering, then
create StreamResponse object that goes from a byte[] instead of a
String, then you have full control on how that strings gets encoded
(utf-8 charset).

3) Maybe there is a bug/enhancement here and
StreamResponseResultProcessor, and TextStreamResponse should be paying
more attention to the charset of the mimetype.





thanos wrote:
> I used 
> boolean beforeRenderTemplate(){
>  return false;
> }
> but couldn't skip rendering check
> 
> I will currently return xml using a template with the help of Fernando's
> patch - TAPESTRY-1600.
> This patch allows the generation of xml, from an xml-based description by
> fixing the "cutting" of namespaces from tapestry. This way I a can set and
> keep UTF-8 encoding.
> 
> I would like, however, to have the option to return a complete UTF-8 xml/rss
> created from say another library (I am currently using rome), using
> TextStreamResponse or Printwriter, so if anyone has a code example that will
> actually perform my original request, please post it here.
> 
> 
> 
> 
> 
> Vashon-Ez wrote:
>> You can override one of the page render methods (I think onactivate is one
>> of those, but check the Tap5 website) and return false  to tell Tap to
>> skip the other steps of page rendering.
>>
>> thanos  wrote: 
>> thank you.
>>
>> I tried that but I get a mix of xml and html erro String (insteαd of
>> clean
>> xml document) as a response. Seems that it looks for a template (I dont
>> have
>> one cause I didnt need it with textStreamResponse)
>>
>> Inside onActivate I obtain a PrintWriter from the injected Response, using
>> "application/xml; charset=UTF-8"
>> as content type. I print a small test xml string in printwriter and then I
>> flush the printwriter.
>>
>> I return null in onActivate().
>>
>> Did I do something wrong? 
>>
>>
>>
>>
>>
>> Vashon-Ez wrote:
>>> If you're just returning an RSS feed you probably don't want any page
>>> wrapping, etc.  In that case you can:
>>>
>>> @Inject
>>> private Response _response;
>>>
>>> You can then do things like setting headers and even write directly to
>>> the
>>> container-provided OutputStream - bypassing the whole TextStreamResponse
>>> -- just have your method flsuh() the output stream and return null.  This
>>> should also give slightly better performance.
>>>
>>> HTH,
>>>
>>> EE
>>>
>>> thanos  wrote: 
>>> Hi all,
>>>
>>> I am trying to return an rss feed using TextStreamResponse("text/xml",
>>> myfeed);
>>>
>>> The problem is the that I can't make TextStreamResponse to show UTF-8
>>> (greek
>>> in my case) characters.
>>> I tried to set the content type in the response of RequestGlobals and
>>> also
>>> added a Utf8Filter with no luck
>>>
>>> The same feed is displayed fine when I requested through a simple
>>> servlet. 
>>> I can see the characters in the returned string, and if I save the page
>>> source as an UTF-8 file I can displayed it correctly.
>>>
>>> However, I can't make my browser or my GUI to display the xml if I
>>> directly
>>> request it using TextStreamResponse.
>>>
>>> Dont know if it's related with this post:
>>>
>>> http://www.nabble.com/T5-confused-about-Services-and-XmlHttpResponse-tf4160459.html#a11839004
>>>
>>> Any advice plz?
>>>
>>> Thanks
>>> Thanos
>>>
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/TextStreamResponse-and-XML-and-UTF-8-tf4799847.html#a13732229
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/TextStreamResponse-and-XML-and-UTF-8-tf4799847.html#a13736449
>> Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: TextStreamResponse and XML and UTF-8

2007-11-13 Thread Ezra Epstein
You can override one of the page render methods (I think onactivate is one of 
those, but check the Tap5 website) and return false  to tell Tap to skip 
the other steps of page rendering.

thanos <[EMAIL PROTECTED]> wrote: 
thank you.

I tried that but I get a mix of xml and html erro String (insteαd of clean
xml document) as a response. Seems that it looks for a template (I dont have
one cause I didnt need it with textStreamResponse)

Inside onActivate I obtain a PrintWriter from the injected Response, using
"application/xml; charset=UTF-8"
as content type. I print a small test xml string in printwriter and then I
flush the printwriter.

I return null in onActivate().

Did I do something wrong? 





Vashon-Ez wrote:
> 
> If you're just returning an RSS feed you probably don't want any page
> wrapping, etc.  In that case you can:
> 
> @Inject
> private Response _response;
> 
> You can then do things like setting headers and even write directly to the
> container-provided OutputStream - bypassing the whole TextStreamResponse
> -- just have your method flsuh() the output stream and return null.  This
> should also give slightly better performance.
> 
> HTH,
> 
> EE
> 
> thanos  wrote: 
> Hi all,
> 
> I am trying to return an rss feed using TextStreamResponse("text/xml",
> myfeed);
> 
> The problem is the that I can't make TextStreamResponse to show UTF-8
> (greek
> in my case) characters.
> I tried to set the content type in the response of RequestGlobals and also
> added a Utf8Filter with no luck
> 
> The same feed is displayed fine when I requested through a simple servlet. 
> I can see the characters in the returned string, and if I save the page
> source as an UTF-8 file I can displayed it correctly.
> 
> However, I can't make my browser or my GUI to display the xml if I
> directly
> request it using TextStreamResponse.
> 
> Dont know if it's related with this post:
> 
> http://www.nabble.com/T5-confused-about-Services-and-XmlHttpResponse-tf4160459.html#a11839004
> 
> Any advice plz?
> 
> Thanks
> Thanos
> 
> -- 
> View this message in context:
> http://www.nabble.com/TextStreamResponse-and-XML-and-UTF-8-tf4799847.html#a13732229
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/TextStreamResponse-and-XML-and-UTF-8-tf4799847.html#a13736449
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: TextStreamResponse and XML and UTF-8

2007-11-13 Thread Ezra Epstein
If you're just returning an RSS feed you probably don't want any page wrapping, 
etc.  In that case you can:

@Inject
private Response _response;

You can then do things like setting headers and even write directly to the 
container-provided OutputStream - bypassing the whole TextStreamResponse -- 
just have your method flsuh() the output stream and return null.  This should 
also give slightly better performance.

HTH,

EE

thanos <[EMAIL PROTECTED]> wrote: 
Hi all,

I am trying to return an rss feed using TextStreamResponse("text/xml",
myfeed);

The problem is the that I can't make TextStreamResponse to show UTF-8 (greek
in my case) characters.
I tried to set the content type in the response of RequestGlobals and also
added a Utf8Filter with no luck

The same feed is displayed fine when I requested through a simple servlet. 
I can see the characters in the returned string, and if I save the page
source as an UTF-8 file I can displayed it correctly.

However, I can't make my browser or my GUI to display the xml if I directly
request it using TextStreamResponse.

Dont know if it's related with this post:

http://www.nabble.com/T5-confused-about-Services-and-XmlHttpResponse-tf4160459.html#a11839004

Any advice plz?

Thanks
Thanos

-- 
View this message in context: 
http://www.nabble.com/TextStreamResponse-and-XML-and-UTF-8-tf4799847.html#a13732229
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 - GirdModelProvider for GridRows - example?

2007-11-13 Thread Ezra Epstein
Maybe you could show more of your .tml (and .java) file(s).  I'm new to Tap5 
and all I've discovered so far in the realm of models is how to supply a one to 
a BeanEditor and to a Grid.  I've never gone to the level of t:gridcell and 
from what I've learned one generally does not need to -- you can configure a 
lot at the t:grid level and via nested t:parameter elements.

Ezra

CarstenM <[EMAIL PROTECTED]> wrote: 
Hi,

ok, I tried this but I get a NullPointerException (line 4 of .tml).

1
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
2
volatile="inherit:volatile">
3
4
overrides="componentResources.containerResources"/>
5
6
7

#
org.apache.tapestry.corelib.base.AbstractPropertyOutput.readPropertyForObject(AbstractPropertyOutput.java:134)
#
org.apache.tapestry.corelib.base.AbstractPropertyOutput.renderPropertyValue(AbstractPropertyOutput.java:117)
#
org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java:28)
# org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java)

Do I forget something?

Thanks.


Vashon-Ez wrote:
> 
> It's a two step process.
> 
> 1.  Define a model in your Java class.  It's easy to just use the standard
> definition and extend it like so:
> 
> @Inject
> private BeanModelSource _beanModelSource;
> 
> @Inject
> private ComponentResources _resources;
> 
> @Retain
> private BeanModel _model;
> 
> void pageLoaded() {
> _model = _beanModelSource.create(VideoClip.class, true,
> _resources);
> 
> _model.remove("id");
> 
> _model.add("action", null);
> }
> 
> public BeanModel getModel() {
> return _model;
> }
> 
> Note the _model.add("action", null);  that sets a null conduit meaning the
> grid will not try to pull values for that column from the underlying bean. 
> In other words, its a utility column where you can put whatever you like. 
> Note the name of the model is just model as its accessed via the
> getModel() method.
> 
> 2.  Add a model="name-of-your-model-in-your-Java-class" to your grid in
> your .tml file.  In this case it is model="model" e.g.:
> 
> 
> rowsPerPage="5" pagerPosition="both">
> 
> 
> context="video.id">${video.title}
> 
> 
> 
> context="video.id">Edit
> 
> 
> 
> I've added a bunch of other stuff, but you should get the idea. 
> 
> HTH
> 
> CarstenM  wrote: 
> Hi again,
> 
> no example for this or what's wrong?
> 
> Cheers
> Carsten
> 
> 
> 
> CarstenM wrote:
>> 
>> Hello,
>> 
>> still trying to use the GridRows component.
>> Can someone give an example for a GridModelProvider or the GridRows
>> component?
>> Well, the Grid is an implementation of GridModelProvider but I would like
>> to
>> customize my rows.
>> 
>> Thanks,
>> Carsten
>> 
>> 
>> (Thread relates to T5.0.6 - How to use GridRows)
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13729112
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 - GirdModelProvider for GridRows - example?

2007-11-13 Thread Ezra Epstein
It's a two step process.

1.  Define a model in your Java class.  It's easy to just use the standard 
definition and extend it like so:

@Inject
private BeanModelSource _beanModelSource;

@Inject
private ComponentResources _resources;

@Retain
private BeanModel _model;

void pageLoaded() {
_model = _beanModelSource.create(VideoClip.class, true, _resources);

_model.remove("id");

_model.add("action", null);
}

public BeanModel getModel() {
return _model;
}

Note the _model.add("action", null);  that sets a null conduit meaning the grid 
will not try to pull values for that column from the underlying bean.  In other 
words, its a utility column where you can put whatever you like.  Note the name 
of the model is just model as its accessed via the getModel() method.

2.  Add a model="name-of-your-model-in-your-Java-class" to your grid in your 
.tml file.  In this case it is model="model" e.g.:



${video.title}


Edit



I've added a bunch of other stuff, but you should get the idea. 

HTH

CarstenM <[EMAIL PROTECTED]> wrote: 
Hi again,

no example for this or what's wrong?

Cheers
Carsten



CarstenM wrote:
> 
> Hello,
> 
> still trying to use the GridRows component.
> Can someone give an example for a GridModelProvider or the GridRows
> component?
> Well, the Grid is an implementation of GridModelProvider but I would like
> to
> customize my rows.
> 
> Thanks,
> Carsten
> 
> 
> (Thread relates to T5.0.6 - How to use GridRows)
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
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: CreatePageLink and list of context

2007-11-13 Thread Ezra Epstein
Take a look at the pageLink component and its "context" parameter along with 
activate/passivate methods on the target page.

Angelo Chen <[EMAIL PROTECTED]> wrote: 
Hi,

I'd like to pass something like this to a page: /Inbox/123

  List p = new ArrayList();
  p.add("Inbox");
  p.add("272");

  String lnk = _resources.createPageLink("mypage", true, p).toURI();
  this does not work, it has something like this:

/mypage/login/%5BInbox%2C+272%5D

what's the correct way? Thanks.

A.C.


-- 
View this message in context: 
http://www.nabble.com/T5%3A-CreatePageLink-and-list-of-context-tf4796265.html#a13721251
Sent from the Tapestry - User mailing list archive at Nabble.com.


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




T5 adding custom parameters to a BeanEditor

2007-11-12 Thread Ezra Epstein
I'm wanting to add custom t:parameter elements to a beaneditor within a Form.  
This is not a BeanEditorForm, but a vanilla Form element with a beaneditor 
within it.  Screencast #5 shows how to add custom t:parameter blocks to a 
BeanEditorForm.  I've tried similar with a BeanEditor - adding the blocks both 
within the BeanEditor element and outside that element but within the enclosing 
 element.  No luck either way.

I'm very new to Tap5.  Any pointers?

Thanks,

Ezra E