can gwt be used with a templete languge sush as Django

120 views
Skip to first unread message

Coonay

unread,
Mar 19, 2009, 3:42:38 AM3/19/09
to Google Web Toolkit
can gwt be used with a templete languge sush as Django

Tony Strauss

unread,
Mar 19, 2009, 2:21:53 PM3/19/09
to Google Web Toolkit
I might not understand fully what you want to do, but yes, it can.
While I have not used it with Django, I have used JSP templating in
the GWT application HTML file. For instance, in one application, I
have a different GWT module loaded depending on the type of user
(admin, client, etc). Here is what the header of my JSP file looks
like:

<head>
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>Share and Enjoy!</title>

<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
<script type="text/javascript" language="javascript" src="<c:out
value="${applicationClass}"/>/<c:out value="${applicationClass}"/
>.nocache.js"></script>
</head>

The particular GWT javascript file loaded depends on the value of
applicationClass, which is substituted by the server.

In general, GWT is an entirely client-side technology and thus can be
used with whatever server-side technology you desire. The one
exception to this is the GWT RPC mechanism, which requires a Java
servlet on the server (there is, however, a 3rd party library that
provides a GWT RPC backend in python: http://code.google.com/p/python-gwt-rpc/).

Tony
--
Tony Strauss
Designing Patterns, LLC
http://www.designingpatterns.com
http://blogs.designingpatterns.com

Hannson

unread,
May 15, 2009, 4:33:00 PM5/15/09
to Google Web Toolkit
Yes it can. To do this you need to create a new EntryPoint class that
creates an instance of your widget/app and adds it onto the RootPanel.

Example:

class MyEntryPoint implements EntryPoint
{

/**
* This is the entry point method.
*/
public void onModuleLoad() {

RichTextArea editor = new RichTextArea();
RootPanel.get("RTA-wrapper").add(editor);

}
}



Now you can create a template in your favorite language/framework.
Start by copying the details of the default HTML from gwt such as the
CSS, <script> tags, etc... and paste it into your new template. Create
a DIV with the ID RTA-wrapper (<div id="RTA-wrapper"></div>) for your
widget or application to load into.

Example template for Django:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>{{title}} - Editing</title>
{% include "default_css.html" %}

<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<link type="text/css" rel="stylesheet" href="/static/Sites.css">
{% include "preprepJS.html" %}
<script type="text/javascript" language="javascript" src="/static/
sites/sites.nocache.js"></script>
</head>
<body>
{% include "head.html" %}
<div id="main">
{% include "sidebar.html" %}
<div id="content">
<div id="RTA-wrapper"></div>
</div>
</div>

<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position:absolute;width:0;height:0;border:0"></iframe>
</body>
</html>
Reply all
Reply to author
Forward
0 new messages