On Fri, 26 Sep 2014 01:09:14 -0300, Carlos Gómez Montiel
<ibe...@gmail.com> wrote:
Hi Thiago, thank you for your answer :)
I'm using Tapestry 5.3.7
Hi!
Testing it, I have created a file (googlemaps.js) with the content of
the url: "https://maps.googleapis.com/maps/api/js?v=3.exp" and included
it inside component:
@Import(library =
"classpath:mx/kka/msurvey/web/view/components/maps/googlemaps.js")
public class GMapShow {
}
This way (which I suggested, I'm sorry), with the external library
included in setupRender() and your code that uses it included via @Import,
the two JS files are included in the wrong order, because @Import is
processed before setupRender(). Please try this:
@Inject
@Path("classpath:mx/kka/msurvey/web/view/components/maps/googlemaps.js")
private Asset myCode;
public void setupRender() {
javaScriptSupport.importJavaScriptLibrary("https://maps.googleapis.com/maps/api/js?v=3.exp");
javaScriptSupport.importJavaScriptLibrary(myCode);
)
This will guarantee your code will be included after the Google Maps API.
But the result is the same, the map is rendered correctly if the
component is outside a block but if the component is inside a block, the
map is not renderer.
The component being inside a block (you mean <t:block>?) shouldn't make a
difference. How are you rendering this block?
That's why we ask people more information and snippets of code when
asking help: the original question in the subject of the message (how
can I validate if a script is present), which, by the way, is
JavaScript-specific, not Tapestry-specific, wouldn't need to be asked.
Ok Thiago, thank you for your feedback.
I think the question is about tapestry because I need to validate inside
a tapestry's component if its parent page contains the string <script
src="https://maps.googleapis.com/maps/api/js?v=3.exp"> ;)
You don't need this, but, if you really needed it, you could rename your
setupRender() method to beginRender(MarkupWriter writer) and
writer.getDocument() provides you the Tapestry DOM of the page rendered so
far.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org