我想在applet中创建以下代码(因为当我复制到服务器时不起作用并且在我的搜索之后JOptionpane仅用于本地)并且我希望这个applet返回布尔“addLineItem”返回我的jsp网站也将从那里打电话。
int dialogButton = JOptionPane.YES_OPTION;
String sqlprod = " SELECT LORD, LPROD, LLINE"
+ " FROM ECL "
+ " WHERE LORD = " + myOrd
+ " AND LPROD = '" + jspSp.with("LTXT").getValue() + "'";
Statement stmtDupli = con.createStatement();
ResultSet rsDupli = stmtDupli.executeQuery(sqlprod);
if(rsDupli.next()){
dialogButton = JOptionPane.showConfirmDialog(null, "The product is in the position " + rsDupli.getInt("LLINE") + " already!", "WARNING", JOptionPane.YES_NO_OPTION);
if(dialogButton == JOptionPane.NO_OPTION){
addLineItem = false;
}
}
也可以请我把这个调用写入这个小程序的JSP的方式写给我。
在这里,我创建了这个简单的applet
public class g7appletDialog extends Applet {
public boolean action(boolean addnewLine){
int dialogButton = JOptionPane.YES_OPTION;
dialogButton = JOptionPane.showConfirmDialog(null, "The product bla bla ", "WARNING", JOptionPane.YES_NO_OPTION);
if(dialogButton == JOptionPane.NO_OPTION){
System.exit(0);
return false;
}else {
System.exit(0);
return true;
}
}//close boolean method
} 并有问题如何将其调用到JSP站点 这是我在JSP站点写的东西
%><%@ page language="java" %>
<jsp:plugin type="applet" code="g7appletDialog.class" codebase="D:\GET2\workspace\AppletDialog\appletDialog" width="250" height="50">
<jsp:fallback><B>Unable to start plugin!</B></jsp:fallback>
</jsp:plugin> %><%
当我做debbuging没有得到任何错误既没有结果..弹出窗口例如