Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Jtree i html navigacija - POST -> PHP

[es] :: Java :: Jtree i html navigacija - POST -> PHP

[ Pregleda: 2236 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

myrmidon
B.Robert
Tungusia

Član broj: 10428
Poruke: 55
*.bacs-net.hu.



Profil

icon Jtree i html navigacija - POST -> PHP13.06.2005. u 00:02 - pre 229 meseci
Da li neko zna kako da reloadujem php stranicu na kojoj imam Jtree komponentu. Reload se vrsi onda kada se na drvetu selektuje neki objekat tako da se postuje neki parametar iz java apleta, php kod ga zatim prihavata.Evo dokle sam stigao :

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.nio.charset.Charset;

import javax.swing.JApplet;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;

//import java.security.*;




public class tree extends JApplet {


private JTree myTree;

public class MyTreeSelectionListener implements TreeSelectionListener {
public void valueChanged (TreeSelectionEvent event) {
TreePath path = event.getPath();
//System.out.println ("Selected: " + path.getLastPathComponent());

//************************ Begin of post ******************

try
{

//Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
//System.setProperty("java.protocol.handler.pkgs",
// "com.sun.net.ssl.internal.www.protocol");

//URL url = new URL("http://193.197.159.246/~website/admin.php");


URL url;
URLConnection urlConn;
DataOutputStream dos;
DataInputStream dis;

url = new URL("http://193.197.159.246/~website/admin.php");
urlConn = url.openConnection();
urlConn.setDoInput(true);
urlConn.setDoOutput(true);
urlConn.setUseCaches(false);
urlConn.setRequestProperty ("Content-Type", "application/x-www-form-urlencoded");

dos = new DataOutputStream (urlConn.getOutputStream());
String message = "NEW_ITEM=" + URLEncoder.encode("shit", Charset.defaultCharset().toString());
dos.writeBytes(message);
dos.flush();
dos.close();

}
catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}



//************************** End of post *******************






Object elements[] = path.getPath();
for (int i=0; i<elements.length; i++) {
// System.out.print ("->" + elements);
}
//System.out.println ();
}
}

public tree()

{


TreeSelectionListener listener = new MyTreeSelectionListener();
myTree = new JTree();

myTree.addTreeSelectionListener(listener);

getContentPane().add(new JScrollPane(myTree));




setVisible(true);
setTree();
}

public void setTree() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode("site.com");
DefaultTreeModel dtm = new DefaultTreeModel(root);

DefaultMutableTreeNode Home = new DefaultMutableTreeNode("Home page");
dtm.insertNodeInto(Home,root,0);

DefaultMutableTreeNode Welcome = new DefaultMutableTreeNode("Welcome");
dtm.insertNodeInto(Welcome,Home,0);

DefaultMutableTreeNode Jobs = new DefaultMutableTreeNode("Jobs");
dtm.insertNodeInto(Jobs,Home,0);

DefaultMutableTreeNode News = new DefaultMutableTreeNode("News");
dtm.insertNodeInto(News,Home,0);

DefaultMutableTreeNode Products = new DefaultMutableTreeNode("Products");
dtm.insertNodeInto(Products,root,0);

DefaultMutableTreeNode Industrial = new DefaultMutableTreeNode("Industrial wirelles LAN");
dtm.insertNodeInto(Industrial,Products,0);

DefaultMutableTreeNode IAP_50 = new DefaultMutableTreeNode("IAP 50 industrial IP 50 AP");
dtm.insertNodeInto(IAP_50,Industrial,0);

DefaultMutableTreeNode WAC_11 = new DefaultMutableTreeNode("WAC 11 Warehouse access controller");
dtm.insertNodeInto(WAC_11,Industrial,0);

DefaultMutableTreeNode Middle_AP = new DefaultMutableTreeNode("Middleware access point");
dtm.insertNodeInto(Middle_AP,Industrial,0);



DefaultMutableTreeNode Office_Corporate = new DefaultMutableTreeNode("Office/Corporate secure WLAN");
dtm.insertNodeInto(Office_Corporate,Products,0);

DefaultMutableTreeNode Enterprise = new DefaultMutableTreeNode("Enterprise WLAN");
dtm.insertNodeInto(Enterprise,Office_Corporate,0);

DefaultMutableTreeNode Secure_AP = new DefaultMutableTreeNode("Secure AP 52");
dtm.insertNodeInto(Secure_AP,Office_Corporate,0);

DefaultMutableTreeNode OWSD = new DefaultMutableTreeNode("Office WLAN");
dtm.insertNodeInto(OWSD,Office_Corporate,0);

DefaultMutableTreeNode WPA = new DefaultMutableTreeNode("80211i certificate server");
dtm.insertNodeInto(WPA,Office_Corporate,0);

DefaultMutableTreeNode EWAS = new DefaultMutableTreeNode("80211i Authentication Server");
dtm.insertNodeInto(EWAS,Office_Corporate,0);



DefaultMutableTreeNode Network_management = new DefaultMutableTreeNode("Network management/WLAN switches ");
dtm.insertNodeInto(Network_management,Products,0);

DefaultMutableTreeNode WNMS = new DefaultMutableTreeNode("W-NMS systems ");
dtm.insertNodeInto(WNMS,Network_management,0);

DefaultMutableTreeNode INMS = new DefaultMutableTreeNode("Industrial Network Management Switch ");
dtm.insertNodeInto(INMS,Network_management,0);

DefaultMutableTreeNode OPG = new DefaultMutableTreeNode("Office Perimeter WLAN Gateway ");
dtm.insertNodeInto(OPG,Network_management,0);

DefaultMutableTreeNode Wifi_max = new DefaultMutableTreeNode("Wifi max ");
dtm.insertNodeInto(Wifi_max,Products,0);

DefaultMutableTreeNode Public_hotspots = new DefaultMutableTreeNode("Public hotspots ");
dtm.insertNodeInto(Public_hotspots,Products,0);

String selected;
selected=myTree.getName();



myTree.setModel(dtm);
}

public static void main(String[] args) {
tree test = new tree();





}



}
Myrmidon
 
Odgovor na temu

myrmidon
B.Robert
Tungusia

Član broj: 10428
Poruke: 55
*.bacs-net.hu.



Profil

icon Re: Jtree i html navigacija - POST -> PHP15.06.2005. u 12:16 - pre 229 meseci
Reseno sa


getAppletContext().showDocument
(new URL(get_adr + "?item=" + path.getLastPathComponent() + "&last_path=" + last_path ), "_self");


Admin, mozete zatvoriti temu.
Myrmidon
 
Odgovor na temu

[es] :: Java :: Jtree i html navigacija - POST -> PHP

[ Pregleda: 2236 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.