You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by osamuo <in...@yahoo.co.jp> on 2008/03/15 12:18:50 UTC

Do I have to @persist( "session" ) input values in verify page?

Register.tml: let a user register a value
Verify.tml: let a user verify a input


Register.tml
---------------------------------------
<form t:type="Form" t:id="form">
  <input t:type="TextField" t:value="someValue" />
  <input type="submit" />
</form>
---------------------------------------

Register.java
---------------------------------------
public class Register{
 
 @Property
 private String someValue;
 
 @InjectPage
 private Verify verifyPage;
 
 public Object onSuccessFromForm()
   verifyPage.setSomeValue( someValue );
   
   return verifyPage;
 }
}



Verify.tml
-------------------------------------
<form t:type="Form" t:id="form">
  <input t:type="TextField" t:value="someValue" />
  <input type="submit" />
</form>
-------------------------------------

Verify.java
-------------------------------------
public class Verify{
  
  @Persist( "session" ) <== I don't want to store this into the session.
  private String someValue;
  
  public String getSomeValue(){
    return someValue;
  }
  
  public void setSomeValue( String someValue ){
    this.someValue = someValue;
  }
  
  public Object onSuccessFromForm(){
    ...
  }
}
-------------------------------------


Is there any way to submit "someValue" in Verify.tml without using @Persist(
"session" )?
And why don't T5 support t:type="Hidden"?

Thanks,
Osamuo




-- 
View this message in context: http://www.nabble.com/Do-I-have-to-%40persist%28-%22session%22-%29-input-values-in-verify-page--tp16066687p16066687.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Do I have to @persist( "session" ) input values in verify page?

Posted by Dmitry Shyshkin <sh...@devoler.com>.
Persistence is needed because form is submitted in one request (that 
send redirect in response) and rendered in second request.
If you do not want to persist data for form you should
1. turn off redirect after post and process submission in one request
public class WebModule {
public static void 
contributeApplicationDefaults(MappedConfiguration<String, String> 
configuration) {
configuration.add(TapestryConstants.SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS_SYMBOL, 
"true");
}
}

2. Disallow form to persist ValidationTracker (if you need this).

in .tml

<form t:type="form" tracket="tracker">
...
</form>

in .java

@Property(write = false)
private ValidationTracker tracker;

osamuo пишет:
> Register.tml: let a user register a value
> Verify.tml: let a user verify a input
>
>
> Register.tml
> ---------------------------------------
> <form t:type="Form" t:id="form">
>   <input t:type="TextField" t:value="someValue" />
>   <input type="submit" />
> </form>
> ---------------------------------------
>
> Register.java
> ---------------------------------------
> public class Register{
>  
>  @Property
>  private String someValue;
>  
>  @InjectPage
>  private Verify verifyPage;
>  
>  public Object onSuccessFromForm()
>    verifyPage.setSomeValue( someValue );
>    
>    return verifyPage;
>  }
> }
>
>
>
> Verify.tml
> -------------------------------------
> <form t:type="Form" t:id="form">
>   <input t:type="TextField" t:value="someValue" />
>   <input type="submit" />
> </form>
> -------------------------------------
>
> Verify.java
> -------------------------------------
> public class Verify{
>   
>   @Persist( "session" ) <== I don't want to store this into the session.
>   private String someValue;
>   
>   public String getSomeValue(){
>     return someValue;
>   }
>   
>   public void setSomeValue( String someValue ){
>     this.someValue = someValue;
>   }
>   
>   public Object onSuccessFromForm(){
>     ...
>   }
> }
> -------------------------------------
>
>
> Is there any way to submit "someValue" in Verify.tml without using @Persist(
> "session" )?
> And why don't T5 support t:type="Hidden"?
>
> Thanks,
> Osamuo
>
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org