Servlet help....

I need some help trying to decipher some client/server code. The server has a servlet class, but I don't understand how that is exactly called. The client is a stand alone application, not webbased. Any ideas how the servlet is started?
I know the client application uses threads also. Let me know if more information is needed.

java_fan_69 wrote:
In the client code, there is a line of code in the run() method of a thread:
int responseCode = getClient().executeMethod(method);where getClient() is just a method that creates an HttpClient and method is a PostMethod.
The servlet I have is called DirServlet.The client is not instantiating the servlet. It is sending an HTTP request over a network socket to an address. When the server, which is listening on the socket, sees the request, it directs the request to the servlet it has running on its end. The servlet executes some code, and sends back a response over the network.

Similar Messages

  • Retrieving cell values from html in servlet - help!

    Dear all,
    I've got a table. I want to put links in each cell box. No problem. However I want to know when i've moved to my link what number cell the link came from. This is proving to be a big problem.
    Here is what i've tried:
    writer.println("<TR><TH bgcolor=\"brown\">Brown<TD id=1><li>
    <a href=BookingFromScreen>1</a></li></TD>" +
    "<TD name = \"id\" value = \"2\"><li><a href=BookingFromScreen>2</a></li></TD>".. etc...
    then picking the id's up in BookingFromScreen like this:
    String cell = request.getParameter("id");
    String cellNo= request.getParameter("value");
    System.out.println("this is the cell parameter: " +cell);
    System.out.println("this is the cell Number: " +cellNo);
    Object cell1 = request.getAttribute("id");
    String cell2 = (String)cell1;
    System.out.println("this may work: "+cell2);
    neither of these ways work, once link has been clicked all the information about that cell is lost, can anyone pleeeeeeeeeease tell me why this isn't working? both are in the doGet methods of their respective servlets if thats any help....
    thank you
    Jen C

    just use
    writer.println("<TR><TH bgcolor=\"brown\">Brown<TD id=1><li>
    <a href=BookingFromScreen?id=1>1</a></li></TD>" +
    "<TD name = \"id\" value = \"2\"><li><a href=BookingFromScreen?id=2>2</a></li></TD>"also you should be using a jsp for this

  • Trying to create object of a class within servlet - help!!

    I have created and compiled the following classes within
    C:\bea\wlserver6.1\config\mydomain\applications\DefaultWebApp\WEB-INF\classes
    1)LoginServlet
    2)LoginManager
    3)I have LoginServlet trying to create an object of type LoginManager, very simple,
    but I get the following errors:
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    4)I have the .java and .class files located within the same directory, so I don't
    see what's wrong here??? HELP!
    LoginManager looks like:
    public class LoginManager {
    public boolean authenticateUser(String username, String password){
              boolean status = false;
    //simple code for string matching
              return status;
    LoginServlet looks like:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class LoginServlet extends HttpServlet {
         // Constructors
         // Variables
         public static final String CONTENT_TYPE = "text/html";
         public boolean LOGIN_STATUS;
         // Methods
         public void service (HttpServletRequest req, HttpServletResponse res)
              throws IOException {
              String username = "";
              String password = "";
              LoginManager lm = new LoginManager();
              username = req.getParameter("username");
              password = req.getParameter("password");
              LOGIN_STATUS = lm.authenticateUser(username, password);
              res.setContentType(CONTENT_TYPE);
              PrintWriter out = res.getWriter();
              out.println("<html><head><title>Hello World</title></head>" +
                             "<body>Hello! Your login status is " + LOGIN_STATUS +
                             "</body>" +
                             "</html>");
         public void init (ServletConfig config) throws ServletException {
              super.init(config);

    Do you have . in the CLASSPATH when compiling your servlet?
    ron <[email protected]> wrote:
    I have created and compiled the following classes within
    C:\bea\wlserver6.1\config\mydomain\applications\DefaultWebApp\WEB-INF\classes
    1)LoginServlet
    2)LoginManager
    3)I have LoginServlet trying to create an object of type LoginManager, very simple,
    but I get the following errors:
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    Cannot resolve symbol: LoginManager lm = new LoginManager();
    ^
    4)I have the .java and .class files located within the same directory, so I don't
    see what's wrong here??? HELP!
    LoginManager looks like:
    public class LoginManager {
    public boolean authenticateUser(String username, String password){
              boolean status = false;
    //simple code for string matching
              return status;
    LoginServlet looks like:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class LoginServlet extends HttpServlet {
         // Constructors
         // Variables
         public static final String CONTENT_TYPE = "text/html";
         public boolean LOGIN_STATUS;
         // Methods
         public void service (HttpServletRequest req, HttpServletResponse res)
              throws IOException {
              String username = "";
              String password = "";
              LoginManager lm = new LoginManager();
              username = req.getParameter("username");
              password = req.getParameter("password");
              LOGIN_STATUS = lm.authenticateUser(username, password);
              res.setContentType(CONTENT_TYPE);
              PrintWriter out = res.getWriter();
              out.println("<html><head><title>Hello World</title></head>" +
                             "<body>Hello! Your login status is " + LOGIN_STATUS +
                             "</body>" +
                             "</html>");
         public void init (ServletConfig config) throws ServletException {
              super.init(config);
    Dimitri

  • Sending a file from Applet to servlet HELP me Please

    Sorry, i have the problem this is my code Applet & Servlet but it seems working asynchronously if you have some ideas please reply me i send bytes on outputstream but the inputstream of servlet receive nothing bytes but write my system.out.print on screen server:
    Applet:
    URL servletURL = new URL(codebase, "/InviaFile/servlet/Ricevi");
    HttpURLConnection urlConnection = (HttpURLConnection) servletURL.openConnection();
    urlConnection.setRequestMethod("POST");
    urlConnection.setUseCaches(false);
    urlConnection.setDoOutput(true);
    urlConnection.setDoInput(true);
    urlConnection.setAllowUserInteraction(false);
    urlConnection.setRequestProperty("Content-Type", "application/octet-stream");
    urlConnection.setRequestProperty("Content-length", String.valueOf(100));
    urlConnection.connect();
    if(urlConnection.HTTP_BAD_REQUEST == HttpURLConnection.HTTP_BAD_REQUEST){
    /*System.out.println("Cattiva Richiesta: "+urlConnection.getContentEncoding());
    System.out.println("Tipo di metodo: "+urlConnection.getRequestMethod());
    System.out.println("Tipo di Risposta: "+urlConnection.getResponseCode());
    System.out.println("Tipo di messaggio: "+urlConnection.getResponseMessage());
    System.out.println("Tipo di contenuto: "+urlConnection.getContentType());
    System.out.println("Tipo di lunghezza contenuto: "+urlConnection.getContentLength());
    System.out.println("Tipo di doinput: "+urlConnection.getDoInput());
    System.out.println("Tipo di doouput: "+urlConnection.getDoOutput());
    System.out.println("Tipo di URL: "+urlConnection.getURL());
    System.out.println("Tipo di propriet� richiesta: "+urlConnection.getRequestProperty("Content-Type"));
    System.out.println("Entra if");
    DataOutputStream dout = new DataOutputStream(urlConnection.getOutputStream());
    InputStream is = urlConnection.getInputStream();
    if(ritornaFile("C:/Ms.tif", dout))System.out.println("Finita lettura");
    dout.close();
    urlConnection.disconnect();
    System.out.println("Fine Applet");
    }catch(Exception e) { System.err.println(e.getMessage());e.printStackTrace();}
    public boolean ritornaFile(String file, OutputStream ots)throws Exception{
    FileInputStream f = null;
    try{
    f = new FileInputStream(file);
    byte[] buf = new byte[4 * 1024];
    int byteLetti;
    while((byteLetti = f.read()) != -1){ots.writeByte(buf, 0, byteLetti);ots.flush();
    while((byteLetti = f.read()) != -1){ots.write(byteLetti);ots.flush();
    System.out.println("byteLetti= "+byteLetti);
    return true;
    }catch(Exception ex){
    System.err.println(ex.getMessage());
    return false;
    }finally{
    if(f != null)f.close();
    Servlet:
    HttpSession ses = request.getSession(true);
    System.out.println("Passa servlet "+request.getMethod());
    System.out.println("Passa servlet "+ses.getId());
    ServletInputStream servletinputstream = request.getInputStream();
    DataInputStream dis = new DataInputStream(request.getInputStream());
    int c = dis.available();
    System.out.println("c="+c);
    //ServletOutputStream servletoutputstream
    //response.getOutputStream();
    response.setContentType("application/octet-stream");
    System.out.println("URI= "+request.getRequestURI());
    System.out.println("pathTranslated: "+request.getPathTranslated());
    System.out.println("RemoteUser: "+request.getRemoteUser());
    System.out.println("UserInRole: "+String.valueOf(request.isUserInRole("")));
    System.out.println("pathInfo: "+request.getPathInfo());
    System.out.println("Protocollo: "+request.getProtocol());
    System.out.println("RemoteAddr:"+request.getRemoteAddr());
    System.out.println("RemoteHost:"+request.getRemoteHost());
    System.out.println("SessionID:"+request.getRequestedSessionId());
    System.out.println("Schema:"+request.getScheme());
    System.out.println("SeesionValido:"+String.valueOf(request.isRequestedSessionIdValid()));
    System.out.println("FromURL:"+String.valueOf(request.isRequestedSessionIdFromURL()));
    int i = request.getContentLength();
    System.out.println("i: "+i);
    ritornaFile(servletinputstream, "C:"+File.separator+"Pluto.tif");
    System.out.println("GetMimeType= "+getServletContext().getMimeType("Ms.tif"));
    InputStream is = request.getInputStream();
    int in = is.available();
    System.out.println("Legge dallo stream in="+in);
    DataInputStream diss = new DataInputStream(servletinputstream);
    int ins = diss.read();
    System.out.println("Legge dallo stream ins="+ins);
    int disins = diss.available();
    System.out.println("Legge dallo stream disins="+disins);
    is.close();
    System.out.println("Fine Servlet");
    catch(Exception exception) {
    System.out.println("IOException occured in the Server: " + exception.getMessage());exception.printStackTrace();
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    public void ritornaFile(InputStream its, String fileDest )throws Exception{
    FileOutputStream f = null;
    try{
    f = new FileOutputStream(fileDest);
    byte[] buf = new byte[2 * 1024];
    int byteLetti;
    while((byteLetti = its.read()) != -1){
    f.write(buf, 0, byteLetti);
    f.flush();
    System.out.println("Byteletti="+byteLetti);
    }catch(Exception ex){
    System.err.println(ex.getMessage());
    }finally{
    if(f != null)f.close();

    Hi all,
    Can anyone help me.I am trying to send an audio file from a applet to servlet with HTTP method(no raw sockets), also the servlet shld be able to save the file on the server.Any suggestions welcome.USing audiostream class from javax.sound.sampled.
    The part of applet code which calls servlet is :
    URL url = new URL("http://" + host + "/" + context + "/servlet/UserUpdateWorkLogAudio?userid=" + userId.replace(' ', '+') + "&FileName=" + filename.replace(' ', '+'));
    URLConnection myConnection = url.openConnection();
    myConnection.setUseCaches(false);
    myConnection.setDoOutput(true);
    urlConnection.setRequestProperty("Content-Type", "application/octet-stream");
    myConnection.connect();
    out = new BufferedOutputStream(myConnection.getOutputStream());
    AudioSystem.write(audioInputStream, fileType,out); // IS THIS RIGHT APPROACH?
    ************************end of applet code**********************
    ************************servlet code******************************
    try
    {BufferedInputStream in = new BufferedInputStream(request.getInputStream());
    ????????What code shld i write here to get the audio file stream
    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(filename));
    *********************************************end***********************
    Thanks
    Joe.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • WAP/Servlet help is needed URGENT!!!

    I've wrote this little wap-application, which update the library loans via mobile phones. I don't know why my login doesn't work properly (it gives error-messages in any cases). I believe I did everything right.
    Can anyone PLEASE help me finding my mistakes!? I give all my dukes for working version of mine application.
    This are my codes:
    Servlet-class
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    public class Uusinta extends HttpServlet {
    Connection conn;
    String TUNNUS = "2000000112222";
    String user = null;
    boolean yhteys = false;
    static String [] otsikko = {
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>",
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"> " ,
    "<wml>" ,
    "<!-- Possible <head> elements here. --> " ,
    "<template>" ,
    "<do type=\"accept\" label=\"Ok\" name=\"back\" >" ,
    "<prev/>" ,
    "</do>" ,
    "</template>" ,
    "<card id=\"welcome\" title=\"WAP-kirjasto\" newcontext=\"true\">" ,
    "<do type=\"accept\" name=\"back\"><noop/>" ,
    "</do>" ,
    "<p align=\"center\"><strong>TERVETULOA</strong></p>",
    "<p><br/>Kirjastokortin numero:<br/>" ,
    "<input type=\"text\" name=\"numero\" size=\"11\" format=\"*N\" maxlength=\"13\"/><br/>" ,
    "Salasana:<br/>" ,
    "<input type=\"text\" name=\"salasana\" size=\"4\" format=\"*N\" maxlength=\"4\"/><br/>" ,
    "<a href=\"skripti.wmls#Login('$(numero)','$(salasana)','kayttaja')\">Sisaan </a></p>" ,
    "</card>" ,
    "<card id=\"loginError\">" ,
    "<do type=\"prev\" label=\"Back\">" ,
    "<go href=\"#welcome\"/>" ,
    "</do>" ,
    "<p align=\"center\"><br/>Korttinumero tai salasana on vaara.</p>" ,
    "</card>" ,
    "<card id=\"lainat\" newcontext=\"true\">" ,
    "<do type=\"accept\" name=\"back\"><noop/>" ,
    "</do>" ,
    "<do type=\"options\" label=\"Lopeta\">" ,
    "<go href=\"#goodbye\"/>" ,
    "</do>" ,
    "<p><b>Lainatut kirjat:</b></p><p> " ,
    "<select name=\"item\" title=\"Lista\">"};
    static String [] r2 = {
    "</select>" ,
    "<br/><a href=\"skripti.wmls#uusiNide('$(item)','valittu')\">Uusi valittu</a><br/>" ,
    "<a href=\"skripti.wmls#uusiKaikki()\">Uusi kaikki</a></p>" ,
    "</card>" ,
    "<card id=\"virhe\">" ,
    "<p>Kirjan uusiminen ei onnistunut. Yrit&#xE4; uudelleen.</p>" ,
    "</card>" ,
    "<card id=\"uusittu\">" ,
    "<do type=\"prev\" label=\"Back\">",
    " <go href=\"#lainat\"/>",
    "</do>",
    "<p align=\"center\"><br/>Kirja on uusittu.</p>" ,
    "</card>" ,
    "<card id=\"virheet\">" ,
    "<p>Kirjojen uusiminen ei onnistunut. Yrit&#xE4; uudelleen.</p>" ,
    "</card>" ,
    "<card id=\"uusitut\">" ,
    "<do type=\"prev\" label=\"Back\">",
    " <go href=\"#goodbye\"/>",
    "</do>",
    "<p align=\"center\"><br/>Kirjat on uusittu.</p>" ,
    "</card>" ,
    "<card id=\"goodbye\" newcontext=\"true\">" ,
    "<do type=\"accept\" name=\"back\"><noop/>" ,
    "</do>" ,
    "<p align=\"center\"><br/>Kiitos k�ynnist�. Ja tervetuloa uudelleen.</p>" ,
    "</card>" ,
    "</wml>"};
    private void teeWML(PrintWriter out)
    Statement stmt;
    ResultSet result;
    boolean ok = false;
    for (int i = 0; i <otsikko.length;i++)
         out.println(otsikko);
         if(yhteys)
    try {
    stmt= conn.createStatement();
    result = stmt.executeQuery("Select * FROM lainat l join kirja k on l.nide = k.nide where tunnus = '"+this.user+"'");
    int cnt = 1;
    while(result.next())
              ok = true;
                   String nimi ="";
         if(result.getString("nimi").length() > 8)
         nimi = result.getString("nimi").substring(0,8) + "...";
         else
         nimi = result.getString("nimi");
              out.println("<option value=\""+result.getString("l.nide")+"\">"+nimi+":"
              result.getString("erapaiva")"</option>");
    result.close();
    stmt.close();
    }catch (SQLException ex) {
    System.out.println ("\nSQLException:");
    while (ex != null) {
    System.out.println ("SQLState: "+ ex.getSQLState());
    System.out.println ("Message: "+ ex.getMessage());
    System.out.println ("Vendor: "+ ex.getErrorCode());
    ex = ex.getNextException();
    else
              out.println("<option value=\"0\">nothing</option>");
         for (int i = 0; i <r2.length;i++)
              out.println(r2[i]);
    out.close();
    private void uusiNide(PrintWriter out, String nide)
    Statement stmt;
    ResultSet result;
    boolean ok=false;
         try {
    stmt= conn.createStatement();
    result = stmt.executeQuery("Select nide from lainat where tunnus='"+user+"' ");
    int cnt = 1;
    while(result.next())
              ok = true;
    result.close();
    stmt.close();
         if(ok)
              String pvm = getPvm();
              stmt = conn.createStatement();
              int a = stmt.executeUpdate("update lainat set erapaiva='"+pvm+"' where tunnus='"+user+"' AND nide='"+nide+"'");
    }catch (SQLException ex) {
    System.out.println ("\nSQLException:");
    while (ex != null) {
    System.out.println ("SQLState: "+ ex.getSQLState());
    System.out.println ("Message: "+ ex.getMessage());
    System.out.println ("Vendor: "+ ex.getErrorCode());
    ex = ex.getNextException();
         if(ok) {
         out.println("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">");
              out.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><title>koe</title></head><body><p>OKnide</p></body></html>");
    private void uusiKaikkiNiteet(PrintWriter out)
    Statement stmt;
    ResultSet result;
    boolean ok=false;
    //t�h�n tulee viel� korttinumero
         try {
              String pvm = getPvm();
         stmt = conn.createStatement();
              int a = stmt.executeUpdate("update lainat set erapaiva='"+pvm+"' where tunnus='"+user+"'");
    }catch (SQLException ex) {
    System.out.println ("\nSQLException:");
    while (ex != null) {
    System.out.println ("SQLState: "+ ex.getSQLState());
    System.out.println ("Message: "+ ex.getMessage());
    System.out.println ("Vendor: "+ ex.getErrorCode());
    ex = ex.getNextException();
    if(ok) {
              out.println("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">");
              out.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><title>koe</title></head><body><p>OKKaikki</p></body></html>");
    private void tarkKayttaja(PrintWriter out, String kayttaja, String password)
    Statement stmt;
    ResultSet result;
    boolean ok=false;
    String nimi = null;
    if(user !=null && password !=null)
    int salasana = Integer.parseInt(password);
    try {
    stmt= conn.createStatement();
    result = stmt.executeQuery("Select * from kortti where numero='"+kayttaja+"' and salasana="+salasana);
    while(result.next())
              ok = true;
              nimi = result.getString("nimi");
    }catch (SQLException ex) {
         System.out.println ("\nSQLException:");
         while (ex != null) {
         System.out.println ("SQLState: "+ ex.getSQLState());
         System.out.println ("Message: "+ ex.getMessage());
         System.out.println ("Vendor: "+ ex.getErrorCode());
         ex = ex.getNextException();
         if(ok) {
                   this.user= kayttaja;
                   yhteys = true;
                   //teeWML(out);
         out.println("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">");
              out.println("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><title>koe</title></head><body><p>OK</p></body></html>");
              //out.close();
         teeWML(out);
    public void init(ServletConfig cfg) throws ServletException
    try{
    Driver d = (Driver)Class.forName("com.mysql.jdbc.Driver").newInstance();
    String sCon = "jdbc:mysql://localhost/kirjasto?user=oppilas&password=oppix";
    conn = DriverManager.getConnection(sCon);
    }catch(Exception e){
    System.out.println ("Exception: "+ e.getMessage());
    throw new ServletException(e.getMessage());
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws IOException, ServletException
    PrintWriter out = null;
         String kutsu = req.getParameter("toiminto");
         String uusinta = req.getParameter("uusinta");
         String password = req.getParameter("password");
         String kayttaja = req.getParameter("user");
         if (kutsu == null) {
         res.setContentType("text/vnd.wap.wml");
         out = res.getWriter();
              tarkKayttaja(out, null, null);
         if(kutsu.equalsIgnoreCase("login")) {
         res.setContentType("text/html");
         out = res.getWriter();
              tarkKayttaja(out, kayttaja, password);
         if(kutsu.equalsIgnoreCase("uusi")) {
         res.setContentType("text/html");
         out = res.getWriter();
              uusiNide(out, uusinta);
         if(kutsu.equalsIgnoreCase("uusiKaikki")){
              res.setContentType("text/html");
              out = res.getWriter();
              uusiKaikkiNiteet(out);
    public void destroy()
    try{
    conn.close();
    }catch(SQLException e){
    System.out.println ("\nSQLException:");
    System.out.println ("SQLState: "+e.getSQLState());
    System.out.println ("Message: "+ e.getMessage());
    System.out.println ("Vendor: "+ e.getErrorCode());
    public String getPvm()
         Calendar x = Calendar.getInstance();
         x.add(Calendar.DATE, 30);
              int Day = x.get(Calendar.DAY_OF_YEAR);
              Day = Day+30;
              x.set(Calendar.DAY_OF_YEAR, Day);
              int monthDue = x.get(Calendar.MONTH);
              int dayOfMonthDue = x.get(Calendar.DAY_OF_MONTH);
              int yearDue = x.get(Calendar.YEAR);
                   System.out.println(yearDue+"-"+monthDue+"-"+dayOfMonthDue);
              return (yearDue+"-"+monthDue+"-"+dayOfMonthDue);
    skriptit.wmls
    extern function uusiNide(prmIn,valittu) {
         var str, result, okInd, pInd;
         str = "http://localhost:8080/kirjasto/loans?toiminto=uusi&uusinta=" +URL.escapeString(prmIn);
         var load = URL.loadString(str,"text/html");
         okInd =String.find(load, "OKnide");
         if( okInd != -1 ) {
              result = WMLBrowser.setVar(valittu, prmIn);
              WMLBrowser.go("#uusittu");
         else {
              WMLBrowser.go("#virhe");
         return "";
    extern function uusiKaikki() {
         var str, result, okInd, pInd, val, valittu;
         str = "http://localhost:8080/kirjasto/loans?toiminto=uusiKaikki&uusinta=";
         var load = URL.loadString(str,"text/html");
         okInd =String.find(load, "OKKaikki");
         if( okInd != -1 ) {
              WMLBrowser.go("#uusitut");
         else {
              WMLBrowser.go("#virheet");
         return "";
    extern function Login(prmNum, prmPass, kayttaja) {
         var str, result, okInd, pInd, pos, nimi;
         str = "http://localhost:8080/kirjasto/loans?toiminto=login&user="+URL.escapeString(prmNum)+"&password="+URL.escapeString(prmPass);
         var load = URL.loadString(str,"text/html");
         okInd =String.find(load, "OK");
         if( okInd != -1 ) {     
              pos = String.find(load, "</p");
              nimi = String.subString(load,(okInd + 7), (pos - okInd -7));
              result = WMLBrowser.setVar(kayttaja, nimi);
              WMLBrowser.go("#lainat");
         else {
              WMLBrowser.go("#loginError");
         return "";
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
    'http://java.sun.com/j2ee/dtds/web-app_2_3.dtd'>
    <web-app>
    <display-name>Verkkopizzeria</display-name>
    <servlet>
    <servlet-name>Vastaa</servlet-name>
    <servlet-class>Vastaa</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>Uusinta</servlet-name>
    <servlet-class>Uusinta</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Vastaa</servlet-name>
    <url-pattern>/vastaa</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>Uusinta</servlet-name>
    <url-pattern>/loans</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    DB create and inserts
    create table kortti(
    numero char(13) not null,
    nimi char(25),
    osoite char(25),
    postinro int(5),
    puhelin char(15),
    salasana int(4),
    primary key(numero)
    create table kirja(
    nide char(10) not null,
    nimi char(25) not null,
    tekija char(25) not null,
    vuosi int(4) not null,
    primary key(nide)
    create table lainat(
    tunnus char(13) not null,
    nide char(10) not null,
    erapaiva date not null,
    primary key (tunnus, nide),
    foreign key (tunnus) references kortti,
    foreign key (nide) references kirja );
    insert into kortti
    (numero, nimi, osoite, postinro, puhelin, salasana)
    values
    ('2000000112222', 'Aku Ankka', 'Akunkatu 11', 00980, '0401231234', 2222);
    insert into kortti
    (numero, nimi, osoite, postinro, puhelin, salasana)
    values
    ('2000000113333', 'Roope Set�', 'Mikonkatu 11', 00100, '0405552223', 3333);
    insert into kortti
    (numero, nimi, osoite, postinro, puhelin, salasana)
    values
    ('2000000114444', 'Mikki Hiiri', 'Kissankuja 5', 00930, '04009876545', 4444);
    insert into kortti
    (numero, nimi, osoite, postinro, puhelin, salasana)
    values
    ('2000000115555', 'Ville Vallaton', 'Mestarinrinne 4', 00310, '0952223335', 5555);
    insert into kirja
    (nide, nimi, tekija, vuosi)
    values
    ('1111-85555','Wap', 'Pekka Niskanen', 2000);
    insert into kirja
    (nide, nimi, tekija, vuosi)
    values
    ('1111-45345','Java 2', 'Pekka Niskanen', 2002);
    insert into kirja
    (nide, nimi, tekija, vuosi)
    values
    ('1111-64648','J�rki ja tunteet', 'Jane Austin', 1998);
    insert into kirja
    (nide, nimi, tekija, vuosi)
    values
    ('1111-15671','Rikos ja rangastus', 'Leo Tolstoy', 1998);
    insert into kirja
    (nide, nimi, tekija, vuosi)
    values
    ('1111-85554','Inside Wap', 'Pekka Niskanen', 2002);
    insert into lainat
    (tunnus, nide, erapaiva)
    values
    ('2000000112222', '1111-85555', '2004-5-01-11');
    insert into lainat
    (tunnus, nide, erapaiva)
    values
    ('2000000112222', '1111-45345', '2004-5-01-11');
    insert into lainat
    (tunnus, nide, erapaiva)
    values
    ('2000000112222', '1111-64648', '2004-5-01-12');
    insert into lainat
    (tunnus, nide, erapaiva)
    values
    ('2000000113333', '1111-85554', '2004-5-01-11');
    insert into lainat
    (tunnus, nide, erapaiva)
    values
    ('2000000114444', '1111-15671', '2004-5-01-12');

    So many things wrong with this post... from [url http://www.catb.org/~esr/faqs/smart-questions.html#urgent]How to Ask Questions the Smart Way:
    Don't flag your question as ?Urgent?, even if it is for you
    That's your problem, not ours. Claiming urgency is very likely to be counter-productive: most hackers will simply delete such messages as rude and selfish attempts to elicit immediate and special attention.
    There is one semi-exception. It can be worth mentioning if you're using the program in some high-profile place, one that the hackers will get excited about; in such a case, if you're under time pressure, and you say so politely, people may get interested enough to answer faster.
    This is a very risky thing to do, however, because the hackers' metric for what is exciting probably differ from yours. Posting from the International Space Station would qualify, for example, but posting on behalf of a feel-good charitable or political cause would almost certainly not. In fact, posting ?Urgent: Help me save the fuzzy baby seals!? will reliably get you shunned or flamed even by hackers who think fuzzy baby seals are important.
    If you find this mysterious, re-read the rest of this how-to repeatedly until you understand it before posting anything at all.
    Be precise and informative about your problem
    Describe the symptoms of your problem or bug carefully and clearly.
    Describe the environment in which it occurs (machine, OS, application, whatever). Provide your vendor's distribution and release level (e.g.: ?Fedora Core 1?, ?Slackware 9.1?, etc.).
    Describe the research you did to try and understand the problem before you asked the question.
    Describe the diagnostic steps you took to try and pin down the problem yourself before you asked the question.
    Describe any recent changes in your computer or software configuration that might be relevant.
    Do the best you can to anticipate the questions a hacker will ask, and to answer them in advance in your request for help.
    Simon Tatham has written an excellent essay entitled How to Report Bugs Effectively. I strongly recommend that you read it.
    Volume is not precision
    You need to be precise and informative. This end is not served by simply dumping huge volumes of code or data into a help request. If you have a large, complicated test case that is breaking a program, try to trim it and make it as small as possible.
    This is useful for at least three reasons. One: being seen to invest effort in simplifying the question makes it more likely that you'll get an answer, Two: simplifying the question makes it more likely you'll get a useful answer. Three: In the process of refining your bug report, you may develop a fix or workaround yourself
    And from [url http://www.thejword.com]The J Word:
    Code Tags
    When you post code, please use [code] and [/code] tags as described in Formatting Help on the message entry page. It makes it much easier to read.

  • How to authenticate  a Servlet-- HELP!!!!!!!!

    I have a Java client that try to contact with a servlet using a user and a password.
    I know that the authentication is correct, because the message "User OK" (showed
    below) appear, but I don't know what to do now to obtain an UrlConnection with
    the servlet.
    Every time a do conn = url.openConnection(), I obtain this exception:
    java.io.FileNotFoundException: http://localhost:80/myappp/server
    Please, help me!!!!!!!
    The code is:
    try{
    URL url = new URL("http://"+ host+":"+port+"/myapp/server");
    Environment env = new Environment();
    env.setProviderUrl("t3://localhost:80/myapp/server");
    env.setSecurityPrincipal("system");
    env.setSecurityCredentials("password");
    Subject s = new Subject();
    Context ctx = null;
    ctx = env.getInitialContext();
    Authenticate.authenticate(env, s);
    ctx.lookup("");
    System.out.println("User OK");
    conn = url.openConnection();
    catch (Exception e)
    {System.out.println("User not authenticated :" + e.toString();}
    Thank you very much,
    Ivan

    No, well not how you've described it.
    Instead Do your implementation as a bean, then use that bean in your servlet and in your 'class' (application/applet).

  • JSP and Servlet - help please

    Hello,
    I am making this feedback for fun and a bit of learning too. I have an INDEX.JSP page, where the user selects the very first option. Depending upon the selected option he is moved another page PRODUCTFEEDBACK.JSP (so far I have completed this). Here as usual there are many fields to be filled in. As a spams protection i have done this;
    I have a AdditionClass, which is a seperate class where two number are generated at random. This numbers are called by PRODUCTFEEDBACK.JSP. The user is then asked to perform the addition. The completed form is then sent to ProductFeedback servlet.
    When I compile my PRODUCTFEEDBACK.JSP I get this error. Can you please tell whats wrong?
    PRODUCTFEEDBACK.JSP
          *<td>Please help us to prevent Spams by performing this simple mathematical Calculation. We appreciate your effort </td>*
        *</tr>*
      *</table>*
      *<jsp:useBean id = "AddTest" class = "go.AdditionClass" />*
      *<table width="53%"  border="0" align="center">*
        *<tr>*
          *<td><div align="center">*
      *<input name="textfield8" type="text" size="3" value ="<jsp:getProperty name="AddTest" property = "randNum1" />">*
    *  + * 
      *<input name="textfield9" type="text" size="3" value="<jsp:getProperty name="AddTest" property = "randNum2" />">*
    *  = *
    *<input name="_total" type="text" size="5">*
          </div></td>
        </tr>
        <tr>
          <td> </td>
        </tr>
      </table>
      <br>
      <table width="37%" height="23"  border="0" align="center">
        <tr>
          <td width="33%"> </td>
          <td width="67%"><input type="submit" name="Submit" value="Click here to send us this form"></td>
    AdditionalClass.java
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package go;
    import java.util.Random;
    * @author MAC
    public class AdditionClass {
        Random generator = new Random();
        int randNum1; // First Random Number
        int randNum2; // Second Random Number
        public void SetNum1(){
            randNum1 = generator.nextInt(10); // Generate First Random Number
        public int getNum1(){
            return randNum1; //Return First Random Number
        public void SetNum2(){
            randNum2 = generator.nextInt(10); // Generate Second Random Number
        public int getNum2(){
            return randNum2; // Return Second Random Number
        // send the Random Numbers to ProductFeedback class
        public void productFeedbackRandNum1(){
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber1(randNum1);
        public void productFeedbackRandomNum2(){
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber2(randNum1);
    }Erros that I am getting:
    org.apache.jasper.JasperException: Cannot find any information on property 'randNum1' in a bean of type 'go.AdditionClass'
    C:\Documents and Settings\MAC\My Documents\NetBeansProjects\FeedBack\nbproject\build-impl.xml:462: The following error occurred while executing this line:
    C:\Documents and Settings\MAC\My Documents\NetBeansProjects\FeedBack\nbproject\build-impl.xml:440: Java returned: 1
    BUILD FAILED (total time: 1 second)

    Thank you for replying. I modified my Bean class then what is posted above, so thought to repost the code again and seek help. There seems to be no error now but it just dont generate any random numbers, All i get very time is 0. I am wondering, is my code generating 0 as random number, every time :-)
    package go;
    import java.util.Random;
    public class AdditionBean {
        int randNum1; // First Random Number
        int randNum2; // Second Random Number
        public void generateRandomNum1(){
            Random generator = new Random();
            int num1 = generator.nextInt(10);
            SetRandNum1(num1);
            // Send num1 value to ProductFeedback.java
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber1(num1);
        } // End of generaeRandomNum1
        public void generateRandomNum2(){
            Random generator = new Random();
            generator = new Random();
            int num2 = generator.nextInt(10);
            SetRandNum2(num2);
            // Send num1 value to ProductFeedback.java
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber2(num2);
        } // End of generateRandomNum2
        public void SetRandNum1(int num1){
            randNum1 = num1;
        public int getRandNum1(){
            return randNum1; //Return First Random Number
        public void SetRandNum2(int num2){
            randNum2 = num2;
        public int getRandNum2(){
            return randNum2; // Return Second Random Number
    }// End of classThank you,

  • Javascript in servlets help???

    Hi everyone just have a look at the folloeing code..
    //function next
         out.println("function next(){");
         rs.next();
         out.println("window.document.frm1.qno.value="+rs.getString(1));
              out.println("window.document.frm1.ques.value=\""+rs.getString(2)+"\"");
         out.println("}");
    out.println("<input type=\"button\" value=\"Next\" onclick=next()>");whenever I press next button I am only able to get second row
    How can I move my resultset to next row each time I press "next" button

    java.venkat wrote:
    I am very sorry I didnt get back to this thread because I didnt add this to my watchlist
    I started my project in servlets , Now I can't convert to JSPs.
    Including javascript in servlets is becoming very headache for me...Why can't you convert to JSPs? Trust me, you don't want to be doing this in servlets, it's madness. Begin with JSPs immediately, you'll save more time and effort and frustration than you can imagine.
    >
    I got a new problem
    out.println("<form name=frm1 action=Cone>");
    out.println("<input type=\"submit\" value=\"Submit\" onClick=\"validate()\" >");
    out.println("function validate()");
    out.println("{");
    out.println("if(document.main.name.value==\"\"||document.main.address.value==\"\")");
    out.println("alert(\"Please Enter Your Username and Password\"\n)");
    out.println("}");Now whenever Submit button is clicked "validate()" is exceuted and an alert box is shown. and servlet is also executing
    How can I stop servlet to execute when validate is executed..This is a JavaScript problem, not the right place for it.
    You need to return true/ false from your JavaScript function depending on if you want to allow the action or stop it.
    And where the function is called make a change:
    <input type="submit" value="Submit" onClick="return validate();" >The return keyword will pass the value returned by validate() to the onClick() event handler and stop the propogation of the submit event if the value is false. If it's true,it'll continue.
    And please, once again, for God's sake, do yourself a favour and switch to JSPs!
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • Jdbc-servlet help!!!!!!!!

    excuse my english.
    hey folks, i got this problem:
    i`m trying to do a simple servlet that`s throw a html with a result, but i always got this error:
    java.lang.NullPointerException
    at ConsultaServlet.doPost(ConsultaServlet.java:45)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    THIS IS THE CODE I HAVE:
    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HolaServlet extends HttpServlet {
    private Connection con;
    private PrintWriter out;
    private Statement stmt;
    public void init(ServletConfig conf)
    throws ServletException {
    super.init(conf);
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con =DriverManager.getConnection("jdbc:odbc:MS Access Database");
    }catch(Exception e) {
    System.err.println(e);
    public void service(HttpServletRequest req,
    HttpServletResponse res)
    throws ServletException, IOException {
    res.setContentType("text/html");
    try {   
    out = res.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title> Sample JDBC Servlet Demo" +
    "</title>");
    out.println("</head>");
    out.println("<body>");
    stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("select * from empleados");
    out.println("<UL>");
    while(rs.next()) {
    out.println("<LI>" + rs.getString("nombre"));
    out.println("</UL>");
    rs.close();
    stmt.close();
    } catch(SQLException e) {
    out.println("An SQL Exception was thrown.");
    } catch(IOException e) {
    System.err.println("An IOException was thrown.");
    out.println("</body>");
    out.println("</html>");
    out.close();
    public void destroy(){
    try{
    con.close();
    }catch(SQLException e) {
    Can someone tell me what i`m doing wrong.
    THANK.

    Hi,
    I have intalled the Javawebserver2.0
    Its been installed on C:\javawebserver2.0.
    After this I have set the autoexec.bat path as
    PATH C:\WINDOWS;C:\WINDOWS\COMMAND;C:\ORAWIN95\bin;c:\Oracle\Ora81\bin;"C:\ProgramFiles\Oracle\jre\1.1.7\bin";c:\j2sdk1.4.2_04\bin;c:\JavaWebServer2.0\bin;c:\Jsdk2.0\bin
    rem - By Windows 98 Network for Netware Upgrade - c:\windows\odihlp.exe
    set classpath=.;c:\j2dsk1.4.2_04\jre\lib;c:\j2dsdk1.4.2_04\lib;c:\j2sdk1.4.2_04\bin;c:\JavaWebServer2.0\lib;c:\Jsdk2.0\lib
    rem -;c:\jsdk2.1\src ;c:\jsdk2.1\lib;c:\Jsdk2.0\src
    After doing this I wrote my first servlet program in the servlets directory of javawebserver2.0 saved and when I went to compile its not compiling throwing an error showing that it is unable to locate all the servlet packages. So in I thought might be there are 2 things one is either I have not imported javax.servlet.* and javax.servlet.httpServlet.* package, but I had included it, the next thing was to check the autoexec.bat path. I included in that javawebserver2.0 path. Now first I am not able to compile the servlet program. Can you help me with it.
    I had downloaded jsdk2 from net and have given its path also in the autoexec but nothing is happening. I am using the following package to write and develop Java programs "j2sdk1.4.2_04". Can you explain to where I am going wrong. Please its a bit urgent.
    Following is the program:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class helloWorld extends HttpServlet
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException
    res.setContentType("text/html");
    PrintWriter out=res.getWriter();
    out.println("<html>");
    out.println("<head><Title>Hello World</title></head>");
    out.println("<body><big>Hello World</big>");
    out.println("</body>");
    out.println("</html>");
    Help!!!!!!!!

  • Exception in AdminRealm servlet, help needed

    I am trying to install the WebLogic LDAP realm, but I get an exception
    when I try to test the LDAP realm using the AdminRealm servlet.
    Through wlpsadmin, I managed viewing groups and search users, but the
    LDAP tab displays no values and I could not login to my portal with
    users defined in the LDAP server.
    I attached the HTML file returned by the server after calling
    AdminRealm.
    Any Ideas ?
    10x, Eli Kaplan.
    [att1.html]

    Hi Eli
    In the portal definition in your weblogic.properties file, there is a
    property called groupname, set this to the name of your LDAP group, this
    should solve the problem.
    May
    "Eli Kaplan" <[email protected]> wrote in message
    news:[email protected]
    Hi,
    I solved the exception by deleteing the users and groups from the LDAP
    server and defining them again.
    Another question : I want to allow login to my portal only to certain
    groups of users that are defined in my LDAP server, however - all the
    users, regardless of their groups, are able to login currently...
    What should I do to allow login only to some groups, and not to others ?
    Thanks again, Eli.
    Eli Kaplan wrote:
    I am trying to install the WebLogic LDAP realm, but I get an exception
    when I try to test the LDAP realm using the AdminRealm servlet.
    Through wlpsadmin, I managed viewing groups and search users, but the
    LDAP tab displays no values and I could not login to my portal with
    users defined in the LDAP server.
    I attached the HTML file returned by the server after calling
    AdminRealm.
    Any Ideas ?
    10x, Eli Kaplan.
    An Exception occurred:
    java.lang.NullPointerException:
    at
    weblogic.security.ldaprealm.LDAPDelegate.magicBunny(LDAPDelegate.java:292)
    atweblogic.security.ldaprealm.LDAPDelegate.addGroupMember(LDAPDelegate.java:61
    1)
    atweblogic.security.ldaprealm.LDAPDelegate.getGroupMembers(LDAPDelegate.java:5
    75)
    atweblogic.security.ldaprealm.LDAPDelegate.getGroupMembers(LDAPDelegate.java:5
    18)
    atweblogic.security.ldaprealm.LDAPRealm.getGroupMembersInternal(LDAPRealm.java
    :81)
    atweblogic.security.acl.AbstractListableRealm.getGroupMembers(AbstractListable
    Realm.java:302)
    atweblogic.security.acl.FlatGroup.ensureFreshness(FlatGroup.java:149)
    at weblogic.security.acl.FlatGroup.members(FlatGroup.java:236)
    at admin.AdminRealm.composePage(AdminRealm.java:176)
    at admin.AdminServlet.service(AdminServlet.java:257)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :105)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:742)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:686)
    atweblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
    Manager.java:247)
    atweblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
    atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    [Home][Event topics][Event registrations][JDBC info][Licenses]
    [Properties][Workspaces][Connections][Threads][Versions][Realm][Help]
    [Image]
    [Image]
    [WebLogic home]
    WebLogic Realm for [email protected]
    [Image]
    [Home][Event topics][Event registrations][JDBC info][Licenses]
    [Properties][Workspaces][Connections][Threads][Versions][Realm][Help]

  • Servlet to servlet help

    I've searched the archive and read through tons of older posts but I'm still struggling. I think what I'm trying to do is fairly easy, but I'm having trouble setting it up correctly.
    There's an existing servlet that could be called from a link like this:
    href="https://servername/servlet/LoginServlet?LoginName=xyzname&password=xyzpassword
    I would like to call this servlet from my servlet(on the same server) and I need to grab the response from the servlet I call. Assuming I get the calling part fixed, how do I see what the response is?
    Can anyone help me set this up? Right now I get errors on the request line when I try to compile it. Here's what I'm trying so far, I assume I'm not setting it up correctly:
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class StoneURLLoginS2S extends HttpServlet {
         public void doGet (HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException
              String username = request.getParameter("username");
              String password = request.getParameter("password");
              request.getRequestDispatcher("/servlet/LoginServlet?loginName=" + username + "&password=" + password).forward(request,response);
    }All help is greatly appreciated.
    James

    I know I've jumped all over the place on this post, and I'm about to do it again. Sorry.
    I have the following code:
    mport java.util.*;
    import java.io.*;
    import java.net.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.stoneware.servlets.*;
    import com.stoneware.beans.*;
    public class StoneURLLogin extends StonewareServlet {
         private StonewareBean swBean = new StonewareBean();
         public void init( ServletConfig config ) throws ServletException {
              super.init( config );
         public void service( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
              String username = request.getParameter("username");
              String password = request.getParameter("password");
              //String link = request.getParameter("link");
              //String key = request.getParameter("key");
              String sessionID = swBean.authenticateUserNoContext(username, password);
              if( swBean.isAuthenticated( sessionID ) == false ) {
                   System.out.println( "User not authenticated." );
                   return;
              if( swBean.isAccountDisabled( sessionID ) == true ) {
                   System.out.println( "User account is disabled." );
                   return;
              System.out.println( "The user is authenticated." );
         public String getServletInfo() {
              return "Simple authentication servlet.";
    }I get the following error when I compile.
    C:\Temp\Java>javac StoneURLLogin.java
    StoneURLLogin.java:34: isAccountDisabled(javax.servlet.http.HttpServletRequest) in com.stoneware.beans.StonewareBean cannot be applied to (java.lang.String)
    if( swBean.isAccountDisabled( sessionID ) == true ) {
    ^
    1 error
    If I comment out that section I then get the following error:
    C:\Temp\Java>javac StoneURLLogin.java
    StoneURLLogin.java:14: unreported exception com.stoneware.StonewareException; must be caught or declared to be thrown
    private StonewareBean swBean = new StonewareBean();
    ^
    1 error
    Obviously you don't have the docs for these classes, but it seems like something different than that. Like I'm missing something more fundamental here. Can anyone see it? Is there something wrong with how I declared swBean?
    Thanks,
    James

  • NIM game servlet help...

    I'm trying to make a NIM game servlet for class, but i'm having trouble with it.
    It's supposed to have a main pile of 21 'sticks' and the player can draw 1-3 sticks, there is a computer player too. so i have to make something simple with radio buttions for 1,2 or 3 sticks and then the servlet does that computation, plus the computer players. In the end the person who can't draw a stick loses...
    I assume i have to make an html front end page with the parameters, then have a hidden variable or cookie keeping track of the pile?
    I know java applets, but I get confused with servlets... any help would be great, thanks.
    jon.

    servlets are on server-side (in opposite to applets).
    maybe you have a look at pdf.coreservlets.com where you can download a really good ebook for free. it gives you a introduction to servlets on how to use it.

  • HelloWorld servlet help !

    Hi,
    I compiled the simple HelloWorld.java and put it under /jakata-install-dir/webapps/webapp1/WEB-INF/classes/HelloWorld.class
    Then, started the tomcat and this
    http://localhost:8080/webapp1/servlet/HelloWorld
    gave 404 error ??? file not found ???
    Pls help. thanks.
    P

    I agree tomcat is fussy !!!
    Yes, the webapps/examples/WEB-INF/classes works, but
    I want to create a new application name say webapp1 to replace the name of "examples" above, then it failed !
    I guess there must be some configuration needed to add a new application name after /install-dir/webapps/ ?
    Moreover, I can't even log into administration page without the username and password. Cant found them ?!
    P

  • Portlets vs. Servlets - Help!!!!!!!!!!!!!!!!!!!!!

    1- How can i forwad a resquest to .jsp file at portlets as in
    the Servlets?
    2- How can I get a HttpServletRequest / HttpServletResponse and
    others "Servlets Objects" references in a Class extends
    BaseManagedRenderer and others PDK classes.....?
    3- How can i get the defaults Portal navigation menu links value
    s as: Navigator, Home, Help, Customize Page, Account Info,
    Logout and etc... to build a personalized menu in my
    application?
    Isaac

    If your "many java classes and methods" are written properly it should not make any difference if the data comes from a html form or the command prompt, all it should need is the right data. Generally this data will be passed in using a bean or by calling setters on the class itself.
    So if your class is taking data from the command prompt directly I suggest you abstract that away: put the command prompt code in your main() method and add setters to your class so you can pass the data to it. Then you can call these setters in your servlet as well.

  • AQ Servlet Help - AQHttp.java is  missing

    Have installed Oracle OAS 10g R2 on SUSE 8.
    The aim to to get the Oracle AQ servlet working.
    I have been following the Oracle Streams Advanced Queueing Guide:
    [http://docs.oracle.com/cd/E11882_01/server.112/e11013.pdf]
    Now, to test the AQ servlet it suggests:
    cd $ORACLE_HOME/rdbms/demo
    javac AQHttp.java
    My problem is that this Java source file is missing.
    I have checked the RDBMS 10g and 11g installed homes on the DB server as well and again class does not exists.

    Answer was to download and install the "Examples CD for 11g R2" (linux_11gR2_examples.zip) on the 11g database server. Includes all the AQ example/demo scripts mentioned in the Application Developers Guide.
    Note for versions < 11g , the examples CD was called the "Companion CD", so get that if you are on the older versions.
    After installing, the $ORACLE_HOME/rdbms/demo directory went from containing just aqxml.conf to:
    aadvdemo.sql cdemdpit.c cdemoplb.c dmxfdemo.java occiuni2_korean.txt sadvuwk.sql
    ADDRESS.java cdemdpit.dat cdemoqc2.c Emp.java occiuni2_russian.txt securefile
    anydata.sql cdemdplp.c cdemoqc.c epgdemo.sql occiuni2.sql smdim.sql
    anydset.sql cdemdplp.dat cdemoqc.sql exfdemo.sql occiuni2.typ smxmv1.sql
    anytype.sql cdemdplp.sql cdemorid.c extdemo0.sql occixa.cpp smxmv2.sql
    aqbzdemo.tar cdemdpno.c cdemorid.h extdemo1.sql oci02.c smxrw.sql
    aqdemo00.sql cdemdpno.dat cdemorid.sql extdemo2.c oci02.sql strmatp.sql
    aqdemo01.sql cdemdpro.c cdemort.c extdemo2.h oci03.c strmatREADME.txt
    aqdemo02.sql cdemdpro.ctl cdemort.h extdemo2.sql oci03.sql strmats.sql
    aqdemo03.sql cdemdpro.dat cdemosc.c extdemo3a.java oci04.c strmatu.sql
    aqdemo04.sql cdemdpss.c cdemosc.sql extdemo3.java oci04.sql strmmon.c
    aqdemo05.sql cdemdpss.dat cdemoses.c extdemo3.sql oci05.c strmmv1README.txt
    aqdemo06.sql cdemo1.c cdemoses.h extdemo4.c oci05.sql strmmv1.sql
    aqdemo07.sql cdemo2.c cdemoses.sql extdemo4.h oci06.c strmmv2README.txt
    aqdemo08.sql cdemo3.c cdemosp.c extdemo4.sql oci06.sql strmmv2.sql
    aqdemo09.sql cdemo4.c cdemosp.h extdemo5.c oci07.c strmmv2s.sql
    aqdemo10.sql cdemo5.c cdemostc.c extdemo5.h oci07.sql strmmvp1.sql
    aqdemo11.sql cdemo6.cc cdemostc.h extdemo5.sql oci08.c strmmvp2.sql
    aqdemo12.sql cdemo6.h cdemosyev.c extdemo6.c oci08.sql strmqp1.sql
    AQDemoServlet.java cdemo81.c cdemosyev.sql extdemo6.h oci09.c strmqry1README.txt
    AQHttp.java cdemo82.c cdemosyex.sql extdemo6.sql oci09.sql strmqry1.sql
    AQHttpRq.java cdemo82.h cdemothr.c fdemo1.for oci10.c summit2.sql
    aqjmsdemo01.java cdemo82.sql cdemothr.h fdemo2.for oci10.sql tyevdemo.sql
    aqjmsdemo02.java cdemoanydata1.c cdemoucb.c fdemo3.for oci11.c ulcase10.ctl
    aqjmsdemo03.java cdemoanydata1.sql cdemoucbl.c fgacdemo.sql oci11.sql ulcase10.sql
    aqjmsdemo04.java cdemoanydata2.c cdemoucb.sql giffile.dat oci12.c ulcase11.ctl
    aqjmsdemo05.java cdemoanydata2.sql cdemouni.c inhdemo.sql oci12.sql ulcase11.dat
    aqjmsdemo06.java cdemobj.c cdemoup1.c keystore oci13.c ulcase11.sql
    aqjmsdemo07.java cdemobj.h cdemoup2.c lobs oci13.sql ulcase1.ctl
    aqjmsdemo08.java cdemocoll.c cdemoupk.c maporder.sql oci14.c ulcase1.sql
    aqjmsdemo09.java cdemocoll.h cdemoupk.sql mddemo2.sql oci14.sql ulcase2.ctl
    aqjmsdemo10.java cdemocor1.c cdemoxml.c mddemo.sql oci15.c ulcase2.dat
    aqjmsdmo.sql cdemocor.c clobdemo.dat mdemo1.cpp oci15.sql ulcase3.ctl
    aqjmsdrp.sql cdemocor.h dattime1.sql mdemo1.h oci16.c ulcase3.sql
    aqjmskprb01a.sql cdemocor.sql dattime2.sql mdemo1o.cpp oci16.sql ulcase4.ctl
    aqjmskprb01b.sql cdemocp.c dattime3.sql mdemo1.sql oci17.c ulcase4.dat
    aqjmskprb01c.sql cdemocpproxy.c dattime4.sql mdemo1.typ oci17.sql ulcase4.sql
    aqjmskprb01d.sql cdemocpproxy.sql demo_rdbms32.mk MesgListener.java oci18.c ulcase5.ctl
    aqjmskprb01.java cdemocp.sql demo_rdbms64.mk Message.java oci18.sql ulcase5.dat
    aqjmsREADME.txt cdemodp0.h demo_rdbms.mk mymdemo1.h oci19.c ulcase5.sql
    aqorademo01.java cdemodp.c dmabdemo.java nchdemo1.c oci19.sql ulcase6.ctl
    aqorademo02.java cdemodp.h dmabdemo.sql nlsdemo0.sql oci20.c ulcase6.dat
    aqoradmo.sql cdemodp_lip.c dmaidemo.java nlsdemo1.sql oci20.sql ulcase6.sql
    aqoradrp.sql cdemodr1.c dmaidemo.sql nlsdemo2.sql oci21.c ulcase7.ctl
    AQPropServlet.java cdemodr1.h dmapplydemo.java nlsdemo3.sql oci21.sql ulcase7.dat
    aqxml01.xml cdemodr1.sql dmardemo.java nlsdemo4.sql oci22.c ulcase7e.sql
    aqxml02.xml cdemodr2.c dmardemo.sql nlsdemo5.sql oci22.sql ulcase7s.sql
    aqxml03.xml cdemodr2.h dmdtdemo.sql o8demo.sql oci23.c ulcase8.ctl
    aqxml04.xml cdemodr2.sql dmdtxvlddemo.sql o8idemo.sql oci23.sql ulcase8.dat
    aqxml05.xml cdemodr3.c dmexpimpdemo.java obndra.c oci24.c ulcase8.sql
    aqxml06.xml cdemodr3.h dmglcdemo.java occiaqlis.cpp oci24.sql ulcase91.dat
    aqxml07.xml cdemodr3.sql dmglcdem.sql occiaqop.cpp oci25.c ulcase92.dat
    aqxml08.xml cdemodsa.c dmglrdemo.java occiaqop.typ oci25.sql ulcase93.dat
    aqxml09.xml cdemodsa.sql dmglrdem.sql occiblob.cpp ociaqarraydeq.c ulcase94.dat
    aqxml10.xml cdemodsc.c dmhpdemo.sql occiclob.cpp ociaqarrayenq.c ulcase95.dat
    aqxml.conf cdemodsc.h dmkmdemo.java occicoll.cpp ociaqdemo00.c ulcase96.dat
    aqxmldemo.ear cdemodt.c dmkmdemo.sql occidemod.sql ociaqdemo01.c ulcase9.ctl
    aqxmldmo.sql cdemoext.c dmnbdemo.java occidemo.sql ociaqdemo02.c ulcase9.sql
    aqxmldrp.sql cdemoext.dat dmnbdemo.sql occidesc.cpp oci_f.sed ulcase.sh
    aqxmlhtp.sql cdemofil.c dmnmdemo.java occidml.cpp oci_m.sed viewdemo.sql
    aqxmloc4j.cert cdemofo.c dmnmdemo.sql occiinh.cpp ociucb32.mk xademo1.sql
    aqxmlREADME.txt cdemofor.c dmocdemo.java occiinh.typ ociucb.c xademo2.sql
    blobdemo.dat cdemoin1.c dmocdemo.sql occilbar.cpp ociucb.mk xmlgen1.sql
    calldemo.sql cdemoin1.h dmpademo.java occimb1.cpp olsdemo.sql xmlgen2.sql
    Cars.java cdemoin1.sql dmshgrants.sql occimb1.sql olsdrp.sql xmltype1.sql
    case1.rcv cdemoin2.c dmsh.sql occiobj.cpp ori_f.sed xmltype2.sql
    case2.rcv cdemoin2.h dmsvcdemo.java occiobj.typ orl_f.sed xmltype3.java
    case3.rcv cdemoin2.sql dmsvcdem.sql occipobj.cpp orl_m.sed xmltype3.sql
    case4.rcv cdemoin3.c dmsvodemo.java occipobj.typ oro_f.sed xrwutl.sql
    cbdem1.cob cdemoin3.h dmsvodem.sql occipool.cpp oro_m.sed xstream
    cbdem2.cob cdemoin3.sql dmsvrdemo.java occiproc.cpp ort_f.sed xtdemo01.dat
    cbdem3.cob cdemol2l.c dmsvrdem.sql occiscp.cpp PERSON.java xtdemo01.sql
    cdcdemo.sql cdemolb2.c dmtreedemo.java occistre.cpp readpipe.c xtdemo02.sql
    cdemdp9i.sql cdemolb.c dmtxtfe.sql occiuni1.cpp resultcache.sql xtdemo03.dat
    cdemdpco.c cdemolb.dat dmtxtnmfdemo.java occiuni1.sql rman2.sh xtdemo03.sql
    cdemdpco.dat cdemolb.h dmtxtnmf.sql occiuni2.cpp ruldemo.sql xtdemo04.dat
    cdemdpin.c cdemolbs.c dmtxtsvmdemo.java occiuni2_hindi.txt sadv91.sql xtdemo04.sql
    cdemdpin.dat cdemolb.sql dmtxtsvm.sql occiuni2_japanese.txt sadvdemo.sql xtsetup.sql

Maybe you are looking for

  • ORA-20001 Error when creating a new application

    Hi, I am trying to create a new application of an existing table in the database and I get the following error. The application is created using the wizard (app type Database, from scratch, Report and Form page) ORA-20001: Unable to create modules. O

  • Satellite L355D - No sound after upgrade to Win 7

    I have downloaded all of the drivers from Toshiba, upgraded the BIOS, and still nothing.  I get sound from headphones, but not the speakers. Volume level shows activity, I can see the ReakTek High - Def Audio as installed and Windows says it's workin

  • Where do you copy and paste codeing in iweb.

    Where do you copy and paste codeing in iweb, for a button that you create in iweb. I have the updated iLife 08. I know that this is possible I just don't know function is. If anyone can help that would be great.

  • Messages Notifications working on Macbook but not iMac

    So I update to Mavericks two days ago and everything is working great except for Messages. Now on my macbook, Messages works completely fine. I get a Notification when I get a new text from iMessage on my iOS and the syncing is great. But the problem

  • I just got a ipod touch (used) and how long will it take to sync with 126 songs?

    i just got a ipod touch (used) and i restored it and now its syncing my old music into it. but its been taking a few hours. all it sais "step 1 of 4" and "backing up"