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.

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.

  • 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.

  • 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).

  • Why session.getValue is invalid in portlets? Urgent ,help me!!!

    I have two JSP pages. Here is first.jsp:
    <%@ page import="oracle.portal.provider.v1.*,oracle.portal.provider.v1.http.*" session="true" %>
    <center>
    Hello, this is the first page<p>
    <%
    session.putValue("test","aaaaaaaaaaa");
    response.sendRedirect(HttpPortletRendererUtil.parameterizeLink(request, PortletRendererUtil.PAGE_LINK, HttpPortletRendererUtil.portletParameter(request, "next_page") + "=second.jsp") );
    %>
    </center>
    Here is second.jsp:
    <%@ page import="oracle.portal.provider.v1.*,oracle.portal.provider.v1.http.*" session="true" %>
    <center>
    Hello, this is the second page<p>
    <%
    out.println(session.getValue("test"));
    %>
    </center>
    Make first.jsp into a portlet and run it.It goes to the second.jsp and the session value is null!!! why??
    If I change first.jsp as below:
    <%@ page import="oracle.portal.provider.v1.*,oracle.portal.provider.v1.http.*" session="true" %>
    <center>
    Hello, this is the first page<p>
    <%
    session.putValue("test","aaaaaaaaaaa");
    %>
    <a href="<%=HttpPortletRendererUtil.parameterizeLink(request, PortletRendererUtil.PAGE_LINK, HttpPortletRendererUtil.portletParameter(request, "next_page") + "=second.jsp") %">>second page</a>
    </center>
    Make first.jsp into a portlet and run it.Manual click the hyper link to second.jsp.Then it show the session value is "aaaaaaaaaaa".
    Who can help me???????Thanks a lot!

    You are confusing java with javascript.
    These two things are not the same.
    The lifecycle goes something like this
    1 - Request is made to server
    2 - Java/JSP runs java code, produces HTML page
    3 - java stops running
    4 - html is sent to browser, and javascript starts running.
    You cannot call java code from browser events (such as onload, onclick, onchange...) The only way to run java code again is to submit a request (normally by submitting a form, or clicking a link. )
    If you want a javascript solution, in IE, use the window.setTimeout() method to execute some javascript code after a certain period of time.
    A more generic approach would be to use the refresh header. Set the timeout for the refresh header to be 300 seconds. If the user stays on the same page for more than 5 minutes, it will redirect to the new page.
    Hope this helps,
    evnafets

  • 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 server@developb
    [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

  • WSRP (jsr-168) portlets no edit/help buttons appear

    Hi,
    I have some jsr-168 portlets that I wrote that work on other portal software (like uPortal). They have both help and edit buttons (specified in the portlet.xml and handlers written into the portlet code) and you can click them and see both the help and edit modes of the portlets. However, when I put these portlets on Oracle Portal (10.1.2/10.1.4), the edit/help (or personalize) buttons don't show up. I even tried to use the sample portlets from sun, like the BookmarkPortlet, etc, and they have the same problem.
    Any ideas?
    Thanks,
    -Mike M.

    Hi,
    I dont see anything obvisouly wrong with what you are doing. I suspect the var attribute though. Can you try out this sample
    ">view</a><br>
    <a href="
    <portlet:renderURL windowState="maximized" portletMode="help"/>">help</a><br>
    Thanks,
    Sharmila

  • 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.

Maybe you are looking for

  • How to use string as an expression in SSRS reports

    Hello all, I have created a SSRS report in which I have used a tablix and a single dataset (ds_test) Now the dataset use t-sql and  is calling a table in which has data as shown below: What I am trying to do is to use this as an expression inside the

  • Different servers for dialup-access and exec-access

    Hi all, I am trying to configure a 3640 for authorization. The 'tricky' part is that I have to make a difference between dialup-access on one hand and exec-access on the other hand. I am using TACACS+ for authentication and authorization. The origina

  • Camera RAW update with errors

    I am running CS6 on a Macbook Pro.  Photoshop cannot read camera raw files from my new Canon 6D.  I went through the update process and as expected I needed a newer version of ACR.  I completed the update process but with errors.  Camera Raw was not

  • WRE54G losing connectivity

    A few months ago I purchased a WRE54G range expander. After some initial setup issues, it worked great until a couple of days ago. The expander stopped working and seemed to have reset itself. After a couple of conversations with tech support, the ra

  • What's new in Oracle BPA 11G

    Hello, Is there some note/ doc/ whitepare etc for what are the new features in Oracle BPA 11G? regards Sanjiv