Galera,
Não estou conseguindo pegar o parâmetro dentro meu applet.
Segue o código:
JSP
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
public class Applet extends JApplet {
@Override
public void init() {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
initCom();
} catch (Exception e) {
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String codAcessant = getParameter("teste");
System.out.println("Valor do parametro " + teste);
try {
Integer codAcessante = new Integer(29);
add(new MainPanel(codAcessante)); //A classe MainPanel estende a classe JPanel
jButton1.setVisible(false);
} catch (Exception ex) {
Logger.getLogger(Applet.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void initCom() {
jButton1 = new javax.swing.JButton();
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
add(jButton1);
}
private javax.swing.JButton jButton1;
}
Meu codigo em HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<applet name="Applet" id="Applet" code="pacote.Applet.class"
archive="Aplicacao.jar" width="330" height="260">
<PARAM name="teste" value="29" />
</applet>
</body>
</html>
Quando peço para ele me mostrar o valor do parâmetro no console do java esta retornando null
Alguém ja teve esse problema?
Att
vcscastro
