You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bogdan_cm <bo...@rbccm.com> on 2011/07/11 12:41:11 UTC

Javascript library not loaded into the page via @Import

Hi all, 
  In my Tap app I have a simple js file which contains: 



This library resides under: Web-Content/assets/js/test.js

The page for which I want to import this library has the following
annotation above the class declaration:

@Import(library="context:/assets/js/test.js")
public class MemberHome {
...
}

If I change the library name, Tap5 complains the file does not exist, so I
assume it is indeed reading it when the name's match. 

However, after launching the app, when I look in the page source the library
does not exist. Somehow Tap is not complaining about not finding the file,
but it does not include it in the page. 

Is there something obvious that i'm missing here?

Thanks very much, 
Bogdan. 





--
View this message in context: http://tapestry.1045711.n5.nabble.com/Javascript-library-not-loaded-into-the-page-via-Import-tp4574599p4574599.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: Javascript library not loaded into the page via @Import

Posted by Josh Canfield <jo...@gmail.com>.
I think something ate your message. I don't see any javascript.

Are you seeing javascript errors in your browsers javascript console?

There is no reason this shouldn't work so please provide a small code
sample that shows your problem.

Thanks,
Josh

On Mon, Jul 11, 2011 at 1:11 PM, bogdan_cm <bo...@rbccm.com> wrote:
> Current configuration that works:
>
> Layout Template sample (MemberPagesLayout.tml):
>
>
> &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
> &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> <head>
> <title>Alternative Reality - your secret life</title>
> <link rel="stylesheet" href="${member_menu}" type="text/css" />
> <link rel="stylesheet" href="${member_home_tables}" type="text/css" />
> <link rel="stylesheet" href="${member_home}" type="text/css" />
> <link rel="stylesheet" href="${resize}" type="text/css" />
> <link rel="stylesheet" href="${generic}" type="text/css" />
>
>
>
>
> <meta name="Keywords" content="alternative,reality" />
> <meta name="Description"
>        content="Alternative Reality - your secret life" />
> </head>
>
> <body onLoad="modifyImagesBasedOnShape()">
> ...
>
>
> ---------------------------------------------------------
> Component Page tml:
> MemberHome.tml
>
> <html t:type="MemberPagesLayout"
>        xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
>
>
> <tr>
>        <td valign="top">
>
>                <table border="0" width="100%"
>                        style="padding-left: 10px; padding-top: 20px;">
> ...
>
>
> --------------------------------------------------
> Component Java extract:
>
> public class MemberHome {
>
>        // SEARCH SUBMIT LOGIC
>        @Property
>        private String userNameToLookFor;
>
>        @Component
>        private Form searchForm;
>
>        @Inject
>        private PageRenderLinkSource searchLink;
>        // SEARCH SUBMIT LOGIC
>
>        // LAST SESSION PLAY
>        @Property
>        // private String lastSessionPlay =
>        private String lastSessionPlay;
> ...
>
>
>
> -------------------------------------
> This configuration, having the javascript in the Layout component works, and
> the java script does it's part in the page.
>
>
> When I move the script from MemberPagesLayout.tml to a js, put this file
> under: Web-Content/assets/js/generic.js and annotate the MemberHome.java
> with:
> @Import(library="context:/assets/js/test.js") it stops working.
>
> I do believe i'm missing something very simple.
>
> Thanks all again for help.
>
>
>
>
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Javascript-library-not-loaded-into-the-page-via-Import-tp4574599p4576319.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
>
>

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


Re: Javascript library not loaded into the page via @Import

Posted by bogdan_cm <bo...@rbccm.com>.
Current configuration that works:

Layout Template sample (MemberPagesLayout.tml):


&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; 
&quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt; 
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>Alternative Reality - your secret life</title>
<link rel="stylesheet" href="${member_menu}" type="text/css" />
<link rel="stylesheet" href="${member_home_tables}" type="text/css" />
<link rel="stylesheet" href="${member_home}" type="text/css" />
<link rel="stylesheet" href="${resize}" type="text/css" />
<link rel="stylesheet" href="${generic}" type="text/css" />




<meta name="Keywords" content="alternative,reality" />
<meta name="Description"
	content="Alternative Reality - your secret life" />
</head>

<body onLoad="modifyImagesBasedOnShape()">
... 


---------------------------------------------------------
Component Page tml:
MemberHome.tml 

<html t:type="MemberPagesLayout"
	xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">


<tr>
	<td valign="top">
		
		<table border="0" width="100%"
			style="padding-left: 10px; padding-top: 20px;">
...


--------------------------------------------------
Component Java extract:

public class MemberHome {

	// SEARCH SUBMIT LOGIC
	@Property
	private String userNameToLookFor;

	@Component
	private Form searchForm;

	@Inject
	private PageRenderLinkSource searchLink;
	// SEARCH SUBMIT LOGIC

	// LAST SESSION PLAY
	@Property
	// private String lastSessionPlay =	
	private String lastSessionPlay;
...



-------------------------------------
This configuration, having the javascript in the Layout component works, and
the java script does it's part in the page. 


When I move the script from MemberPagesLayout.tml to a js, put this file
under: Web-Content/assets/js/generic.js and annotate the MemberHome.java
with:
@Import(library="context:/assets/js/test.js") it stops working. 

I do believe i'm missing something very simple. 

Thanks all again for help.







--
View this message in context: http://tapestry.1045711.n5.nabble.com/Javascript-library-not-loaded-into-the-page-via-Import-tp4574599p4576319.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: Javascript library not loaded into the page via @Import

Posted by Howard Lewis Ship <hl...@gmail.com>.
Obviously, you are having a problem that nobody else is seeing. A look
at your Java code and component templates would be a good start.

On Mon, Jul 11, 2011 at 12:00 PM, bogdan_cm <bo...@rbccm.com> wrote:
> Thanks for the reply.
>
> The sure way of determining that my js is not making it into the page is
> that i'm not seeing the side effect. My js will modify the width/height of
> the jpg images on the page.
>
> Currently, to make it work I have copied the javascript into the header of
> the Layout page. But i have a fair amount of js, and putting it in a library
> is the way to go.
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Javascript-library-not-loaded-into-the-page-via-Import-tp4574599p4576143.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
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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


Re: Javascript library not loaded into the page via @Import

Posted by bogdan_cm <bo...@rbccm.com>.
Thanks for the reply. 

The sure way of determining that my js is not making it into the page is
that i'm not seeing the side effect. My js will modify the width/height of
the jpg images on the page. 

Currently, to make it work I have copied the javascript into the header of
the Layout page. But i have a fair amount of js, and putting it in a library
is the way to go. 

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Javascript-library-not-loaded-into-the-page-via-Import-tp4574599p4576143.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: Javascript library not loaded into the page via @Import

Posted by Josh Canfield <jo...@gmail.com>.
> However, after launching the app, when I look in the page source the library
> does not exist. Somehow Tap is not complaining about not finding the file,
> but it does not include it in the page.

How are you determining that it's not including the js in the page?

If you are running in production mode the js will be combined with
others and given a different name.

Josh


On Mon, Jul 11, 2011 at 3:41 AM, bogdan_cm <bo...@rbccm.com> wrote:
> Hi all,
>  In my Tap app I have a simple js file which contains:
>
>
>
> This library resides under: Web-Content/assets/js/test.js
>
> The page for which I want to import this library has the following
> annotation above the class declaration:
>
> @Import(library="context:/assets/js/test.js")
> public class MemberHome {
> ...
> }
>
> If I change the library name, Tap5 complains the file does not exist, so I
> assume it is indeed reading it when the name's match.
>
> However, after launching the app, when I look in the page source the library
> does not exist. Somehow Tap is not complaining about not finding the file,
> but it does not include it in the page.
>
> Is there something obvious that i'm missing here?
>
> Thanks very much,
> Bogdan.
>
>
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Javascript-library-not-loaded-into-the-page-via-Import-tp4574599p4574599.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
>
>

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