RDV+DIAL chat illimit� dans ta r�g!
no save
Assistance
Achat
News

Forum | programmation
Comment executer une class java dans JSP
aminos88, le ven. 27 févr. 2009 à 23:34:58
Bonjour,
J'ai une class java qui fonctionne très bien dans projet normal
Moi je jeux que cette class sera exécuter dans un projet web
avec jsp
comment je peux importer cette class
comment je peux voir la résultat de l'exécution de ma classe dans une page web

NB-> j'utilise NetBeans6.5+JDK6

Il faut d'abord ajouter la bibliothèque snmp4j au projet et clle ci se trouve ici http://www.snmp4j.org/html/download.html
voila ma class test.java
******************************************************************
import java.io.IOException;
import org.snmp4j.CommunityTarget;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
import org.snmp4j.TransportMapping;
import org.snmp4j.event.ResponseEvent;
import org.snmp4j.event.ResponseListener;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.GenericAddress;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.VariableBinding;
import org.snmp4j.transport.DefaultUdpTransportMapping;


public class test {


// @param args
// @throws IOException
public static void main(String[] args) throws IOException
{
Address targetAddress = GenericAddress.parse("udp:127.0.0.1/161");
TransportMapping transport = new DefaultUdpTransportMapping();
Snmp snmp = new Snmp(transport);

transport.listen();

CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString("public"));
target.setAddress(targetAddress);
target.setRetries(2);
target.setTimeout(1500);
target.setVersion(SnmpConstants.version1);

PDU pdu = new PDU();
pdu.add(new VariableBinding(new OID(new int[] {1,3,6,1,2,1,1,7})));
pdu.add(new VariableBinding(new OID(new int[] {1,3,6,1,2,1,1,5})));
pdu.setType(PDU.GETNEXT);

ResponseListener listener = new ResponseListener()
{
public void onResponse(ResponseEvent event)
{

((Snmp)event.getSource()).cancel(event.getRequest(), this);
System.out.println("Received response PDU is: "+event.getResponse());
}
};
snmp.send(pdu, target, null, listener);
}

}
*******************************************
merci de me donner la solution parce que sa fait un mois que je suis bloquée a ce stade la
merciConfiguration: Windows XP
Firefox 3.0.6


nasix
28 févr.
Suivant
REPONSES
nasix
28 févr.
aminos88
28 févr.
nasix
28 févr.
aminos88
28 févr.
nasix
28 févr.
aminelynx
06 mars
aminos88
06 mars
Version Web
Réalisé par RedShift
no save