You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2005/05/27 20:35:48 UTC
Properties specifications questions
Hello there! I've a couple of questions about this topic:
I have a login page, that after the user is logged I'd like to have
the user object available for the rest of the application (aka it's
stored on the session) a persistent property exists only for a given
page right? Well I tried the global then. My login method looks like
this:
public void authenticate(IRequestCycle cycle) {
User user = new User();
user.setLogin(getUsername());
user.setPassword(getPassword());
boolean authenticate = getUserService().authenticate(user);
if(authenticate){
Map global = (Map)getGlobal();
global.put("user",user);
cycle.activate("Start");
}
cycle.activate("Home");
}
So I go to the Start page. In my page template I'd like to have
something like this:
<span jwcid="@Insert" value="ognl:user.login"> </span>
And my start.page:
<page-specification class="net.sf.webfeeds.view.start.StartPage">
<property-specification name="user"
type="net.sf.webfeeds.model.persistence.user.User"/>
</page-specification>
My StartPage.java
public abstract class StartPage extends BasePage {
public User getUser(){
return (User)((Map)getGlobal()).get("user");
}
}
I`m getting a an error, as getUser is non abstract. Ok. Whats the
procedure here? Set it as abstract and on the method pageBeginRender
set its value?
Thanks a lot
Vinicius
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Properties specifications questions
Posted by Jamie Orchard-Hays <ja...@dang.com>.
Global isn't where to put it--it's shared by all engine instances (it's
application, not session bound). Put it in your Visit object. That's
session bound.
Vinicius Carvalho wrote:
> Hello there! I've a couple of questions about this topic:
>
> I have a login page, that after the user is logged I'd like to have
> the user object available for the rest of the application (aka it's
> stored on the session) a persistent property exists only for a given
> page right? Well I tried the global then. My login method looks like
> this:
>
> public void authenticate(IRequestCycle cycle) {
> User user = new User();
> user.setLogin(getUsername());
> user.setPassword(getPassword());
> boolean authenticate = getUserService().authenticate(user);
> if(authenticate){
> Map global = (Map)getGlobal();
> global.put("user",user);
> cycle.activate("Start");
> }
> cycle.activate("Home");
>
> }
>
> So I go to the Start page. In my page template I'd like to have
> something like this:
> <span jwcid="@Insert" value="ognl:user.login"> </span>
> And my start.page:
> <page-specification class="net.sf.webfeeds.view.start.StartPage">
> <property-specification name="user"
> type="net.sf.webfeeds.model.persistence.user.User"/>
> </page-specification>
> My StartPage.java
> public abstract class StartPage extends BasePage {
> public User getUser(){
> return (User)((Map)getGlobal()).get("user");
> }
> }
> I`m getting a an error, as getUser is non abstract. Ok. Whats the
> procedure here? Set it as abstract and on the method pageBeginRender
> set its value?
>
> Thanks a lot
>
> Vinicius
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org