Applet don't work

I can's get the parameters from html page. I include the code of html and how I get the parameters.
The applet is in a jar file, do I Have to do something more????
For server I use GlassfishV2
Thanks
html Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
   <head>
   </head>
   <body>
       <meta http-equiv="Content-Language" content="es-ES" />
      <applet code="com.ipsca.applet.ApplicationManager" archive="MyApplet.jar" 
        codebase="http://localhost:8150/cargaApplet/" width=300 height=150 alt="esto no rula">
            <PARAM NAME="commonName" VALUE="Applet"/>
            <param name="email" value="applet@applet.com"/>
            <param name="idUser" value="16"/>
            <param name="activationCode" value="7"/>
            <param name="revocationCode" value="9"/>
            <param name="organization" value="applet"/>
      </applet>
   </body>
</html>
This is how I get the parameters in my class
 
 private void ObtenerValoresParametros() {
        System.out.println("before getParameter()");
        user.setName(getParameter("commonName"));
        user.setIdUser(getParameter("idUser"));
        user.setEmail(getParameter("email"));
        user.setActivationCode(getParameter("activationCode"));
        user.setRevocationCode(getParameter("revocationCode"));
        user.setOrganizacion(getParameter("organization"));
    }

Open in new window

tropocoloAsked:
Who is Participating?
 
ksivananthCommented:
>>setStub(null);

that is tha culprit, remove that!
0
 
CEHJCommented:
That 'class' will have to be the applet. is it?
0
 
ksivananthCommented:
do you see any exception?
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
tropocoloAuthor Commented:
Yes,
java.lang.NullPointerException
        at java.applet.Applet.getParameter(Applet.java:174)
        at com.ipsca.applet.ApplicationManager.ObtenerValoresParametros(ApplicationManager.java:82)
        at com.ipsca.applet.ApplicationManager.init(ApplicationManager.java:60)
        at sun.applet.AppletPanel.run(AppletPanel.java:425)
        at java.lang.Thread.run(Thread.java:619)
I think that my Applet don't receive the parameters.. Or it can access them
0
 
ksivananthCommented:
>>I think that my Applet don't receive the parameters.. Or it can access them

not actually, in this case, it should return null!

looks like it is not properly initialized as applet!
0
 
ksivananthCommented:
how do you invoke the applet?
0
 
ksivananthCommented:
or DocumentListener

0
 
tropocoloAuthor Commented:
<applet code="com.ipsca.applet.ApplicationManager" archive="MyApplet.jar"

If it isn't, I don't understand the question
0
 
ksivananthCommented:
sorry ignore the alst comment!
0
 
tropocoloAuthor Commented:
Well, maybe can be this

I invoque the metod in init()
0
 
ksivananthCommented:
>>I don't understand the question

do you access throw browser?
0
 
tropocoloAuthor Commented:
ah, ok
I compile the jar, then I use an html to invoke it using a browser. The url is
http://localhost:8150/cargaApplet/cargaApplet.html
The jar is in the same directory as cargaApplet.html


0
 
ksivananthCommented:
are you callling the init in constructor?
0
 
ksivananthCommented:
can you post the code of constructor and init method?
0
 
tropocoloAuthor Commented:
This is the applet code
public class ApplicationManager extends JApplet {

    private static final long serialVersionUID = 1L;
    // Variables declaration
    private javax.swing.JProgressBar barraProgreso;
    private javax.swing.JButton btnSiguiente;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblTitulo;
    private javax.swing.JTextArea txtArea;    //Datos del usuario y para la generacion del CSR
    private User user = new User();
 public ApplicationManager() {
    }

    @Override
    public void init() {
        initComponents();
        ObtenerValoresParametros();
      }
   
    @Override
   public void start(){
     try {
            obtenerPassword();
        } catch (Exception ex) {
            Logger.getLogger(ApplicationManager.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
private void ObtenerValoresParametros() {
        System.out.println("before getParameter()");
        user.setName(getParameter("commonName"));
        user.setIdUser(getParameter("idUser"));
        user.setEmail(getParameter("email"));
        user.setActivationCode(getParameter("activationCode"));
        user.setRevocationCode(getParameter("revocationCode"));
        user.setOrganizacion(getParameter("organization"));
    }
 initComponents()
{....code....}
}
0
 
ksivananthCommented:
private void ObtenerValoresParametros() {
        System.out.println( "isActive(): " + isActive );

can yu print this and post the result?
0
 
tropocoloAuthor Commented:
This is the result
isActive:false

It's bad, isn't it?
0
 
ksivananthCommented:
>>It's bad, isn't it?

yes, very much!

do you see any other exception stack along with the NullPointer...?
0
 
tropocoloAuthor Commented:
No, it's the only exception, I'm going to try surround it with try
0
 
tropocoloAuthor Commented:
No way, There is no other exception there
0
 
ksivananthCommented:
whats there is initComponents()?
0
 
tropocoloAuthor Commented:
I initialize the applet components

jPanel1 = new javax.swing.JPanel();
        lblTitulo = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtArea = new javax.swing.JTextArea();
        barraProgreso = new javax.swing.JProgressBar();
        btnSiguiente = new javax.swing.JButton();

        setStub(null);

        lblTitulo.setFont(new java.awt.Font("Courier New", 0, 14)); // NOI18N
        lblTitulo.setText("    ");
        lblTitulo.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
        lblTitulo.setFocusable(false);

        txtArea.setColumns(20);
        txtArea.setEditable(false);
        txtArea.setRows(2);
        txtArea.setAutoscrolls(false);
        jScrollPane1.setViewportView(txtArea);

        btnSiguiente.setText("Next");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addComponent(btnSiguiente).addGap(18, 18, 18).addComponent(barraProgreso, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE)).addComponent(jScrollPane1).addComponent(lblTitulo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap()));
        jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addComponent(lblTitulo).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(btnSiguiente).addComponent(barraProgreso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        lblTitulo.getAccessibleContext().setAccessibleName("lblCertificate");
        btnSiguiente.getAccessibleContext().setAccessibleName("btnSiguiente");
        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 278, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
0
 
ksivananthCommented:
btw, why did you do that?
0
 
tropocoloAuthor Commented:
I DID IT!!!!!!!!

thanks you

by the way, I didn't do that, NetBeans did it.....
I only have seen it when I've sent to you....

But Very thanks, I resolve the question!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.