nightin_gale
nightin_gale

Reputation: 831

gwt component mapping trouble

I am studying to use gwt in my web-project, but came across one trouble. I create a button:

public class Example implements EntryPoint
{
    public void onModuleLoad()
    {
        Button btnStart = new Button( "Start" );
        RootPanel.get().add( btnStart );
    }
}

in my war-module of web-project and deployed it on jboss. After going to http://localhost:8080/war/ I saw nothing at all except greeting of my Example.html:

    <html>
<head>
    <title>Example Application</title>
    <link rel="stylesheet" href="Example.css">
</head>
<body>
<script type="text/javascript" language="javascript" src="com.tests.gwt.Example.nocache.js"></script>
<h1>Example Application</h1>
</body>
</html>

What's the trouble?

Upvotes: 0

Views: 28

Answers (2)

Spiff
Spiff

Reputation: 4104

This does not look correct:

<script type="text/javascript" language="javascript" src="com.tests.gwt.Example.nocache.js"></script>

I suspect the module name is missing:

<script type="text/javascript" language="javascript" src="your_modulename/Example.nocache.js"></script>

That's how your war should look like

Upvotes: 1

Your nocache.js is in a the com.tests.gwt.Example directory.

Your script src must be :

<script type="text/javascript" language="javascript" src="com.tests.gwt.Example/com.tests.gwt.Example.nocache.js"></script>

You can use the rename-to in the gwt.xml module file for simplify the module name :

<module rename-to="example">
    <inherits name="com.google.gwt.user.User" />
    <entry-point class="com.tests.gwt.Example" />
</module>

The script tag will become :

<script type="text/javascript" language="javascript" src="example/example.nocache.js"></script>

Upvotes: 1

Related Questions