Use Struts to combine JBuilder7, MySQL to establish a Web site (2) - Page Display

zhaozj2021-02-16  46

Use Struts to combine JBuilder7, MySQL to establish a Web site (2) - Page Display

Author: Sailing (blue shrimp)

IAMCYH@263.net This program all source code: vod.zip introduction: This article follows the first content, continuing the production of the VOD website (first "using struts combined with jbuilder7, mysql to establish a Web site (1) - Connection database "), when we need to provide a large amount of content in the database, we generally use two methods, the first simple, read the contents of the database in the database, then all displayed on the web, this The method is generally used when the amount of data is small; there is a method to display the paging display, and it is also a way to use the major websites. There are many ways to paginize, and I use it here to take a mobile database pointer. Methods.

Establishing pageInfo bean's task is to store all information about pagination, including total number of pages, total number of records, current pages, number of pages of the previous page, the number of pages of the next page, will these five Information is included in the same bean will have a great convenience of programming in the JSP page, because there are currently many websites to put the current pages, the number of pages of the previous page, and the number of pages of the next page In the bean, but in the JSP page, add 1 and minus 1, which is added, although it is very convenient, but this will result in logical operations in the JSP page, destroy the rules of the MVC, or above Putting 5 variables into a bean programming method is just my personal habit. If you feel that there is something wrong, please advise. The code for pageinfo is as follows:

package vod.model; import java.util.Vector; public class PageInfo {private int totalPage; // total number of pages private int resultCount; // a total of how many records private int page; // current number of pages private int previousPage ; // Previous PRIVATE INT NEXTPAGE; / / Next Public Void SetTotalpage (INT TOTALPAGE) {this.totalpage = Totalpage;} public int gettotalpage ()}} ---------------------------------- Public void setResultcount (int count) {this.resultcount = count;} Public int getResultcount () {returnrate resultcount;} // -------------------------------------------------------------------------------------------------------------------------------------------- ----- Public void setpage (int page) {this.page = page;} public int get;} // ------------------ ------------------------- Public void setpreviouspage = page;} public int getpreviouspage () {Return (this. Page-1);} // ------------------------------------------ -public void setnextPage (INT page) {this.nextpage = page;} public int getNextPage () {return (this.page 1);} //-------------- --------------------------- / *** Generate a PageInfo object based on the array * We agree that index in the array is 0 Total number of pages * index is 1 record total * @Param info * @ Return * / public static pageinfo load (int "info) {pageinfo (); int int atvalue = 0; intValue = info [0]; if (INTVALUE > 0) PageInfo.SettotalPage (INTVALUE); INTVALUE = INFO [1]; if (INTVALUE> 0) PageInfo.setResultCount (INTVALUE); Return PageInfo;}} At the INT array in the LOAD () method here, we agree The first element in the middle page is the total page, the second element is the total number of records. The getPreviouspage () method here does not return PREVIOUSPAGE directly, but is reduced according to the value of Page. 1 Get previouspage is convenient for future calls.

Based on the database, we must first do what we have to do before making a paging is to determine what is the amount of data in the database you want. The amount of data can be divided into a few pages, with a total of how much data. Let's take a look at the implementation of this paging code (EvaluatedateBase.java):

package vod.model; import java.sql.Connection; import org.gjt.mm.mysql.jdbc2.ResultSet; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.SQLException; public class EvaluateDateBase { / *** Returns an instance of PageInfo based on the number of data sheets in the method, and returns a pageinfo instance * / public static pageinfo getpageInfo (String Datebase, Connection CONN, INT PAGESIZE) THROWS SQLEXCEPTION {INT TOTALPAGE = 0 ; int resultcount = 0; int = info = new int [2]; string sql = ""; if (conn == null) throw new SQLEXCEPTION ("No CONN EVALUATEDATEBASE"); ResultSet RsCount = NULL; preparedState psmt = NULL; SQL = "SELECT Count (*) from" DateBase; / / Depending on the database's name, the corresponding SQL statement try {psmt = conn.preparestatement (sql); rscount = (resultset) psmt.executeQuery (); rscount .next (); resultcount = rscount.getint (1); rscount.close ();} catch (sqlexception e) {E.PrintStackTrace ();} Totalpage = (Resultcount Pagesize-1) / PageSize; // Statistics Page number / / Remember our agreement? // index is 0 for the total number of pages, index is 1 Total number of records INFO [0] = TotalPage; Info [1] = resultcount; PageInfo PageInfo = PageInfo.Load (info); Return PageInfo;} SQL = "Select Count (*) from" DateBase; get the corresponding SQL statement, based on the result set obtained by this SQL statement through GetInt (1) How many records will be received by this result set.

And (Resultcount PageSize-1) / PageSize gets the number of record numbers that are displayed in need, maybe beginners will puzzle why not directly use the total number of results to get the total number of pages with the number of results required per page. This is because if the number of records contains cannot be completely removed, then the number of statistics will be less than one page, according to the above method calculations will get the correct value, if you are interested, everyone can calculate, of course, you can It is achieved by another method to be added if it is not possible to complete it. Finally, the total number of points and total record numbers are placed in a PageInfo instance for future calls.

Get all the movies about football, and obtain the appropriate LinkedList to obtain the code required by the appropriate LinkedList to get the code required by the page, and our page principle is simple, and an example: Currently we set up Only 10 records are displayed, so if the user wants to get the content on page 2, it is a record 11-20, we will move the database from the 10th record, then through While and Next ) The combined method obtains data from 10-20. Each record is then read, and the field of the database is matched in the field in the FOOTBALL BEAN through FOOTBALL LOAD () and put it in a LinkedList. Code below (MoreFootball.java): package vod.model; import java.sql.Connection; import org.gjt.mm.mysql.jdbc2.ResultSet; import java.sql.PreparedStatement; import java.sql.Statement; import java. sql.SQLException; import java.util.LinkedList; public class MoreFootball {Connection conn; public void setConn (Connection conn) {this.conn = conn;} public LinkedList getFootballList (int page, int pageSize) throws SQLException {LinkedList footballList; if (conn == null) throw new SQLException ( "No Connection in MoreFootball"); PreparedStatement pstmt = null; ResultSet rs = null; footballList = new LinkedList (); try {pstmt = conn.prepareStatement ( "select * from football order by Date DESC "); RS = (ResultSet) pstmt.executeQuery (); // According to the number of pages currently displayed and each page requires a pointer INT i = (Page-1) * PageSize; // Due to the 0 position IF (i! = 0) f (i! = 0) f (i); // If i is 10, then the database's pointer will move on / * for (int J = 0; j

Note that the code commented here: / * for (int J = 0; j Pagesize 10 definition, define 10 sets of records per page, this value can be passed through the CONTEXTPARAMETER in Servelet () Method acquisition. Then get the request for the user needs (the number of pages of this request will be followed by the link to the link in the JSP), and the number of users requested by the user is handled, ensuring that its value is within reasonable scope; EvaluatedateBAS's static method getPageInfo () gets the PageInfo instance of the total number of information about how many records you want to operate and the total number of information that has a total of how many pages, followed by the number of pages that have just been requested and obtained in this instance. The total number of pages is compared. If the number of sheets of the user request is greater than the total number of pages, the number of pages requested by the user is equal to the total number of pages, if the number of pages requested by the user is less than 0, then the number of pages requested by the user is equal to 1; Finally, the number of pages that will be adjusted to incorporate an instance of pageinfo so that the previous page of the number of pages of the user request is obtained later, the number of pages of the program, the number of pages of the program, and each page How many entries are displayed to getfootballList () get LinkedList containing the corresponding entry, and put it in the session, which is convenient to call in the page later. code show as below:

package vod.controller; import vod.model.PageInfo; import vod.model.MoreFootball; import vod.model.EvaluateDateBase; import java.io.IOException; import java.util.LinkedList; import java.util.Locale; import javax. servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts. action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; import java.sql.Connection; import java.sql.SQLException; import javax.sql.DataSource; public class MoreFootballAction Extends action {Connection Connection; LinkedList FootballList; Public ActionForward Perform (ActionMApping Mapping, ActionForm for m, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {ActionErrors errors = new ActionErrors (); HttpSession session = request.getSession (); int page = 0; // current number of pages required int pageSize = 0; // every Page Display how many data PageInfo FootballPageInfo = NULL; / / About information about the number of pages String Temppage; / / From the web.xml file acquired the number of entries displayed per page (I set to 10) PageSize = Integer.Parseint String) Servlet.getServletContext (). GetInitParameter ("Pagesize"))); // If there is no clear page number, the default is the first page Temppage = Request.getParameter ("page"); if (Temppage == Null) Temppage = " 1 "; page = integer.parseint (TEMPPAGE); Try {DataSource DataSource = servlet.finddataSource (NULL); connection = DataSource.getConnection (); // Check if the session already exists,

If you don't have a query, add FootballPageInfo // to session // // If you already exist directly from the session (SESSION.GETATTRIBUTE ("FootballPageInfo") == NULL) {// parameter is a data sheet name, connection, how many entries per page footballPageInfo = EvaluateDateBase.getPageInfo ( "football", connection, pageSize);} else {footballPageInfo = (PageInfo) session.getAttribute ( "footballPageInfo");} if (page> footballPageInfo.getTotalPage ()) {page = footballPageInfo.gettotalpage ();} else if (page <0) {page = 1;} // Set the previous page of FootballPageInfo and the value footballpageinfo.setpage (Page); // the footballPageInfo placed sessionsession.setAttribute ( "footballPageInfo", footballPageInfo); footballList = new LinkedList (); moreFootball morefootball = new moreFootball (); morefootball.setConn (connection); // connection setup data as necessary pages // and the number of pages per page article obtained LinkedListfootballList = morefootball.getFootballList (page, pageSize); if (footballList == null) {saveErrors (request, errors); return (new ActionForward ( "No footballList in vod.controller.MoreFootallAction "));} session.setttribute (" footballlist ", footballlist); // Put the FootballList will be put into session // do what you wish with myco Nnection} catch (sqlexception SQLE) {GetServlet (). log ("Connection.Process", SQLE);} Finally {// Enclose THIS IN A FINALLY BLOCK To Make // Sure THE Connection Is CloseDif (Connection! = NULL) TRY {Connection.close ();} catch (SQLException E) {getServlet (). log ("Connection.Close", E);}} Return ("Success"));}} Action.xml and Struts -config.xml file Configuration This will no longer be elaborated, please refer to the first article "Use Struts to combine JBuilder7, MySQL to establish Web Site (1) - Connect Database" struts-config.xml:

<- This is the Struts configuration file for the example application, using the proposed new syntax NOTE: You would only flesh out the details in the." form- bean "declarations if you had a generator tool that used them to createthe corresponding Java classes for you. Otherwise, you wouldneed only the" form-bean "element itself, with the corresponding" name "and" type "attributes .--> < Struts-config>

==== form bean definitions ========================================== -> action.xml:

JSP page

Welcome.jsp: The link will be added to this page and call morefootballAction and specify the first page. code show as below:

<% @ Page ContentType = "Text / HTML; Charset = GB2312"%> <% @ Taglib Uri = "/ Web-INF / STRUTS-Bean.TLD" prefix = "bean"%> <% @ Taglib URI = "/ Web-inf / struts-html.tld "prefix =" html "%> <% @ taglib URI =" / web-inf / struts-logic.tld "prefix =" logic "%> Welcome </ Title> </ head> <body> <table width = "694" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td width = "70> <div align = "center"> id </ div> </ td> <td width = "110> <div align =" center "> footname </ div> </ td> <td width =" 82 "> <div align = "Center"> ViewURL </ div> </ td> <td width = "92"> <div align = "center"> downurl </ div> </ td> <td width = "48> <div align = "Center"> ClickS </ div> </ td> <td width = "41"> <div align = "center"> sort </ div> </ td> <td width = "40"> <div align = "Center"> INTRO </ div> </ td> <td width = "66> <div align =" center "> commend </ div> </ td> <td width =" 61 "> <div align = "Center"> DATE </ div> </ td> <td width = "33> <div align =" center "> bad </ div> </ td> <td width =" 51 "> <div align = "center"> length </ div> </ td> </ tr> <logic: Iterate ID = "Football" Name = "Footballtop"> <</p> <p>Tr> <TD> <DIV align = "center"> <bean: Write name = "football" proty = "id" /> </ div> </ td> <td> <div align = "center"> <bean : Write name = "football" property = "footballname" /> </ div> </ td> <td> <div align = "center"> <bean: write name = "football" property = "viewurl" /> < / div> </ td> <td> <div align = "center"> <bean: write name = "football" property = "downurl" /> </ div> <td> <TD> <div align = " Center "> <bean: write name =" football "property =" clicks "/> </ div> </ td> <td> <div align =" center "> <bean: write name =" football "property =" Sort "/> </ div> <div align =" center "> <bean: write name =" football "property =" intro "/> </ div> </ td> <td> <div align = "center"> <bean: Write name = "football" Property = "commend" /> </ div> </ td> <td> <div align = "center> <bean: write name =" Football "Property =" Date "/> </ div> <div align =" center "> <bean: write name =" football "property =" bad "/> </ div> </ TD> <TD> <div align = "center"> <bean: write name = "football" property = "length" /> </ div> </ td> </ tr> </ logic: Iterete> </ TABLE > <html: link page = "/ morefootball.do?page=1"> More football <</p> <p>/ html: link> <br> <table width = "694" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td width = "70> <div align =" center "> ID </ div> </ td> <td width = "110"> <div align = "center"> funname </ div> </ td> <td width = "82"> <div align = "center"> Viewurl </ div> </ td> <td width = "92"> <div align = "center"> downurl </ div> </ td> <td width = "48"> <div align = "center"> ClickS </ div> </ td> <div align = "41"> <div align = "center"> sort </ div> </ td> <td width = "40"> <div align = "center"> INTRO </ div> </ td> <td width = "66> <div align =" center "> commend </ div> </ td> <td width =" 61 "> <div align =" center "> Date </ div> </ td> <td width = "33> <div align =" center "> bad </ div> </ td> <td width =" 51 "> <div align =" center "> Length </ div> </ td> </ tr> <logic: Iterate ID = "fun" name = "funtop"> <tr> <TD> <div align = "center"> <bean: write name = "Fun "Property =" ID "/> </ div> </ td> <TD> <div align =" center "> <bean: write name =" fun "property =" funname "/> </ div> </ td > <TD> <div align = "center"> <bean: write name = "fun" property = "viewurl" /> </ div></p> <p></ td> <td> <div align = "center"> <bean: write name = "fun" property = "downurl" /> </ div> </ td> <td> <div align = "center"> <bean: Write Name = "fun" property = "clicks" /> <div> </ td> <td> <div align = "center"> <bean: write name = "fun" property = "sort" / > </ div> </ td> <td> <div align = "center> <bean: write name =" fun "property =" intro "/> <div> </ td> <td> <div align = "center"> <bean: write name = "fun" proty = "commend" /> </ div> </ td> <td> <div align = "center"> <bean: write name = "fun" Property = "DATE" /> </ div> <div align = "center"> <bean: write name = "fun" property = "bad" /> </ div> </ td> < TD> <div align = "center> <bean: write name =" fun "property =" length "/> </ div> </ td> </ tr> </ logic: iperate> </ table> <br > <table width = "694" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td width = "70"> <div align = "center"> id </ div> </ TD> <td width = "110> <div align =" center "> Moviename </ div> </ td> <td width =" 82 "> <div align =" center "> viewURL </ div> </ TD> <TD Width = "92"> <div align = "center"> downurl </ div> </ td> <td width =</p> <p>"48"> <div align = "center"> ClickS </ div> </ td> <td width = "41"> <div align = "center"> sort </ div> </ td> <td width = "40"> <div align = "center> INTER"> INTRO </ div> </ td> <td width = "66"> <div align = "center"> commend </ div> </ td> <td width = "61"> <div align = "center> DATE </ div> </ td> <td width =" 33 "> <div align =" center "> bad </ div> </ td> <td width = "51"> <div align = "center"> length </ div> </ td> </ tr> <logic: Iterate ID = "Movie" name = "moVietop"> <tr> <TD> <div align = "center"> <bean: write name = "movie" property = "id" /> </ div> </ td> <td> <div align = "center"> <bean: write name = "movie" Property = "Moviename" /> </ div> </ td> <TD> <div align = "center> <bean: write name =" mo "property =" viewurl "/> </ div> </ td> <TD > <div align = "center"> <bean: write name = "mo" property = "downurl" /> <div> </ td> <td> <div align = "center"> <bean: write name = "Movie" Property = "ClickS" /> </ div> </ td> <td> <div align = "center"> <bean: write name = "movie" property = "sort" /> </ div> < / TD> <TD> <div align = "center"> <bean: write name = "material ="</p> <p>Intro "/> </ div> <div align =" center "> <bean: write name =" movie "proty =" commend "/> </ div> </ td> <TD> <div align = "center"> <bean: write name = "mo" property = "date" /> <div align = "center"> <bean: write name = " Movie "Property =" BAD "/> <div> </ td> <td> <div align =" center "> <bean: write name =" movie "Property =" length "/> </ div> </ TD> </ tr> </ logic: Itereate> </ table> <br> <table width = "694" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td width = " 70> <div align = "center> ID </ div> </ td> <td width =" 110 "> <div align =" center "> MTVNAME </ div> </ td> <td width =" 82> <div align = "center> ViewURL </ div> </ td> <td width =" 92 "> <div align =" center "> downurl </ div> </ td> <td width =" 48> <div align = "center"> ClickS </ div> </ td> <td width = "41"> <div align = "center"> sort </ div> </ td> <td width = " 40> <div align = "center> INTRO </ div> </ td> <td width =" 66 "> <div align =" center "> commend </ div> </ td> <td width =" 61> <div align = "center"> DATE </ div> </ td> <td width = "33"> <div align = "</p> <p>Center "> BAD </ div> </ td> <td width =" 51 "> <div align =" center "> length </ div> </ td> </ tr> <logic: Iterate ID =" MTV " Name = "MTVTOP"> <tr> <td> <div align = "center"> <bean: write name = "MTV" Property = "id" /> </ div> </ td> <td> <div align = "center"> <bean: write name = "MTV" property = "mtvname" /> </ div> </ td> <td> <div align = "center"> <bean: write name = "MTV" Property = "ViewURL" /> </ div> <div align = "center"> <bean: write name = "mtv" proty = "downurl" /> </ div> </ td> < TD> <div align = "center> <bean: write name =" mtv "property =" clicks "/> <div> </ td> <td> <div align =" center> <bean: Write Name = "MTV" Property = "Sort" /> <div> <div align = "center"> <bean: write name = "mtv" property = "intro" /> </ div> </ td> <td> <div align = "center"> <bean: Write name = "MTV" proty = "commend" /> <div> </ td> <td> <div align = "center"> <bean: Write Name = "MTV" Property = "DATE" /> </ div> </> <td> <div align = "center"> <bean: write name = "MTV" property = "bad" / > </ div> </ td> <td> <div align = "center> <bean: write name =" MTV "Property =</p> <p>"Length" /> </ div> </ td> </ tr> </ logic: Itereate> </ table> </ body> </ html> morefootball.jsp: Here <bean: write name = "footballpageinfo" Property = "NextPage" /> and <bean: Write name = "footballpageInfo" property = "previouspage" /> Page 1 and Page-1 code in the corresponding GET method in the bean is as follows:</p> <p><% @ Page ContentType = "Text / HTML; Charset = GB2312"%> <% @ Taglib Uri = "/ Web-INF / STRUTS-Bean.TLD" prefix = "bean"%> <% @ Taglib URI = "/ Web-inf / struts-html.tld "prefix =" html "%> <% @ taglib URI =" / web-inf / struts-logic.tld "prefix =" logic "%> <html> <head> <title > morefootball </ title> </ head> <body> <table width = "600" border = "0" cellspacing = "0" cellpadding = "0"> <tr> <td> <div align = "center"> Name </ div> </ td> <td> <div align = "center"> Clicks </ div> </ td> <td> <div align = "center"> type </ div> </ td> <TD> <div align = "center"> length </ div> </ td> <td> <div align = "center> ID </ div> </ td> </ tr> <logic: Iterate ID = "football" name = "footballlist"> <tr> <td> <div align = "center"> <a href="viewfootball.do?id=<bean :write name="football" print="id" "Target =" _ blank "> <bean: write name =" football "property =" footballname "/> </a> </ div> </ td> <td> <div align =" center> <bean: write Name = "football" proty = "clicks" /> </ div> </ td> <td> <div align = "center"> <bean: write name = "football" property = "sort" /> </ div > </ td> <td> <div align = "center"> <bean: write name = "football" property =</p> <p>"Length" /> </ div> <div align = "center"> <bean: write name = "football" proty = "id" /> </ div> </ td> </ Tr> </ logic: Itereate> <TR> <TD COLSPAN = "5"> <div align = "center"> <a href="/morefootball.do?page=1"> Home </a> <a href = "/ morefootball.do?page=<bean :write name =" footballpageinfo "Property =" PreviousPage "/>> Previous <A href =" / morefootball.do?page=<bean :write Name = "FootballPageInfo" Property = "NextPage" /> "> Next Page </A> <a href="/morefootball.do?page=<bean:write name="footballpageinfo" Property="totalpage"" > Last page </A> A total of <bean: Write Name = "footballpageInfo" property = "totalpage" /> page is currently <bean: write name = "footballpageInfo" property = "page" /> page total <bean: Write Name = "FootballPageInfo" Property = "resultcount" /> 条 record </ div> </ td> </ tr> </ table> </ body> </ html> end:</p> <p>In fact, there is also a part of the name to pop up a new window after clicking the name of the football movie, including information about the corresponding football movie, because the content is repeated, so it is no longer written, including in the source code.</p> <p>The next article will be about the use of FORMBEAN and the insertion and deletion of the database. All source code: vod.zip I write an article's purpose only because I can only find very little Chinese information about Struts at the time, especially fire, simply wrote one. I sincerely hope that Chinese information about Java on the Internet can get more and more. In the use of Tomacat, it produces a problem with Tomact MySQL to use the connection pool in JB7. Please help me, thank you.</p> <p>About the Author:</p> <p>Sailing, studied at the industrial and commercial management of Nanjing University of Technology, hobby Java programming, familiar with website production, sincerely hopes to communicate with you. Studio: Mars Studio</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-27904.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="27904" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.035</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'QZ_2FMvLA5qhHvwWjJ_2BdyJV3NhqKASu2iJP3HPqkiJp6qTDPK_2FQy164nbz1dqATgrmT9QdNQu1ZsGuHmvZ0P2veg_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>