java網(wǎng)頁
提問問題
列表
-
eclipse怎么打開可視圖形界面設(shè)計
查看答案>>
-
jsp做登錄,注冊頁面 數(shù)據(jù)庫
查看答案>>
-
Eclipse編寫的HTML格式的網(wǎng)頁如何運行?
查看答案>>
-
java 項目什么從后臺向前頁面輸出html標(biāo)簽?
查看答案>>
-
java web 開發(fā) 購物網(wǎng)站 怎么做訂單結(jié)算部分????
查看答案>>
-
如何在JSP網(wǎng)頁中生成動態(tài)圖表
查看答案>>
-
java web二進(jìn)制流的圖片如何用response返回給前臺
查看答案>>
-
如何以Java實現(xiàn)網(wǎng)頁截圖技術(shù),根據(jù)URL得到網(wǎng)頁快照
查看答案>>
-
求一個javaweb做的博客系統(tǒng)源碼。。。
查看答案>>
eclipse怎么打開可視圖形界面設(shè)計
安裝windowbuilder插件即可首先,需要知道自己的Eclipse是什么版本的.可以到Eclipse的安裝目錄下用記事本打開.eclipseproduct文件,version后面對應(yīng)的就是版本號.打開該插件下載地址,里面有Update Sites,下面有Eclipse Version,Release Version,Integration Version欄目.選擇對應(yīng)版本的link.復(fù)制URL地址.打開Eclipse,選擇Help→Install New Software,在work with里面把得到的URL復(fù)制進(jìn)去.勾選所有,點擊Next安裝就好了.是已經(jīng)安裝過的,所以按鈕是灰色的。然后新建項目,New→Project→WindowBuilder→SWT Designer→SWT/JFace Java Project然后建立一個包,在建類的時候選擇New→Other,選擇WindowBuilder→Swing Designer→Application Window.類建好之后點擊Design就可以進(jìn)行可視化編輯了。
jsp做登錄,注冊頁面 數(shù)據(jù)庫
jsp登錄注冊頁面都需要查詢和插入數(shù)據(jù)庫的,還要檢查注冊信息存不存在。完整例子如下:用戶信息的bean:package chen; public class UserBean { private String userid; private String password; public void setUserId(String userid) { this.userid=userid; } public void setPassword(String password) { this.password=password; } public String getUserId() { return this.userid; } public String getPassword() { return this.password; } } 提交數(shù)據(jù)庫的bean:package chen; import com.mysql.jdbc.Driver; import java.sql.*; public class UserRegister { private UserBean userBean; private Connection con; //獲得數(shù)據(jù)庫連接。 public UserRegister() { String url="jdbc:mysql://localhost/"+"chao"+"?user="+"root"+"&password="+"850629"; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url); } catch(Exception e) { e.printStackTrace(); } } //設(shè)置待注冊的用戶信息。 public void setUserBean(UserBean userBean) { this.userBean=userBean; } //進(jìn)行注冊 public void regist() throws Exception { String reg="insert into userinfo(userid,password) values(?,?)"; try { PreparedStatement pstmt=con.prepareStatement(reg); pstmt.setString(1,userBean.getUserId()); pstmt.setString(2,userBean.getPassword()); pstmt.executeUpdate(); } catch(Exception e) { e.printStackTrace(); throw e; } } } 提交注冊數(shù)據(jù)進(jìn)入數(shù)據(jù)庫:<%@ page contentType="text/html;charset=gb2312" pageEncoding="gb2312" import="chen.*" %> <jsp:useBean id="userBean" class="chen.UserBean" scope="request"> <jsp:setProperty name="userBean" property="*"/> </jsp:useBean> <jsp:useBean id="regist" class="chen.UserRegister" scope="request"/> <html> <head> <title> 用戶信息注冊頁面</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <% String userid =request.getParameter("userid"); String password = request.getParameter("password"); userBean.setUserId(userid); userBean.setPassword(password); System.out.println(userid+password); %> <% try{ regist.setUserBean(userBean); out.println(userid); regist.regist(); out.println("注冊成功");} catch(Exception e){ out.println(e.getMessage()); } %> <br> <a href="login.jsp">返回</a> </body> </html> 登陸驗證頁面:<%@page import="java.sql.*" contentType="text/html;charset=GB2312" %> <%@page import="java.util.*"%> <% String userid1=new String(request.getParameter("userid")); String password1=new String(request.getParameter("password")); Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/chao","root","850629"); Statement stmt=con.createStatement(); String sql="select * from userinfo where userid='"+userid1+"';"; ResultSet rs=stmt.executeQuery(sql); if(rs.next()) {String password=new String(rs.getString("password")); if(password.equals(password1)) {session.setAttribute("userid1",userid1); response.sendRedirect("sucess.jsp"); } else {response.sendRedirect("login.jsp"); } } else {response.sendRedirect("login.jsp"); } %> 登陸頁面:<%@ page contentType="text/html; charset=gb2312" %> <html> <body> <form method="get" action="checklogin.jsp"> <table> <tr><td> 輸入用戶名:</td> <td><input type=text name=userid ></td> </tr> <tr><td>輸入密碼:</td> <td><input type=password name=password></td> </tr> <tr><td><input type=submit value=確認(rèn)> </td></tr> </table> </form> <form action="register.jsp"> <input type=submit value=注冊> </form> </body> </html> 注冊頁面:<%@page contentType="text/html; charset=gb2312" language="java" import="java.util.*,java.io.*"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <center> <h1>注冊新用戶</h1> <form action="adduser.jsp" method=post> <table border="1" bgcolor="#0099CC"> <tr> <td> 用戶名: <input type="text" name="userid"> </td> </tr> <tr valign="middle"> <td> 密碼: <input type="password" name="password" readonly> </td> </tr> <tr> <td> <input type=submit value=提交> </td> </tr> </table> </form> </center> </body> </html> 登陸成功頁面:<%@page import="java.util.*" contentType="text/html; charset=gb2312" %> <%@include file="trans.jsp"%> <html> <head> <title> sucess </title> </head> <body bgcolor="#ffffff"> <h1> 登錄成功,歡迎您! </h1><%=trans(session.getAttribute("userid1"))%> </body> </html>
Eclipse編寫的HTML格式的網(wǎng)頁如何運行?
1.打開eclipse→Windows→Preferences→Java→Editor→Content Assist修改Auto Activation triggers for java的值為:zjava,點擊apply按鈕; 如圖: 2.繼續(xù)打開JavaScript→Editor→Content Assist修改Auto Activation triggers for javaScript的值為:zjs,點擊apply按鈕; 如圖: 3.繼續(xù)打開web→html Files→Editor→Content Assist修改Prompt when these characters are inserted:的值為:zhtml ,點擊apply按鈕; 如圖: 4.打開File→Export→Genral→Preferences→導(dǎo)出一文件到任意位置,然后用記事本打開此文件 ,Ctrl+F查找 zjava 然后將其值改為: .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW 再查找 zjs,然后將其值改為: .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW 再查找 zhtml,然后將其值改為: <=.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW 保存文件?! ?.打開eclipse→File→Import→Genral→Preferences,導(dǎo)入剛剛編輯的文件后,所有設(shè)置完畢,現(xiàn)在去測試一下。
java 項目什么從后臺向前頁面輸出html標(biāo)簽?
1、JSP頁面使用html標(biāo)簽來做數(shù)據(jù)輸出,最終jsp頁面都會轉(zhuǎn)化成java代碼來執(zhí)行的,所有的輸出都會轉(zhuǎn)化成response.getWriter().write(String)。2、如果是標(biāo)簽的話,首先處理標(biāo)簽把標(biāo)簽轉(zhuǎn)化成對應(yīng)的字符串,最終還是以response.getWriter().write(String)方式輸出的頁面。
java web 開發(fā) 購物網(wǎng)站 怎么做訂單結(jié)算部分????
購物電商網(wǎng)站,做支付部分,需要購物車訂單是在用戶提交購物車?yán)锩娴纳唐罚4娴挠唵纬跏夹畔?,此時狀態(tài)為未支付訂單信息需要用戶進(jìn)行選擇支付方式,進(jìn)行相應(yīng)付款操作,此時訂單狀態(tài)要根據(jù)支付結(jié)果來修改,如果支付成功,銀聯(lián)或者支付寶、微信、會后臺通知到你的應(yīng)用,訂單狀態(tài)修改為已支付;如果沒有支付成功,訂單狀態(tài)還是未支付。網(wǎng)站需要和銀聯(lián)或者支付寶、微信建立對賬機(jī)制,保證程序內(nèi)出現(xiàn)訂單狀態(tài)不一致時的,這是保持訂單數(shù)據(jù)一致性的補(bǔ)救措施。訂單結(jié)算:最主要就是下單、支付、支付結(jié)果通知、對賬。每一步都要按照文檔來做。
如何在JSP網(wǎng)頁中生成動態(tài)圖表
JSP頁面中嵌入動態(tài)圖表的兩種方法 :在JSP頁面中插入Applet小程序 ;通過JavaBean動態(tài)生成圖像。JSP是一種廣泛應(yīng)用的網(wǎng)頁設(shè)計技術(shù) ,它是一種HTML和Java腳本混合的編程技術(shù) ,它結(jié)合了HTML的靜態(tài)特性和Java語言的動態(tài)能力 ,因此用它進(jìn)行動態(tài)網(wǎng)頁設(shè)計非常方便。在進(jìn)行圖像處理時 ,一般處理靜態(tài)圖片非常容易 ,但是 ,在實際應(yīng)用中常常需要動態(tài)地在網(wǎng)頁中生成二維的圖形.基于JFreeChart開發(fā)的一個時序圖的繪制。代碼如下:實例中createDataset()方法用于創(chuàng)建數(shù)據(jù)集合對象。時序圖的數(shù)據(jù)集合與其他數(shù)據(jù)集合不同,它需要添加一個時間段內(nèi)的所有數(shù)據(jù),通常采用TimeSeries類進(jìn)行添加。該實例中通過Math類的random()方法進(jìn)行隨機(jī)生成。import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.BufferedInputStream;import java.io.DataInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.net.URL;import java.net.URLConnection;import java.text.DateFormat;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;import java.util.Random;import javax.swing.JApplet;import javax.swing.Timer;import org.jfree.chart.*;import org.jfree.chart.annotations.CategoryTextAnnotation;import org.jfree.chart.axis.CategoryAnchor;import org.jfree.chart.axis.CategoryAxis;import org.jfree.chart.axis.CategoryLabelPositions;import org.jfree.chart.axis.DateAxis;import org.jfree.chart.axis.DateTickUnit;import org.jfree.chart.axis.DateTickUnitType;import org.jfree.chart.axis.ValueAxis;import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;import org.jfree.chart.plot.CategoryPlot;import org.jfree.chart.plot.PlotOrientation;import org.jfree.chart.plot.XYPlot;import org.jfree.chart.renderer.category.BarRenderer;import org.jfree.chart.title.TextTitle;import org.jfree.data.category.CategoryDataset;import org.jfree.data.category.IntervalCategoryDataset;import org.jfree.chart.axis.NumberAxis;import org.jfree.data.category.DefaultCategoryDataset;import org.jfree.data.gantt.Task;import org.jfree.data.gantt.TaskSeries;import org.jfree.data.gantt.TaskSeriesCollection;import org.jfree.data.time.Day;import org.jfree.data.time.Second;import org.jfree.data.time.TimeSeries;import org.jfree.data.time.TimeSeriesCollection;import org.jfree.data.xy.XYDataset;public class shixutu extends JApplet { //PLOT_FONT是一靜態(tài)的字體常量對象,使用此對象可以避免反復(fù)用到的字體對象被多次創(chuàng)建 private static final Font PLOT_FONT = new Font("黑體", Font.ITALIC , 18); JFreeChart chart; //創(chuàng)建數(shù)據(jù)動態(tài)更新的監(jiān)聽 class DataGenerator extends Timer implements ActionListener { private static final long serialVersionUID = 3977867288743720504L; String equID; //設(shè)備ID號 int totalTask; //任務(wù)數(shù) String[][] strTask; //任務(wù)情況 public void actionPerformed(ActionEvent actionevent) { addTotalObservation(); } DataGenerator() { super(1000, null); addActionListener(this); System.out.println("super"); } } //將更新的數(shù)據(jù)添加到chart中 private void addTotalObservation() { System.out.println("addTotalObservation"); //設(shè)置新的數(shù)據(jù)集 chart.getXYPlot().setDataset(createDataset()); //通知Jfreechart 數(shù)據(jù)發(fā)生了改變,重新繪制柱狀圖 if (chart != null) { chart.fireChartChanged(); } } private static void processChart(JFreeChart chart) { //設(shè)置標(biāo)題字體 chart.getTitle().setFont(new Font("隸書", Font.BOLD, 26)); //設(shè)置背景色 chart.setBackgroundPaint(new Color(252,175,134)); XYPlot plot = chart.getXYPlot(); //獲取圖表的繪制屬性 plot.setDomainGridlinesVisible(false); //設(shè)置網(wǎng)格不顯示 //獲取時間軸對象 DateAxis dateAxis = (DateAxis) plot.getDomainAxis(); dateAxis.setLabelFont(PLOT_FONT); //設(shè)置時間軸字體 //設(shè)置時間軸標(biāo)尺值字體 dateAxis.setTickLabelFont(new Font("宋體",Font.PLAIN,12)); dateAxis.setLowerMargin(0.0); //設(shè)置時間軸上顯示的最小值 //獲取數(shù)據(jù)軸對象 ValueAxis valueAxis = plot.getRangeAxis(); valueAxis.setLabelFont(PLOT_FONT); //設(shè)置數(shù)據(jù)字體 DateFormat format = new SimpleDateFormat("mm分ss秒"); //創(chuàng)建日期格式對象 //創(chuàng)建DateTickUnit對象 DateTickUnit dtu = new DateTickUnit(DateTickUnitType.SECOND,30,format); dateAxis.setTickUnit(dtu); //設(shè)置日期軸的日期標(biāo)簽 } //將結(jié)果輸出在文件中 private static void writeChartAsImage(JFreeChart chart) { FileOutputStream fos_jpg = null; try { fos_jpg = new FileOutputStream("D:\\test\\shixutu.jpg"); ChartUtilities.writeChartAsJPEG(fos_jpg, 1, chart, 400, 300, null); } catch (Exception e) { e.printStackTrace(); } finally { try { fos_jpg.close(); } catch (Exception e) { } } } //創(chuàng)建數(shù)據(jù)集合對象 public static XYDataset createDataset() { //實例化TimeSeries對象 TimeSeries timeseries = new TimeSeries("Data"); Second second = new Second(); //實例化Day double d = 50D; //添加一年365天的數(shù)據(jù) for (int i = 0; i < 500; i++) { d = d + (Math.random() - 0.5) * 10; //創(chuàng)建隨機(jī)數(shù)據(jù) timeseries.second(day, d); //向數(shù)據(jù)集合中添加數(shù)據(jù) second = (Second) second.next(); } TimeSeriesCollection timeSeriesCollection = new TimeSeriesCollection(timeseries); //返回數(shù)據(jù)集合對象 return timeSeriesCollection; } //Applet程序初始化 public void init() { // 1. 得到數(shù)據(jù) XYDataset dataset = createDataset(); // 2. 構(gòu)造chart chart = ChartFactory.createTimeSeriesChart( "時序圖示范", // 圖表標(biāo)題 "時間", // 目錄軸的顯示標(biāo)簽--橫軸 "數(shù)值", // 數(shù)值軸的顯示標(biāo)簽--縱軸 dataset, // 數(shù)據(jù)集 false, false, // 是否生成工具 false // 是否生成URL鏈接 ); // 3. 處理chart中文顯示問題 processChart(chart); // 4. chart輸出圖片 //writeChartAsImage(chart); // 5. chart 以swing形式輸出 //6.使用applet輸出 ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(800,500)); getContentPane().add(chartPanel); (new DataGenerator()).start(); } public void paint(Graphics g) { if (chart != null) { chart.draw((Graphics2D) g, getBounds()); } } public void destroy() { }}
java web二進(jìn)制流的圖片如何用response返回給前臺
response.setHeader("Content-Type","image/jped");//設(shè)置響應(yīng)的媒體類型,這樣瀏覽器會識別出響應(yīng)的是圖片response.getOutputStream().write(bytes);response.flush()
如何以Java實現(xiàn)網(wǎng)頁截圖技術(shù),根據(jù)URL得到網(wǎng)頁快照
如何以Java實現(xiàn)網(wǎng)頁截圖技術(shù),根據(jù)URL得到網(wǎng)頁快照 // 此方法僅適用于JdK1.6及以上版本 Desktop.getDesktop().browse( new URL("http://www.csdn.net/").toURI()); Robot robot = new Robot(); //停留10s //robot.delay(10000); Dimension d = new Dimension(Toolkit.getDefaultToolkit().getScreenSize()); int width = (int) d.getWidth(); int height = (int) d.getHeight(); // 最大化瀏覽器 robot.keyRelease(KeyEvent.VK_F11); robot.delay(2000); Image image = robot.createScreenCapture(new Rectangle(0, 0, width, height)); BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics g = bi.createGraphics(); g.drawImage(image, 0, 0, width, height, null); // 保存圖片 ImageIO.write(bi, "jpg", new File("c:/iteye.com.jpg"));
熱門問答
- 模版還是模板
- 免費建站
- 淘寶網(wǎng)頁是哪個公司做的
- 免費制作企業(yè)
- 簡單個人網(wǎng)站模板
- 制作網(wǎng)站的的網(wǎng)站
- 怎么學(xué)網(wǎng)頁設(shè)計
- html模板文件
- 手機(jī)網(wǎng)站的優(yōu)化
- 什么是排版設(shè)計
- 廣告公司網(wǎng)站制作
- 網(wǎng)站優(yōu)化是什么
- 怎么用手機(jī)制作簡歷
- 武漢建設(shè)網(wǎng)站
- 網(wǎng)站建設(shè)公司怎么樣
- seo優(yōu)化培訓(xùn)
- 網(wǎng)站的建設(shè)哪家好
- 制作簡歷圖片
- 什么是網(wǎng)絡(luò)推廣優(yōu)化
- 網(wǎng)頁制作學(xué)那些