Forum Stats

  • 3,851,952 Users
  • 2,264,054 Discussions
  • 7,904,914 Comments

Discussions

connecting applet to servlet

843807
843807 Member Posts: 46,582
edited Oct 2, 2002 7:59PM in Java Applet Development

I'm trying to connect an applet to a servlet. I get an error with the following line:

String urlData="?customer=" + URLEncoder.encode(jt_Customer.getText())+ "&state="+ URLEncoder.encode(jcb_State.getSelectedItem());

The error is as follows:

"TestApplet.java": Error #: 300 : method encode(java.lang.Object) not found in class java.net.URLEncoder at line 361, column 113

The funny part is that I use encoder.encode twice on this line and it only has a problem with the second one.
Any suggestions?
Thanks

Comments

  • 843807
    843807 Member Posts: 46,582
    The difference is likely that jt_Customer.getText returns String and jcb_State.getSelectedItem returns Object.

    Look at the javadoc for java.net.URLEncoder. Note the lack of an encode(Object) method, and that there is only an encode(String) method.

    - David
This discussion has been closed.