1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
      留言板java代碼 web留言板代碼

      急急急!java簡(jiǎn)單留言板

      您好。我重新地幫你寫了代碼,完全地符合了你的圖片中的界面要求、功能要求。代碼如下:(解決了問題,記得給我分哦~^_^呵呵……)

      我們提供的服務(wù)有:成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、和田縣ssl等。為上1000+企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的和田縣網(wǎng)站制作公司

      import java.awt.BorderLayout;

      import javax.swing.JPanel;

      import javax.swing.JFrame;

      import java.awt.Rectangle;

      import javax.swing.JLabel;

      import javax.swing.SwingConstants;

      import java.awt.Font;

      import javax.swing.JTextArea;

      import javax.swing.JScrollBar;

      import javax.swing.JScrollPane;

      import javax.swing.JComboBox;

      import javax.swing.JTextField;

      import javax.swing.JButton;

      public class Liuyb extends JFrame {

      private static final long serialVersionUID = 1L;

      private JPanel jContentPane = null;

      private JLabel jLabel = null;

      private JTextArea jTextArea = null;

      private JScrollPane jScrollPane = null;

      private JLabel jLabel1 = null;

      private JComboBox jComboBox = null;

      private JLabel jLabel2 = null;

      private JTextField jTextField = null;

      private JButton jButton = null;

      private JButton jButton1 = null;

      private JButton jButton2 = null;

      private JButton jButton3 = null;

      /**

      * This is the default constructor

      */

      public Liuyb() {

      super();

      initialize();

      }

      /**

      * This method initializes this

      *

      * @return void

      */

      private void initialize() {

      this.setContentPane(getJContentPane());

      this.setTitle("留言板程序");

      this.setBounds(new Rectangle(0, 0, 640, 480));

      this.setVisible(true);

      }

      /**

      * This method initializes jContentPane

      *

      * @return javax.swing.JPanel

      */

      private JPanel getJContentPane() {

      if (jContentPane == null) {

      jLabel2 = new JLabel();

      jLabel2.setBounds(new Rectangle(214, 407, 45, 24));

      jLabel2.setFont(new Font("Dialog", Font.BOLD, 14));

      jLabel2.setText("地說:");

      jLabel1 = new JLabel();

      jLabel1.setBounds(new Rectangle(32, 407, 15, 24));

      jLabel1.setFont(new Font("Dialog", Font.BOLD, 14));

      jLabel1.setText("你");

      jLabel = new JLabel();

      jLabel.setBounds(new Rectangle(283, 15, 45, 20));

      jLabel.setHorizontalAlignment(SwingConstants.CENTER);

      jLabel.setFont(new Font("Dialog", Font.BOLD, 14));

      jLabel.setText("留言板");

      jContentPane = new JPanel();

      jContentPane.setLayout(null);

      jContentPane.add(jLabel, null);

      jContentPane.add(getJScrollPane(), null);

      jContentPane.add(jLabel1, null);

      jContentPane.add(getJComboBox(), null);

      jContentPane.add(jLabel2, null);

      jContentPane.add(getJTextField(), null);

      jContentPane.add(getJButton(), null);

      jContentPane.add(getJButton1(), null);

      jContentPane.add(getJButton2(), null);

      jContentPane.add(getJButton3(), null);

      }

      return jContentPane;

      }

      /**

      * This method initializes jTextArea

      *

      * @return javax.swing.JTextArea

      */

      private JTextArea getJTextArea() {

      if (jTextArea == null) {

      jTextArea = new JTextArea();

      jTextArea.setText("留言內(nèi)容:");

      jTextArea.setEditable(false);

      }

      return jTextArea;

      }

      /**

      * This method initializes jScrollPane

      *

      * @return javax.swing.JScrollPane

      */

      private JScrollPane getJScrollPane() {

      if (jScrollPane == null) {

      jScrollPane = new JScrollPane();

      jScrollPane.setBounds(new Rectangle(22, 49, 534, 347));

      jScrollPane.setViewportView(getJTextArea());

      }

      return jScrollPane;

      }

      /**

      * This method initializes jComboBox

      *

      * @return javax.swing.JComboBox

      */

      private JComboBox getJComboBox() {

      if (jComboBox == null) {

      jComboBox = new JComboBox();

      jComboBox.setBounds(new Rectangle(54, 407, 149, 24));

      String[] mycbox={"微笑","大笑","痛苦"};

      jComboBox.addItem(mycbox[0]);

      jComboBox.addItem(mycbox[1]);

      jComboBox.addItem(mycbox[2]);

      }

      return jComboBox;

      }

      /**

      * This method initializes jTextField

      *

      * @return javax.swing.JTextField

      */

      private JTextField getJTextField() {

      if (jTextField == null) {

      jTextField = new JTextField();

      jTextField.setBounds(new Rectangle(265, 407, 231, 24));

      }

      return jTextField;

      }

      /**

      * This method initializes jButton

      *

      * @return javax.swing.JButton

      */

      private JButton getJButton() {

      if (jButton == null) {

      jButton = new JButton();

      jButton.setBounds(new Rectangle(505, 407, 70, 24));

      jButton.setText("提交");

      jButton.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent e) {

      jTextArea.setText(jTextArea.getText()+"\r\n"+"你"+jComboBox.getSelectedItem().toString()+"地說:"+jTextField.getText());

      }

      });

      }

      return jButton;

      }

      /**

      * This method initializes jButton1

      *

      * @return javax.swing.JButton

      */

      private JButton getJButton1() {

      if (jButton1 == null) {

      jButton1 = new JButton();

      jButton1.setBounds(new Rectangle(565, 51, 60, 32));

      jButton1.setText("清屏");

      jButton1.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent e) {

      jTextArea.setText("留言內(nèi)容:");

      }

      });

      }

      return jButton1;

      }

      /**

      * This method initializes jButton2

      *

      * @return javax.swing.JButton

      */

      private JButton getJButton2() {

      if (jButton2 == null) {

      jButton2 = new JButton();

      jButton2.setBounds(new Rectangle(565, 112, 60, 32));

      jButton2.setText("置頂");

      jButton2.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent e) {

      jTextArea.setCaretPosition(0);

      }

      });

      }

      return jButton2;

      }

      /**

      * This method initializes jButton3

      *

      * @return javax.swing.JButton

      */

      private JButton getJButton3() {

      if (jButton3 == null) {

      jButton3 = new JButton();

      jButton3.setBounds(new Rectangle(565, 173, 60, 32));

      jButton3.setText("至尾");

      jButton3.addActionListener(new java.awt.event.ActionListener() {

      public void actionPerformed(java.awt.event.ActionEvent e) {

      jTextArea.setCaretPosition((int)jTextArea.getText().length());

      }

      });

      }

      return jButton3;

      }

      public static void main(String args[]){

      new Liuyb();

      }

      }

      開源里有沒有留言板的源代碼,JAVA的

      絕對(duì)開源,絕對(duì)明了的留言板,便于學(xué)習(xí)的源碼

      用JAVA寫的留言板原代碼

      /*

      * guestbookServlet.java

      *

      * */

      import javax.servlet.*;

      import javax.servlet.http.*;

      import java.sql.*;

      import java.util.Date;

      /**

      *

      * */

      public class guestbookServlet extends HttpServlet {

      boolean debug=false;

      String sDBDriver;

      Connection conn=null;

      ResultSet rs=null;

      /** Initializes the servlet.

      */

      public void init(ServletConfig config) throws ServletException {

      super.init(config);

      if(debug)

      sDBDriver=new String("sun.jdbc.odbc.JdbcOdbcDriver");

      else

      sDBDriver=new String("org.gjt.mm.mysql.Driver");

      try{

      Class.forName(sDBDriver);

      }

      catch(java.lang.ClassNotFoundException e){

      System.err.println("Driver類初始化:"+e.getMessage());

      }

      }

      /** Destroys the servlet.

      */

      public void destroy() {

      }

      /** Processes requests for both HTTP codeGET/code and codePOST/code methods.

      * @param request servlet request

      * @param response servlet response

      */

      protected void processRequest(HttpServletRequest request, HttpServletResponse response)

      throws ServletException, java.io.IOException {

      response.setContentType("text/html;charset=gb2312");

      java.io.PrintWriter out = response.getWriter();

      boolean empty=true;

      boolean noResult=true;

      String sqlStr;

      int currentPage=0;

      int totalPage=0;

      int reccount=0;

      ResultSet myrs=null;

      String username=request.getParameter("username");

      String email=request.getParameter("email");

      String ucontent=request.getParameter("ucontent");

      String ipage=request.getParameter("ipage");

      if(ipage==null||ipage.length()==0)

      currentPage=1;

      else

      currentPage=Integer.parseInt(ipage);

      if((username==null||username.length()==0)||(ucontent==null||ucontent.length()==0))empty=true;

      else empty=false;

      Date myDate=new Date();

      //String intime=new String(String.valueOf(myDate.getYear()+1990)+String.valueOf(myDate.getMonth()));

      String year=String.valueOf(myDate.getYear()+1900);

      String month=String.valueOf(myDate.getMonth()+1);

      if(month.length()==1)

      month=new String("0"+month);

      String days=String.valueOf(myDate.getDate());

      if(days.length()==1)

      days=new String("0"+days);

      String hours=String.valueOf(myDate.getHours());

      if(hours.length()==1)

      hours=new String("0"+hours);

      String minutes=String.valueOf(myDate.getMinutes());

      if(minutes.length()==1)

      minutes=new String("0"+minutes);

      String intime=year+"-"+month+"-"+days+" "+hours+":"+minutes;

      if(email==null||email.length()==0)

      email=new String("");

      if(!empty){

      //username=convert(username);

      //email=convert(email);

      //ucontent=convert(ucontent);

      sqlStr="insert into Mintegbook(Mname,Memail,Mcontent,Mtime,Mid) values("+username+","+email+","+ucontent+","+intime+",1)";

      getDsnConn();

      executeInsert(sqlStr);

      }

      sqlStr=new String("select Mname,Memail,Mcontent,Mtime from Mintegbook order by Mtime DESC");

      getDsnConn();

      reccount=getRecordCount("Mintegbook");

      if(reccount==0)

      noResult=true;

      else

      noResult=false;

      if(!noResult){

      int ipageSize=10;

      totalPage=getTotalPage("Mintegbook",ipageSize);

      if(currentPagetotalPage)

      currentPage=totalPage;

      int cursor=(currentPage-1)*ipageSize+1;

      try{

      myrs=executeScrollableQuery(sqlStr);

      myrs.absolute(cursor);

      }

      catch(SQLException e){

      noResult=true;

      }

      }

      out.println("HTMLHEADTITLE我的Servlet留言板/TITLE");

      out.println("META http-equiv="Content-Type" content="text/html; charset=gb2312"");

      out.println("STYLE type="text/css"");

      out.println("!--");

      out.println(".mytext { font-family: "宋體"; font-size: 12px}");

      out.println(" --");

      out.println("/STYLE");

      out.println("/HEAD");

      out.println("BODY bgcolor="#FFFFFF" text="#000000"");

      out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="0" align="CENTER" class="mytext"");

      out.println("TRTD height="22" | a href=""我的主頁(yè)/a | 我的Servlet留言板(A href="mailto:yf188@21cn.com"川石/A制作)/TD/TR");

      out.println("TRTD height="1" bgcolor="#999933"/TD/TR");

      out.println("/TABLE");

      out.println("BR");

      out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="0" align="CENTER" class="mytext"");

      out.println("TRTD height="8"/TD/TR");

      out.println("TRTD height="18" bgcolor="#f7f7f7"DIV align="right"");

      out.println("共有 "+reccount + " 條留言 ");

      out.println(" 當(dāng)前第font color=#ff0000"+currentPage+"/font/共 "+totalPage+" 頁(yè) ");

      if(currentPage1)

      out.println(" a href=guestbookServlet?ipage=1首頁(yè)/a a href=guestbookServlet?ipage="+(currentPage-1)+"上一頁(yè)/a ");

      else

      out.println(" 首頁(yè) 上一頁(yè) ");

      if(currentPagetotalPage)

      out.println(" a href=guestbookServlet?ipage="+(currentPage+1)+"下一頁(yè)/a a href=guestbookServlet?ipage="+totalPage+"末頁(yè)/a ");

      else

      out.println(" 下一頁(yè) 末頁(yè) ");

      out.println("/DIV/TD/TR");

      out.println("/TABLE");

      out.println("BR");

      //這里是顯示留言內(nèi)容

      if(!noResult){

      String dname;

      String demail;

      String dcontent;

      String dtime;

      Date temptime;

      try{

      do{

      dname=new String(myrs.getString("Mname"));

      demail=new String(myrs.getString("Memail"));

      dcontent=new String(myrs.getString("Mcontent"));

      try{

      dtime=new String(myrs.getObject("Mtime").toString());

      }

      catch(java.lang.NullPointerException e){

      dtime=new String("2001-04-06 12:30");

      }

      if(dname==null)

      dname=new String("川石");

      if(demail==null)

      demail=new String("yf188@21cn.com");

      if(dcontent==null)

      dcontent=new String("test");

      if(dtime==null)

      dtime=new String("2001-04-06 12:30");

      dname=convert(dname);

      dcontent=convert(dcontent);

      //temptime=myrs.getDate("Mtime");

      /*

      String tempyear=String.valueOf(temptime.getYear()+1900);

      String tempmonth=String.valueOf(temptime.getMonth()+1);

      if(tempmonth.length()==1)

      tempmonth=new String("0"+tempmonth);

      String tempdays=String.valueOf(temptime.getDate());

      if(tempdays.length()==1)

      tempdays=new String("0"+tempdays);

      String tempminute=String.valueOf(temptime.getMinutes());

      if(tempminute.length()==1)

      tempminute=new String("0"+tempminute);

      String temphours=String.valueOf(temptime.getHours());

      if(temphours.length()==1)

      temphours=new String("0"+temphours);

      String dtime=tempyear+" 年 "+ tempmonth +" 月 "+ tempdays +" 日 " + temphours+ " 時(shí) "+ tempminute + " 分 ";

      */

      out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="4" align="CENTER" class="mytext"");

      out.println("TRTD姓名 A href="mailto:"+demail+"""+dname+"/A 留言時(shí)間:"+dtime+"/TD/TR");

      out.println("TRTD height="10"/TD/TR");

      out.println("TRTD height="10""+dcontent+"/TD/TR");

      out.println("/TABLE");

      out.println("HR width="600" size="1"");

      }while(myrs.next());}

      catch(SQLException e){

      out.println("error found");

      }

      }

      else{

      out.println("還沒有留言!");

      }

      //結(jié)束

      out.println("FORM name="form1" method="post" action="guestbookServlet"");

      out.println("TABLE width="600" border="0" cellspacing="0" cellpadding="4" align="CENTER" class="mytext"");

      out.println("TRTD width="80"姓名:/TDTDINPUT type="text" name="username"*/TD/TR");

      out.println("TRTDEmail:/TDTDINPUT type="text" name="email"*/TD/TR");

      out.println("TRTD留言:/TDTDTEXTAREA name="ucontent" cols="65" rows="4"/TEXTAREA/TD/TR");

      out.println("/TABLE");

      out.println("TABLE width="400" border="0" cellspacing="0" cellpadding="6" align="CENTER" class="mytext"");

      out.println("TRTD height="15" width="200" /TDTD /TD/TR");

      out.println("TRTDDIV align="RIGHT"INPUT type="button" name="Button" value=" 提 交 " style="cursor:hand" onclick="javascript:check()"/DIV/TD");

      out.println("TDINPUT type="reset" name="Submit2" value=" 重 置 "/TD/TR");

      out.println("/TABLE");

      out.println("/FORM");

      out.println("TABLE width="400" border="0" cellspacing="0" cellpadding="4" align="CENTER" class="mytext"");

      out.println("TRTD width="15" /TD/TR");

      out.println("TRTDDIV align="LEFT"/DIV/TD/TR");

      out.println("TRTD /TD/TR");

      out.println("/TABLE");

      out.println("/BODY");

      out.println("/HTML");

      out.println("SCRIPT language="javascript"");

      out.println("function check(){");

      out.println("if(form1.username.value.length1||form1.ucontent.value.length1)");

      out.println("{alert(姓名和留言是必須有的!);}else{form1.submit();}}");

      out.println("/SCRIPT");

      out.close();

      }

      /** Handles the HTTP codeGET/code method.

      * @param request servlet request

      * @param response servlet response

      */

      protected void doGet(HttpServletRequest request, HttpServletResponse response)

      throws ServletException, java.io.IOException {

      processRequest(request, response);

      }

      /** Handles the HTTP codePOST/code method.

      * @param request servlet request

      * @param response servlet response

      */

      protected void doPost(HttpServletRequest request, HttpServletResponse response)

      throws ServletException, java.io.IOException {

      processRequest(request, response);

      }

      protected void getDsnConn(){

      String sqlUrl="jdbc:mysql://10.0.0.1/你申請(qǐng)用戶名?user=你的名字password=你的帳號(hào)";

      try{

      if(debug)

      conn=DriverManager.getConnection("jdbc:odbc:ODBC源","用戶名","密碼口令");

      else

      conn=DriverManager.getConnection(sqlUrl);

      }

      catch(SQLException es){

      System.err.println("和庫(kù)連接時(shí)出錯(cuò):"+es.getMessage());

      }

      }

      protected void executeInsert(String sqlStr){

      try{

      Statement stmt=conn.createStatement();

      stmt.executeUpdate(sqlStr);

      }

      catch(SQLException es){

      System.err.println("執(zhí)行插入時(shí):"+es.getMessage());

      }

      }

      protected void executeUpdate(String sqlStr){

      try{

      Statement stmt=conn.createStatement();

      stmt.executeUpdate(sqlStr);

      }

      catch(SQLException e){

      System.err.println("error in query record");

      }

      }

      //查尋

      protected ResultSet executeQuery(String sqlStr){

      rs=null;

      try{

      Statement stmt=conn.createStatement();

      rs=stmt.executeQuery(sqlStr);

      }

      catch(SQLException ex){

      System.err.println("執(zhí)行查尋出錯(cuò):"+ex.getMessage());

      }

      return rs;

      }

      protected ResultSet executeScrollableQuery(String sqlStr){

      rs=null;

      try{

      Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);

      rs=stmt.executeQuery(sqlStr);

      }

      catch(SQLException e){

      System.err.println("執(zhí)行動(dòng)態(tài)查尋出錯(cuò)");

      }

      return rs;

      }

      //得到表記錄總數(shù)

      protected int getRecordCount(String sTableName){

      rs=null;

      int CountResult=0;

      String sqlStr="select count(*) from "+sTableName;

      try{

      Statement stmt=conn.createStatement();

      rs=stmt.executeQuery(sqlStr);

      if(rs.next())

      CountResult=rs.getInt(1);

      rs=null;

      stmt.close();

      }

      catch(SQLException ex){

      System.err.println(ex.getMessage());

      }

      return CountResult;

      }

      //得到記錄總頁(yè)數(shù)

      protected int getTotalPage(String sTableName,int iPageSize){

      int totalPage;

      int totalRecNum=getRecordCount(sTableName);

      if(totalRecNum%iPageSize==0)

      totalPage=totalRecNum/iPageSize;

      else

      totalPage=totalRecNum/iPageSize+1;

      return totalPage;

      }

      protected String convert(String InputStr){

      String converted=new String();

      byte[] bytes;

      try{

      bytes=InputStr.getBytes("ISO8859-1");

      converted=new String(bytes,"GB2312");

      }

      catch(java.io.UnsupportedEncodingException e){

      System.out.print("error");

      }

      return converted;

      }

      /** Returns a short description of the servlet.

      */

      public String getServletInfo() {

      return "Short description";

      }

      }

      JAVA 實(shí)現(xiàn)一個(gè)簡(jiǎn)單網(wǎng)頁(yè)留言板

      這個(gè)不是很簡(jiǎn)單嗎

      你好奇怪哎,編輯器推薦百度ueditor富文本編輯器

      功能很強(qiáng)大,jsp。php都有

      java js留言板

      package com.zhh.test;

      import java.awt.*;

      import javax.swing.*;

      import java.awt.event.*;

      public class JB extends JFrame implements ActionListener

      {

      private JTextField Input1,Input2,Input3;

      private JButton btnOK;

      private static final String OK="計(jì)算";

      private JTextField ShowAnswer;

      public JB(String strTitle)

      {

      super(strTitle);

      Container c=getContentPane();

      c.setLayout(new FlowLayout());

      Input1=new JTextField(4);

      Input2=new JTextField(4);

      Input3=new JTextField(4);

      ShowAnswer=new JTextField(4);

      btnOK=new JButton(OK);

      c.add(new JLabel("請(qǐng)輸入待計(jì)算的兩個(gè)數(shù)據(jù):"));

      c.add(Input1);

      c.add(Input2);

      c.add(new JLabel("請(qǐng)輸入計(jì)算符(1 for + ,2 for - ,3 for * ,4 for / ):"));

      c.add(Input3);

      c.add(new JLabel("計(jì)算結(jié)果:"));

      c.add(ShowAnswer);

      c.add(btnOK);

      btnOK.addActionListener(this);

      this.addWindowListener(new WindowAdapter()

      {

      public void windowClosing(WindowEvent e)

      {

      System.exit(0);

      }

      });

      this.setSize(310,100);

      this.setVisible(true);

      }

      public static void main(String[] args)

      {

      new JB("JButtonTest Testing!!!");

      }

      public void actionPerformed(ActionEvent e){

      int num4 = 0;

      int num1=Integer.parseInt(Input1.getText());

      int num2=Integer.parseInt(Input2.getText());

      int num3=Integer.parseInt(Input3.getText());

      if(num3==1){ num4=num1+num2 ;}

      if(num3==2){ num4=num1-num2 ;}

      if(num3==3){ num4=num1*num2 ;}

      if(num3==4){ num4=num1/num2 ;}

      ShowAnswer.setText(String.valueOf(num4));

      }

      }


      新聞標(biāo)題:留言板java代碼 web留言板代碼
      網(wǎng)站URL:http://www.ef60e0e.cn/article/doohsdi.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        鄂托克旗| 丹凤县| 乾安县| 邮箱| 得荣县| 朔州市| 青阳县| 庆安县| 蓝田县| 武功县| 菏泽市| 楚雄市| 轮台县| 柯坪县| 石棉县| 旅游| 龙岩市| 江陵县| 梅河口市| 玛沁县| 前郭尔| 丽江市| 长沙县| 门源| 北票市| 柯坪县| 正定县| 宁远县| 堆龙德庆县| 饶河县| 连江县| 肃宁县| 乌兰浩特市| 隆回县| 张家界市| 都匀市| 高阳县| 西昌市| 观塘区| 博湖县| 迁西县|