tropocolo
asked on
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
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"));
}
That 'class' will have to be the applet. is it?
do you see any exception?
ASKER
Yes,
java.lang.NullPointerExcep tion
at java.applet.Applet.getPara meter(Appl et.java:17 4)
at com.ipsca.applet.Applicati onManager. ObtenerVal oresParame tros(Appli cationMana ger.java:8 2)
at com.ipsca.applet.Applicati onManager. init(Appli cationMana ger.java:6 0)
at sun.applet.AppletPanel.run (AppletPan el.java:42 5)
at java.lang.Thread.run(Threa d.java:619 )
I think that my Applet don't receive the parameters.. Or it can access them
java.lang.NullPointerExcep
at java.applet.Applet.getPara
at com.ipsca.applet.Applicati
at com.ipsca.applet.Applicati
at sun.applet.AppletPanel.run
at java.lang.Thread.run(Threa
I think that my Applet don't receive the parameters.. Or it can access them
>>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!
not actually, in this case, it should return null!
looks like it is not properly initialized as applet!
how do you invoke the applet?
or DocumentListener
ASKER
<applet code="com.ipsca.applet.App licationMa nager" archive="MyApplet.jar"
If it isn't, I don't understand the question
If it isn't, I don't understand the question
sorry ignore the alst comment!
ASKER
Well, maybe can be this
I invoque the metod in init()
I invoque the metod in init()
>>I don't understand the question
do you access throw browser?
do you access throw browser?
ASKER
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
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
are you callling the init in constructor?
can you post the code of constructor and init method?
ASKER
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(Applicati onManager. class.getN ame()).log (Level.SEV ERE, null, ex);
}
}
private void ObtenerValoresParametros() {
System.out.println("before getParameter()");
user.setName(getParameter( "commonNam e"));
user.setIdUser(getParamete r("idUser" ));
user.setEmail(getParameter ("email")) ;
user.setActivationCode(get Parameter( "activatio nCode"));
user.setRevocationCode(get Parameter( "revocatio nCode"));
user.setOrganizacion(getPa rameter("o rganizatio n"));
}
initComponents()
{....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(Applicati
}
}
private void ObtenerValoresParametros()
System.out.println("before
user.setName(getParameter(
user.setIdUser(getParamete
user.setEmail(getParameter
user.setActivationCode(get
user.setRevocationCode(get
user.setOrganizacion(getPa
}
initComponents()
{....code....}
}
private void ObtenerValoresParametros() {
System.out.println( "isActive(): " + isActive );
can yu print this and post the result?
System.out.println( "isActive(): " + isActive );
can yu print this and post the result?
ASKER
This is the result
isActive:false
It's bad, isn't it?
isActive:false
It's bad, isn't it?
>>It's bad, isn't it?
yes, very much!
do you see any other exception stack along with the NullPointer...?
yes, very much!
do you see any other exception stack along with the NullPointer...?
ASKER
No, it's the only exception, I'm going to try surround it with try
ASKER
No way, There is no other exception there
whats there is initComponents()?
ASKER
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.LineBor der(new java.awt.Color(0, 0, 0), 1, true));
lblTitulo.setFocusable(fal se);
txtArea.setColumns(20);
txtArea.setEditable(false) ;
txtArea.setRows(2);
txtArea.setAutoscrolls(fal se);
jScrollPane1.setViewportVi ew(txtArea );
btnSiguiente.setText("Next ");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jP anel1);
jPanel1.setLayout(jPanel1L ayout);
jPanel1Layout.setHorizonta lGroup(
jPanel1Layout.createParall elGroup(ja vax.swing. GroupLayou t.Alignmen t.LEADING) .addGroup( jPanel1Lay out.create Sequential Group().ad dContainer Gap().addG roup(jPane l1Layout.c reateParal lelGroup(j avax.swing .GroupLayo ut.Alignme nt.LEADING ).addGroup (jPanel1La yout.creat eSequentia lGroup().a ddComponen t(btnSigui ente).addG ap(18, 18, 18).addComponent(barraProg reso, javax.swing.GroupLayout.DE FAULT_SIZE , 167, Short.MAX_VALUE)).addCompo nent(jScro llPane1).a ddComponen t(lblTitul o, javax.swing.GroupLayout.DE FAULT_SIZE , javax.swing.GroupLayout.DE FAULT_SIZE , Short.MAX_VALUE)).addConta inerGap()) );
jPanel1Layout.setVerticalG roup(
jPanel1Layout.createParall elGroup(ja vax.swing. GroupLayou t.Alignmen t.LEADING) .addGroup( jPanel1Lay out.create Sequential Group().ad dContainer Gap().addC omponent(l blTitulo). addPreferr edGap(java x.swing.La youtStyle. ComponentP lacement.U NRELATED). addCompone nt(jScroll Pane1, javax.swing.GroupLayout.PR EFERRED_SI ZE, javax.swing.GroupLayout.DE FAULT_SIZE , javax.swing.GroupLayout.PR EFERRED_SI ZE).addPre ferredGap( javax.swin g.LayoutSt yle.Compon entPlaceme nt.RELATED ).addGroup (jPanel1La yout.creat eParallelG roup(javax .swing.Gro upLayout.A lignment.T RAILING).a ddComponen t(btnSigui ente).addC omponent(b arraProgre so, javax.swing.GroupLayout.PR EFERRED_SI ZE, javax.swing.GroupLayout.DE FAULT_SIZE , javax.swing.GroupLayout.PR EFERRED_SI ZE)).addCo ntainerGap (javax.swi ng.GroupLa yout.DEFAU LT_SIZE, Short.MAX_VALUE)));
lblTitulo.getAccessibleCon text().set Accessible Name("lblC ertificate ");
btnSiguiente.getAccessible Context(). setAccessi bleName("b tnSiguient e");
GroupLayout layout = new GroupLayout(getContentPane ());
getContentPane().setLayout (layout);
layout.setHorizontalGroup(
layout.createParallelGroup (javax.swi ng.GroupLa yout.Align ment.LEADI NG).addGro up(layout. createSequ entialGrou p().addCon tainerGap( ).addCompo nent(jPane l1, javax.swing.GroupLayout.PR EFERRED_SI ZE, 278, javax.swing.GroupLayout.PR EFERRED_SI ZE).addCon tainerGap( javax.swin g.GroupLay out.DEFAUL T_SIZE, Short.MAX_VALUE)));
layout.setVerticalGroup(
layout.createParallelGroup (javax.swi ng.GroupLa yout.Align ment.LEADI NG).addGro up(layout. createSequ entialGrou p().addCon tainerGap( ).addCompo nent(jPane l1, javax.swing.GroupLayout.PR EFERRED_SI ZE, javax.swing.GroupLayout.DE FAULT_SIZE , javax.swing.GroupLayout.PR EFERRED_SI ZE).addCon tainerGap( javax.swin g.GroupLay out.DEFAUL T_SIZE, Short.MAX_VALUE)));
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.LineBor
lblTitulo.setFocusable(fal
txtArea.setColumns(20);
txtArea.setEditable(false)
txtArea.setRows(2);
txtArea.setAutoscrolls(fal
jScrollPane1.setViewportVi
btnSiguiente.setText("Next
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jP
jPanel1.setLayout(jPanel1L
jPanel1Layout.setHorizonta
jPanel1Layout.createParall
jPanel1Layout.setVerticalG
jPanel1Layout.createParall
lblTitulo.getAccessibleCon
btnSiguiente.getAccessible
GroupLayout layout = new GroupLayout(getContentPane
getContentPane().setLayout
layout.setHorizontalGroup(
layout.createParallelGroup
layout.setVerticalGroup(
layout.createParallelGroup
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
btw, why did you do that?
ASKER
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!!!!
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!!!!