You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rob Bugh <ro...@accuwater.com> on 2004/03/12 22:37:28 UTC

How To Work Around a tag?

I'm instrumenting an html document with a <BASE> tag. The base tag works 
fine for locating the images but it's giving me grief with page links and 
forms. Is there a way to tell Tapestry to ignore the <BASE> tag for links 
for use it for image assets?

Rob
-- 
Rob Bugh
Accuwater, Inc.

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


Re: Resource initialization

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Another option is to use an <extension> in  your .application that has 
the immediate startup attribute enabled.

	Erik


On Mar 12, 2004, at 8:25 PM, Shawn Church wrote:

> I'm brand new to Tapestry, having been a Velocity/WebMacro devotee for 
> the
> past few years.  I bought Mr. Ship's most excellent Tapestry in Action 
> last
> week and finished it a couple of days ago, so I'm finally ready to 
> dive in.
>
> I've studied the sample applications and am getting a feel for the
> organization of the framework, but I'm not sure how to best handle one
> issue.  I normally instantiate a database pool object in my servlet 
> init()
> and store the reference for use by the webapp.  I can do this just as 
> well
> using Tapestry (by subclassing ApplicationServlet), and I would like to
> store the reference in the Global object, but I'm not sure how to 
> store it
> since Global won't exist this early.  I would have thought the Global 
> object
> would be created by Tapestry on app initialization, but I see in the
> Tapestry source that it is created by the IEngine implementation 
> (which is
> created on the first request I think).  I suppose I could subclass
> BaseEngine and create the db pool from there, but I would rather 
> create it
> when the application loads.  There are other application resources 
> needed
> besides the db pool, and creating everything in init() usually makes 
> sense.
> I'm sure this is a common need, so I'm probably overlooking something
> obvious, but I would appreciate a hint.
>
> Thanks,
> Shawn
>
>
> ---------------------------------------------------------------------
> 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


Re: Resource initialization

Posted by Jonny Wray <jo...@yahoo.com>.
Shawn, 

I've never done it with database pool (I use the app server for that)
but I do something similar for loading the spring application context,
then storing it in global. I use a custom engine extending BaseEngine.
Here'e the code. I got this from a document about integrating spring
and tapestry, but I forget where this was.

public class SpringEngine extends BaseEngine{

	public static final String APPLICATION_CONTEXT_KEY =
"springApplicationContext";
	
	protected void
setupForRequest(org.apache.tapestry.request.RequestContext context){
		super.setupForRequest(context);
		Map global = (Map)getGlobal();
		ApplicationContext ac =
(ApplicationContext)global.get(APPLICATION_CONTEXT_KEY);
		if(ac == null){
			ac =
WebApplicationContextUtils.getWebApplicationContext(context.getServlet().getServletContext());
			global.put(APPLICATION_CONTEXT_KEY, ac);
		}
	}
}

I'm sure you can modify this to store whatever application resources
you need.

Jonny

--- Shawn Church <sh...@boxity.com> wrote:
> I'm brand new to Tapestry, having been a Velocity/WebMacro devotee
> for the
> past few years.  I bought Mr. Ship's most excellent Tapestry in
> Action last
> week and finished it a couple of days ago, so I'm finally ready to
> dive in.
> 
> I've studied the sample applications and am getting a feel for the
> organization of the framework, but I'm not sure how to best handle
> one
> issue.  I normally instantiate a database pool object in my servlet
> init()
> and store the reference for use by the webapp.  I can do this just as
> well
> using Tapestry (by subclassing ApplicationServlet), and I would like
> to
> store the reference in the Global object, but I'm not sure how to
> store it
> since Global won't exist this early.  I would have thought the Global
> object
> would be created by Tapestry on app initialization, but I see in the
> Tapestry source that it is created by the IEngine implementation
> (which is
> created on the first request I think).  I suppose I could subclass
> BaseEngine and create the db pool from there, but I would rather
> create it
> when the application loads.  There are other application resources
> needed
> besides the db pool, and creating everything in init() usually makes
> sense.
> I'm sure this is a common need, so I'm probably overlooking something
> obvious, but I would appreciate a hint.
> 
> Thanks,
> Shawn
> 
> 
> ---------------------------------------------------------------------
> 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


Resource initialization

Posted by Shawn Church <sh...@boxity.com>.
I'm brand new to Tapestry, having been a Velocity/WebMacro devotee for the
past few years.  I bought Mr. Ship's most excellent Tapestry in Action last
week and finished it a couple of days ago, so I'm finally ready to dive in.

I've studied the sample applications and am getting a feel for the
organization of the framework, but I'm not sure how to best handle one
issue.  I normally instantiate a database pool object in my servlet init()
and store the reference for use by the webapp.  I can do this just as well
using Tapestry (by subclassing ApplicationServlet), and I would like to
store the reference in the Global object, but I'm not sure how to store it
since Global won't exist this early.  I would have thought the Global object
would be created by Tapestry on app initialization, but I see in the
Tapestry source that it is created by the IEngine implementation (which is
created on the first request I think).  I suppose I could subclass
BaseEngine and create the db pool from there, but I would rather create it
when the application loads.  There are other application resources needed
besides the db pool, and creating everything in init() usually makes sense.
I'm sure this is a common need, so I'm probably overlooking something
obvious, but I would appreciate a hint.

Thanks,
Shawn


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