TextArea cannot be resolved to a type

270 views
Skip to first unread message

moe374

unread,
Nov 29, 2008, 1:50:42 AM11/29/08
to Google Web Toolkit
Hello. I have just begun learning java (about 2 months ago) and am now
trying to develop a couple applications for the web using java and the
GWT. I am having some difficulty and hoping someone can help me out.
My first problem I am having is I am getting this error message
"TextArea cannot be resolved to a type" when I am trying to create a
text area. I get the error message twice, and for the same line in my
code which is

TextArea ta = new TextArea();

Is there a line (or multiple lines) of code I have to implement before
I can implement the TextArea object?

Also, I need to allow the user to paste some information into this
text box and allow me to store that information in a variable, and
then do something with the information, and then output some
information to the user (even in the same text box is fine). Can some
one please help me get started on this?

Finally, I was wondering if the GWT supports reading the HTML file of
a URL, which would normally be done by something like this:

URL results = new URL("http://www.some-url.com");

BufferedReader in2 = new BufferedReader(
new InputStreamReader(
results.openStream()));
String inputLine = in2.readLine();

Thank you very much.

Reinier Zwitserloot

unread,
Nov 29, 2008, 6:40:56 AM11/29/08
to Google Web Toolkit
Go through the GWT Getting started guide. You've screwed up your
installation somehow, or you're not using the right command line. It's
not a matter of code, it's just that some tool in the chain can't find
the TextArea class code.

For the rest - really, this is a forum, not a university. Just go
through the getting started guide and learn GWT. You should also have
a look at the javadoc for all GWT classes. For example, the TextArea
javadoc has a getText() method, and a setText() method.

You can not use URL in GWT. The GWT Documentation (Notice a pattern?)
has a nice listing of which classes are supported. java.net.* is not
in it. This isn't because the GWT team is lazy, it's simply because
javascript simply can't do this, so there's no way the GWT compiler
can compile that code for you.

If the URL you want to read in is from the same server that served the
webpage (the EXACT same server. Same protocol, same exact server name,
same port), then you can use RequestBuilder (A GWT class. Look it up
in the ...... (drum roll please!) .... documentation!) which is
capable of downloading the contents. On the web, you can pretty much
only ever download everything in one go, there are no streams, just
complete data. If you need to process a couple megabytes on the
client... you're out of luck, then. Maybe your server can download the
big data in chunks and pass it to the client in a flurry of requests
instead.

moe374

unread,
Nov 29, 2008, 3:06:45 PM11/29/08
to Google Web Toolkit
Thank you for your response. I did actually find the getText() and
setText() methods before writting this, I was just a little unsure as
to how to implement them. the URL feature is an essential element of
the program I am trying to write. Since I can't do this with GWT and I
can't do this using an applet either (applets can only connect to the
same server as well i believe), I think I have hit a dead end. What
other options do I have? What do you recommend I use to create this
type of web application?
Thanks for your help.
> > Thank you very much.- Hide quoted text -
>
> - Show quoted text -

Reinier Zwitserloot

unread,
Nov 29, 2008, 7:33:35 PM11/29/08
to Google Web Toolkit
Do it on the server.

If that is no option, write desktop software (something you install
and that doesn't run in a browser at all). You can also use web based
platforms that allow signing / trusting, such as applets, but be aware
that users will need to hand the keys to the kingdom to your app, and
in general, the vomitous stream of text filled with red, screamy
words, and dangerous looking symbols in the popup that shows up when
you ask for this trust makes users have a mild heart infarction, and
blame you for it.

Sumit Chandel

unread,
Dec 1, 2008, 7:09:58 PM12/1/08
to Google-We...@googlegroups.com
Hi Moe,

In addition to Reinier's suggestions, you could also try using JSONP or a mashup service depending on how much control you have over the servers hosting the external URLs that you are requesting from.

You can read more about the technique on Dan Morrill's article on the subject (link below), which I've personally been meaning to update. If you have access to the external server that you want to interoperate with, you could potentially create a mashup service that your main application could use through the JSONP technique.

"Using GWT for JSON Mashups":

Hope that helps,
-Sumit Chandel
Reply all
Reply to author
Forward
0 new messages