導航:首頁 > 編程語言 > javaweb留言板

javaweb留言板

發布時間:2022-07-01 08:34:10

java的留言板是怎麼實現新留言,和回復留言的。

首先要會資料庫,做一張留言表,一張回復表,留言表和回復表呈現一對多關系,就是說在回復表裡面加一列叫做『留言編號』,每次添加回復數據的時候,把對應的的留言id寫進表裡,insert into
回復表 values(回復id,留言id,回復內容、、、)查的時候 select * from 回復表 where 留言id=想查回復的留言的id,希望理解我說的

❷ 急!!!java web的留言板,在留言的form提交之後,可以顯示留言內容,並更新資料庫,但總不能及時顯示

方法有很多啊。比如你插完資料庫之後,重新查詢資料庫並綁定數據。
第二種方式,javascript的reload()方法,重新載入
第三種方式 window.location屬性,重新跳轉到這個頁
然後你說提交2顯示1,提交3顯示2,你要考慮一下你的數據插入和數據綁定,這兩件事的前後順序是不是有問題。然後如果提交表單後要刷新頁面的話,可以嘗試用ajax方式獲取資料庫中的數據

❸ 用Java web 做一個留言板 留言功能實現了,不知道怎麼實現回復和刪除留言的功能,知道的高手,請幫幫忙。

先說說回復吧:
假如:
留言表(id , text )兩個欄位
回復表( id , text parentId )用來存放留言表id 三個欄位
目前有一條留言
1001,'這是一條留言';
那麼給這條留言的回復就是
1003 , '這是一條回復', 1001(這就是該留言的ID) 這樣就把留言和回復關聯上了
回復後點保存時,將數據傳入後台,資料庫做insert操作就行了

刪除一樣的
如果刪除回復,直接傳入回復的ID 即可
如果刪除留言,得先判斷該留言有沒有回復,如果有回復,則先刪除回復,在刪除留言(外鍵約束)

❹ 請問,java WEB怎麼實現在文本框中輸入留言,然後在頁面中顯示出來,並且保存到資料庫

輸入留言提交後用jquery獲取內容放在div中顯示,用$.post()非同步提交後台,後台獲取到後用jdbc或框架持久化存入資料庫

❺ 用Java做一個類似於QQ空間留言板的功能。。。

不用資料庫也能實現. 及時性的罷了;
要是資料庫的話:方法一(用於有條件性的,比如只顯示對方發的信息)
1 user表 id , use 兩列
2 messages表 id , message , message_person , use_id (外鍵) 四列
方法二(雙方都用select * form messages查詢所有信息)
1 messages表 id , message 兩列

❻ 怎樣用Java、jsp和servlet做個web留言板

那要看您的需求了,詳細的需求分析會讓您的程序功能的更好實現?就如您問的;您是要要寫好的代碼還是要怎麼實現,在別人看來就不從得知了

❼ 如果用java web寫一個類似於qq留言的網站留言系統,那麼留言的內容保存在哪裡呢資料庫里還是其他...

我寫過留言板,是放在資料庫里,建個留言的表,然後設置外鍵關系就可以了。感覺文件不太方便

❽ 關於javaee web項目ssh框架實現留言板功能

是不是要加上雙引號,getPatameter(字元串)
應該是getParameter("guestName");、
其他類似

❾ 急急急!java簡單留言板

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

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("留言內容:");
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("留言內容:");
}
});
}
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簡易留言板程序該怎麼寫

我覺得你還是說的復雜點吧,你這樣說,我都不知道具體怎麼寫,是聊天室,還是留言板,是web端的?

閱讀全文

與javaweb留言板相關的資料

熱點內容
撲克牌睡眠解壓 瀏覽:190
rc4演算法流程圖 瀏覽:157
胡蘿卜解壓方法 瀏覽:35
掃描pdf格式軟體 瀏覽:876
程序員在銀行開賬戶 瀏覽:516
android資料庫下載 瀏覽:748
中午伺服器崩潰怎麼辦 瀏覽:425
產品經理和程序員待遇 瀏覽:442
解憂程序員免費閱讀 瀏覽:109
錄像免壓縮 瀏覽:508
總結所學過的簡便演算法 瀏覽:362
南昌哪些地方需要程序員 瀏覽:761
三台伺服器配置IP地址 瀏覽:175
如何用命令方塊連續對話 瀏覽:280
win7linux共享文件夾 瀏覽:304
命令符打開本地服務 瀏覽:601
android應用程序源碼 瀏覽:705
安卓開發工程師簡歷怎麼寫 瀏覽:63
熱水器水量伺服器是什麼意思 瀏覽:119
stk衛星編譯 瀏覽:480