• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

String sending in an applet to servlet servlet to applet

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem in sending strings and i dont know where to put the code to transfer the string can anyone help please
Where do i put this code to send a string from the applet to the servlet and from the servlet to the applet.
// this is my applet
import java.applet.Applet;
import java.awt.*; // import the java.awt package
import java.awt.event.*; // import the java.awt.event package
import java.lang.*;
import java.lang.String;
import java.sql.*;//?
import java.io.*;
import java.util.*;//?
import java.net.*;
import javax.swing.*;//?

public class tta1 extends Applet implements ActionListener {
public void init()

public void paint(Graphics g)
//outputting strings too screen here, into cells in a timetable.

// process user's action in TextField input
public void actionPerformed( ActionEvent e )

repaint();//Force paint to be invoked
//this is the servlet-------------------------------------------------

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.net.*;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
public class SerChk extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
//Initialize global variables

public void init() throws ServletException {

//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<font color=\"green\">");
out.println("<p>The servlet has received a GET. This is the reply.</p>");
String outputline;
while((outputLine = out.writeline()) != null)
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("<p>The servlet has received a POST. This is the reply.</p>");
//Clean up resources
public void destroy() {

//buffer code----------------------------------------

import java.net.*;
import java.io.*;
public class URLConnectionReader{
public static void main(string[] args) throws Exception {
URL myUrl = new URL("http://");
URLConnection uc = myURL.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream())));
String inputline;
while((inputLine = in.readline()) != null)
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic