Basic article

zhaozj2021-02-16  35

JSP syntax detailed http://www.aspcn.com provides www.aspcn.com December 25, 2001 15:40 --------------------- -------------------------------------------------- ------- JSP grammar ] -> Example 1 generated in the client's HTML source code The same data above: Example 2 -> Displayed in the client's HTML source code as: Description This annotation and HTML are very like, that is, it can look at "View Source Code" The only thing is that you can use expressions in this comment (see shown in Example 2). This expression is not different, different from the page, you can use various expressions, as long as it is legal . More please see the expression

Hidden comments

Write in the JSP program, but not send it to the customer.

JSP syntax <% -%>: <% @ page language = "java"%> a comment test </ title> </ head> <body> <h2> A Test of Comments </ h2> <Comment Will NOT BE VISIBLE IN THE Page Source -%> </ body> </ html> Description The character with hidden comment tags is ignored when JSP compile. This comment is useful when you want to hide or annotate your JSP program. The JSP compiler does not compile the statement between <% - and -%>, which does not display in the customer's browser, and will not see in the source code.</p> <p>statement</p> <p>Declaring the legal variables and methods in the JSP program</p> <p>JSP syntax <%! Declaration; [declaration;] ...%> example <%! Int i = 0;%> <%! Int A, b, c;%> <%! Circle a = new circle (2.0 );%> Description Declare the variables and methods you want to use in the JSP program. You must do this, or you will be wrong.</p> <p>You can declare multiple variables and methods in one time, as long as ";" is ending, of course, these statements are legal in Java.</p> <p>Please pay attention to some of the following rules when you declare methods or variables:</p> <p>The statement must be ";" ends (Scriptle has the same rules, but the expression is different). You can directly use the declared variables and methods that have been included in <% @ Page%>, do not need to be re-needed A declaration. A statement is only valid in one page. If you want each page to use some statements, it is best to write them into a separate file, then use <% @ include%> or <jsp: include> element.</p> <p>expression</p> <p>Contains an expression that conforms to JSP syntax</p> <p>JSP syntax <% = expression%> example <font color = "blue"> <% = map.size ()%> </ font> <b> <% = number> </ b>. Description Expression elements indicate a expression that is defined in the scripting language, which is automatically converted to a string after running, and then inserted into this expression of the JSP file display. Because the value of this expression has been converted to a string, you can insert this expression in a line of text (the form and ASP is exactly the same).</p> <p>Remember the following: When you use an expression in JSP:</p> <p>You can't use a semicolon (";") as an expression of the expression. But the same expression is used in the scriptlet! View Scriptlet This expression element can include any expression that is valid in Java Language Specification. Sometimes expressions can also be attribute values ​​for other JSP elements. One expression can become complicated, it may be made of one or more Expression composition, the order of these expressions is from left to right.</p> <p>Scriptlet</p> <p>Contains an effective block.</p> <p>JSP syntax <% code fragment%> example <% string name = null; if (Request.GetParameter ("name") == NULL) {%> <% @ include file = "error.html"%> <%} Else {foo.setname (Request.getParameter ("name"); if (foo.getname (). EqualsignoreCase ("Integra")) Name = "acura"; if (Name.Equalsignorecase ("acura") {%> Description A scripTlet can include multiple JSP statements, methods, variables, expressions</p> <p>Because Scriptlet, we can do the following things:</p> <p>Declare the variables or methods that will be used (refer to the declaration). Write a JSP expression (reference expression). Writing a JSP statement with any hidden objects and any objects expressed with <JSP: Usebean> (if you are using Java) Language, these statements must follow Java Language Specification,) any text, HTML tag, JSP element must be executed when JSP receives a customer request outside of Scriptlet, if scriptlet has displayed content, these displays The content is existing in the OUT object.</p> <p>Include instruction</p> <p>Contains a static file in the JSP while parsing the JSP statement in this file.</p> <p>JSP syntax <% @ include "%> example include.jsp: <html> <head> <title> an include test </ title> </ head> <body bgcolor =" white> <font color = "blue"> The current date and time area <% @ include file = "DATE.JSP"%> </ font> </ body> </ html> Date.jsp: <% @ page import = "java.util. * "%> <% = (new java.util.date ()) .tolocalestring ()%> Displays in the page: The capital date and time arepe 30, 1999 2:38:40 Description <% @ include%> The instruction will insert a file containing text or code when the JSP compiles, when you use <% @ include%> instructions, this included process is static. Static container means that this file containing files will be inserted into the JSP file. This containable file can be a JSP file, an HTML file, a text file. If included is a JSP file, the code in this file containing the JSP will be executed.</p> <p>If you just use INCLUDE to include a static file. The result of this containing files will be inserted into the JSP file where you are <% @ include%>. Once the included file is executed, the process of the primary JSP file will be recovered and the next line is proceed.</p> <p>This containing files can be HTML files, JSP files, text files, or just a java code, but you have to pay attention to <html>, </ html>, <body>, </ body> tag in this included file Because this will affect the same tag in the original JSP file, so sometimes it will cause errors.</p> <p>There are some <% @ include%> Directance behavior is based on special JSP compilation conditions, such as:</p> <p>This included file must be open to all customers and must be valid. The path name is generally referring to the relative path, does not need to port, protocol, and domain name, as follows:</p> <p>"Error.jsp" / Templates / Onlinestore.html "" / beans / calendar.jsp "</p> <p>If this path starts with "/", this path is primarily referring to the up and down relationship path of the JSP application. If the path starts with a file name or directory name, then this path is the current path of the JSP file being used.</p> <p>Page instruction</p> <p>Define global properties in the JSP file.</p> <p>JSP syntax <% @ page [language = "java"] [extends = "package.class"] [import = "{package.class | package. *}, ..."] [session = "true | false"] [buffer = "none | 8KB | SIZEKB"] [Autoflush = "true | false"] [isthreadsafe = "true | false"] [info = "text"] [errorpage = "relativeurl"] [contenttype = "mimeType" Charset = characterset] "| Text / HTML; Charset = ISO-8859-1"] [iSerrorPage = "true | false"]%> example <% @ page import = "java.util. *, java.lang. * "%> <% @ Page Buffer =" 5KB "Autoflush =" false "%> <% @ Page ErrorPage =" Error.jsp "%> Description <% @ Page%> Instructions Contemporary to the entire JSP page, also include static Contains files. But <% @ page%> The instruction does not act on dynamic containing files, such as <JSP: include> You can use multiple <% @ PAGE%> instructions in a page, but the properties can only be used once, but There is also an exception, that is the import property. Because the Import property and the Import statement in Java are almost almost (refer to Java Language), you can use this property several times.</p> <p>Whether you put <% @ Page%> instructions in JSP files, its scope is entire JSP page. However, for the readability of the JSP program, and good program habits, it is best to put it on the top of the JSP file.</p> <p>Attribute language = "java" declares the type of scripting language, which can only use "java"</p> <p>Extends = "package.class" indicates the full name of Java Class, but it is carefully used when JSP compiles, but it will use it, which limits the compiletability of JSP.</p> <p>Import = "{package.class | package. *}, ..." Requires the imported Java package list, which acts on blocks, expressions, and declarations.</p> <p>The following packages have been imported at the JSP compile, so you don't need to indicate again:</p> <p>Java.lang. * javax.servlet. * javax.servlet.jsp. * javax.servlet.http. *</p> <p>Session = "True | False" Set whether the customer needs http session. (If you have learned ASP, you should be unfamiliar with it) if it is True, then session is useful.</p> <p>If it has false, then you can't use the Session object, and define the <JSP: UseBean> element of Scope = Session. Such use can cause errors. The default is TRUE.</p> <p>Buffer = "None | 8KB | SIZEKB" The size of the buffer is used by the OUT object to handle the executionful JSP to the client browser. The default is 8KB</p> <p>Autoflush = "true | false" setting If the buffer overflows, if it is necessary to force the output, if its value is defined as true (default), the output is normal, if it is set to false, if this buffer overflows, it will cause an accident. Error happening. If you set the buffer to none, then you can't set autoflush to false.</p> <p>Isthreadsafe = "true | false" settings if the JSP file can be used multithreaded. The default is True, that is, JSP can handle a request for multiple users at the same time. If set to false, a JSP can only handle a request at a time.</p> <p>Info = "text" A text will be joined in JSP in executing JSP, you can use the servlet.getServletInfo method to retrieve.</p> <p>ErrorPage = "RelativeURL" Sets the JSP file that handles exception events.</p> <p>iSerrorPage = "true | false" Set whether this page is an error page, and you can use the Exception object if you are set to True.</p> <p>ContentType = "MIMETYPE [; Charset = CharacterSet" | "text / html; charset = ISO-8859-1" Set MIME type. The default MIME type is: Text / HTML, the default character set is ISO-8859-1.</p> <p><JSP: Forward></p> <p>Redirect an HTML file, a JSP file, or a block.</p> <p>JSP syntax <jsp: forward page = {"{" <: = expression%> "} /> {" rsp: forward page = {"relativeURL" | <% = expression%>}> <jsp: param Name = "parametername" value = "{parameterValue | <% = express%>}" /> </ jsp: forward> example <jsp: forward page = "/ servlet / login" /> <jsp: forward page = " / servlet / login> <JSP: param name = "username" value = "jsmith" /> </ jsp: forward> Description <JSP: Forward> Tags from a JSP file to another file with request to request Object. <JSP: Forward> The code below the label will not be executed.</p> <p>You can send parameters and values ​​to the target file, in this example, the parameters we passed are namedame, the value is Scott, if you use the <JSP: Param> tag, the target file must be a dynamic file, you can handle parameters If you use a non-buffered output, be careful when using <JSP: Forward>. If you use <JSP: Forward>, the JSP file already has data, then the file execution will be wrong.</p> <p>Attributes Page = "{relativeURL | <% = express%>}" This is an expression or a string to explain the file or URL you will oriented. This file can be a JSP, block, or other capable of handling Request Object files (such as ASP, CGI, PHP).</p> <p><jsp: param name = "parametername" value = "{parameterValue | <% = expression%>}" /> Send one or more parameters to a dynamic file, this file must be dynamic files.</p> <p>If you want to pass multiple parameters, you can use multiple <JSP: param> in a JSP file. Name Specifies the parameter name, Value Specifies the parameter value.</p> <p><JSP: GetProperty></p> <p>Get the properties of the bean, used to display in the page</p> <p>JSP syntax <jsp: getproperty name = "beanting =" preordename "/> example <jsp: usebean id =" calendar "scope =" page "class =" employee.calendar "/> <h2> Calendar of <JSP: getProperty Name = "Calendar" Property = "UserName" /> </ h2> Description This <JSP: getProperty> element will get the properties of the bean, and can be used or displayed in the JSP page. Use <JSP: Before getProperty>, you must create it with <JSP: UseBean>.</p> <p><JSP: getProperty> Elements have some restrictions:</p> <p>You can't use <JSP: getProperty> to retrieve a property that has been indexed. You can use <JSP: getProperty> with the JavaBeans component, but cannot be used with Enterprise Beans. The name of the attribute name = "beaninstancename" bean, by <JSP: Usebean></p> <p>Property = "PropertyName" attribute name specified by the bean.</p> <p>Tip: In the JSP reference in Sun, if you use <JSP: getProperty> to retrieve the value is null, then NullPointersException will appear, and if you use a block or expression to retrieve its value, then in the browser The appearance is NULL.</p> <p><JSP: Include></p> <p>Contains a static or dynamic file.</p> <p>JSP syntax <JSP: include Page = "{relativeURL | <% = expression%>}" Flush = "true" /> {relativeURL | <% = expression%>} "flush =" TRUE "> <jsp: param name =" parametername "value =" {parameterValue | <% = express%>} "/> </ jsp: include> Examples <jsp: include page =" scripts / login.jsp "/> <JSP: include page = "copyright.html" /> <jsp: include page = "/ index.html" /> <jsp: include page = "scripts / login.jsp"> <jsp: param name = "username" Value = "jsmith" /> </ jsp: include> Description <JSP: Include> Element Allows you to include dynamic files and static, the results of these two include files are different. If the file is just a static file, this includes adding the contents of the included file to the JSP file, and if this file is dynamically, then this containing file will be executed by the JSP compiler (this is similar to the ASP )</p> <p>You can't judge a file from a file name to be dynamic or static, such as aspcn.asp may just contain some information, without having to execute. <JSP: Include> can handle these two files at the same time, so you don't need to include this file is dynamic or static.</p> <p>If this included file is dynamic, you can also pass the parameter name and parameter value with <JSP: param>.</p> <p>Attributes Page = "{relativeURL | <% = expression%>}" parameter is a relative path, or represents a relative path expression.</p> <p>Flush = "True" Here you must use flush = "true", you can't use false values. The default is false</p> <p><jsp: param name = "parametername" value = "{parameterValue | <% = expression%>}" /> <jsp: param> clause allow you to pass one or more parameters to dynamic files</p> <p>You can use multiple <JSP: param> in a page to deliver multiple parameters,</p> <p><JSP: Plugin></p> <p>Execute an applet or bean, there is a possibility to download a Java plugin for execution it.</p> <p>JSP syntax <jsp: plugin type = "bean | applet" code = "classfilename" codebase = "classfiledirectoryname" [name = "instancename"] [archive = "uritoarch, ..."] [align = "bottom | TOP | Middle | left | right "] [height =" displayPixels "] [width =" displayPixels "] [hspace =" leftRightPixels "] [vspace =" topBottomPixels "] [jreversion =" JREVersionNumber | 1.1 "] [nspluginurl =" URLToPlugin "] [iEpluginURL = "URLTOPLUGIN"]> [<JSP: params> [<jsp: param name = "parametername" value "value =" {parameterValue | <% = express%>} "/>] </ jsp: params>] [ <JSP: Fallback> Text Message for User </ JSP: Fallback>]</p> <p></ jsp: plugin></p> <p>Example <JSP: Plugin Type = Applet Code = "Molecule.class" CodeBase = "/ html"> <jsp: params> <jsp: param name = "molecule" value = "molecules / benzene.mol" /> </ jsp : params> <JSP: Fallback> <p> Unable to load applet </ p> </ jsp: Fallback> </ jsp: plugin> Description <JSP: PLUGIN> element is used to play or display an object in your browser ( Typical is applet and beans, and this display requires the Java plugin in the browser.</p> <p>When the JSP file is compiled, when sending to the browser, the <jsp: plugin> element will replace the "Object> or <Embed> element according to the version of the browser. Note, <Object> is used for HTML 4.0, <Embed> for HTML 3.2.</p> <p>In general, the <JSP: PLUGIN> element will specify an object is applet or bean, and the name of the Class is also specified, and there is location, and it will also specify where to download this Java plugin. details as follows:</p> <p>Properties Type = "bean | applet". The type of plugin object that will be executed, you must specify this bean or applet because this property has no default.</p> <p>Code = "classfilename" will be the name of the Java Class executed by the Java plugin, must end with .CLASS. This file must exist in the directory specified by the CodeBase property.</p> <p>CodeBase = "classfileDirectoryName" will be executed Directory (or path) of the Java class file, if you do not provide this property, the directory of the JSP file using <JSP: Plugin> will be used .Name = "instanceename" The name of this bean or applet instance will be called in JSP.</p> <p>Archive = "uriToarchive, ..." Some path names separate from comma, which are used to pre-install some Class to use, which increases the performance of the applet.</p> <p>Align = "Bottom | Top | Middle | LEFT | Right" graphics, objects, and Applet location, have the following values:</p> <p>Bottom Top Middle Left Right Height = "DisplayPixels" width = "DisplayPixels" Applet or bean will display the length of the value, this value is a number, the unit is pixel.</p> <p>Hspace = "Leftrightpixels" vSpace = "Topbottompixels" Applet or bean is displayed on the screen, the space you need to leave up and down, the unit is pixel.</p> <p>JREVERSION = "JreversionNumber | 1.1" Applet or BEAN runs the required Java Runtime Environment (JRE) version. The default is 1.1.</p> <p>NSPLUGINURL = "URLTOPLUGIN" Netscape Navigator users can use the JRE download address, this value is a standard URL, such as http://www.aspcn.com/jsp</p> <p>IEPLUGINURL = "URLTOPLUGIN" IE users can use the JRE download address, this value is a standard URL, such as http://www.aspcn.com/jsp</p> <p><jsp: params> [<jsp: param name = "parameters" value = "{parameterValue | <% = express%>}" />] </ jsp: params> You need to send parameters or parameters sent to Applet or Bean value.</p> <p><JSP: Fallback> Text Message for User </ jsp: Fallback> A text is displayed to the user when the Java plugin cannot start. If the plugin can start and Applet or Bean cannot, the browser will have an error message pop-up.</p> <p><JSP: SetProperty></p> <p>Set the attribute value in the bean.</p> <p>JSP syntax <jsp: setProperty name = "beanInstanceName" {property = "*" | property = "propertyName" [param = "parameterName"] | property = "propertyName" value = "{string | <% = expression%>}" } /> Example <jsp: setProperty name = "mybean" proty = "*" /> <jsp: setProperty name = "mybean" proty = "username" /> <jsp: setProperty name = "mybean" property = "username" Value = "steve" /> Description <JSP: setProperty> Elements use the bean given the setter method, set one or more attribute values ​​in the bean. You must use the <JSP: UseBean> to declare this bean before using this element. Because, <JSP: UseBean> and <JSP: setProperty> are associated, and the name of the Bean instance they use should also match. (That is, the value of Name in <jsp: setProperty> should be the same as the value of the id in <jsp: usebean>) You can use <JSP: SetProperty> to set the property value:</p> <p>Match the attribute specified in the bean by the specified value of the bean by the user input by all values ​​entered by the user (in the Request object as a parameter storage), match the specified value specified by the user to match the attribute of the bean to match the properties of the bean. Method for setting attribute values ​​has its specific syntax, below we will explain</p> <p>Attributes and their usage name = "beaninstancename" indicates the name of the bean instance created in <JSP: UseBean>.</p> <p>Property = "*" stores all values ​​input by the user in the JSP, used to match the properties in the bean. The name of the attribute in the bean must match the parameter name in the Request object.</p> <p>The parameter values ​​transmitted from the customer to the player are generally character types, which must be converted to other types in the bean, and the type of bea property and their conversion method are listed in the table below.</p> <p>Transform strings into other types of methods. Property type method Boolean or boolean java.lang.Boolean.valueof (string) Byte or byte java.lang.byte.Valueof (string) Char or character java.lang.Character.Valueof String) Double OR Double Java.lang.double.Valueof (String) Integer or Integer Java.lang.integer.Valueof (String) float or float java.lang.float.Valueof (String) long or long java.lang.long. Valueof (String)</p> <p>If there is an empty value in the parameter value of the Request object, the corresponding bean property will not set any values. Similarly, if there is an attribute in the bean without the corresponding Request parameter value, then this property will not set .property = "PropertyName" [param = "parametername"] Use a parameter value in the request to specify bean A property value. In this syntax, Property specifies the property name of the bean, and param specifies the parameter name in the request.</p> <p>If the bean property is different from the name of the request parameter, you must specify Property and Param if they are the same name, then you just need to indicate that Property is fine.</p> <p>If the value is empty (or not initialized), the corresponding bean property is not set.</p> <p>Property = "PropertyName" value = "{string | <% = expression%>}" Use the specified value to set the bean property. This value can be a string or an expression. If this string, it will be converted to the type of the bean property (see the above table). If it is an expression, then its type must be consistent with the type of attribute value to be set.</p> <p>If the parameter value is empty, the corresponding attribute value will not be set. Also, you can't use Param and Value in a <JSP: SetProperty></p> <p>Tips If you use Property = "*", then bean's properties are not necessary to sort in the order in the HTML form.</p> <p><JSP: Usebean></p> <p>Create a bean instance and specify its name and scope.</p> <p>JSP syntax <JSP: usebean id = "beaninstancename" scope = "page | request | session | application" {class = "package.class" | type = "package.class" type = "package.class" type = "package .class "| beanname =" {package.class | <% = expression%>} "type =" package.class "} {/> |> other elements </ jsp: usebean>} example <jsp: usebean id =" CART "scope =" session "class =" session.carts "/> <jsp: setProperty name =" cart "property =" * "/> <jsp: usebean id =" checking "scope =" class "class =" Bank .Checking> <jsp: setProperty name = "checking" property = "balance" value = "0.0" /> </ jsp: usebean></p> <p>Description <JSP: UseBean> Used to position or sample a JavaBeans component. <JSP: Usebean> You will try to locate a bean instance if this bean does not exist, then <JSP: UseBean> is an example from a Class or template. For positioning or examples of beans, <JSP: UseBean> will make the following steps, the order is as follows:</p> <p>Try to locate a bean by a given name and scope. Reference variables for this bean object are named with the name you specify. If this bean is found, this reference will be stored in this variable. If you also specify the type, this bean is also set to the corresponding type. If this bean is not found, it will be sampled from the class you specify and this reference is stored in a new variable. If the name of this class represents a template, this bean is sampled by java.beans.beans.instantiate. If <JSP: Usebean> has been sample (not positioning) Bean, <JSP: Usebean> and </ jsp: Usebean> There is element, then the code will be executed. The body of <JSP: UseBean> element is usually included with the <JSP: SetProperty> element for setting the properties of the bean. As mentioned above, the principal of <JSP: usebean> is only executed when the <JSP: UseBean> sample bean is executed, if this bean already exists, <JSP: usebean> can locate it, then the main body The content will not work</p> <p>Properties and Usage ID = "BeanInstanceName" confirms the bean variable in the range you define, you can use this variable name in the later program to distinguish between different beans</p> <p>This variable name is sensitive to case, and must meet the scripting language you are using, in Java Programming Language, this rule has been written in the Java Language specification. If this bean is created in other <JSP: UseBean>, the value of this ID must be consistent with the original ID value.</p> <p>Scope = "Page | Request | Session | Application" bean exists and the valid range of ID variable names. The default is Page, the following is a detailed description:</p> <p>Page - You can use Beans in the JSP file containing <JSP: UseBean> element, and all static include files in this file until the page performs a response to the client or go to another file. Request - You use bean in any JSP file that performs the same request until the page is executed to respond to another file or go to another file. You can use the Request object to access bean, such as request.getattribute (BeanInstanceName)</p> <p>Session - From Creating a bean, you can use the bean in any JSP file using the same session. This bean exists within the entire session survival cycle, any JSP file in sharing this session can use the same bean. Note that you create BEAN's JSP file must specify session = true in the <% @ Page%> instruction</p> <p>Application - Start with the creation bean, you can use the bean in any JSP file using the same Application. This bean exists within the entire Application Licheng, any JSP file in sharing this Application can use the same bean. Class = "package .class "uses the new keyword and the Class constructor from a class in a class. This class cannot be abstract, there must be a public, no parameter constructor. This package name is case sensitive. TYPE = "package.class" If this bean already exists in the specified range, write this bean a new database type. If you don't use Class or BeanName to specify Type, Bean will not be sample. Package and Class's name, case sensitive.</p> <p>Beanname = "{package.class | <% = expression%>}" type = "package.class" uses java.beans.beans.instantiate methods to sample a bean from a Class or continuous template while specifying the type of bean.</p> <p>Beanname can be Package and Class or an expression, it will pass the value of Beans.instantiate.TUPE can be the same as beans.</p> <p>Package and Class name are case sensitive.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-22758.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="22758" 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.077</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 = 'LfWHeulz4sehpCp0FTUg7DCwiHl7MDM7_2FgJoOuWz1_2FJvaMDPcwD_2FjtyzbCV_2B8xFL1xL_2BNaVQTQbwZ6EwEcQ6ow_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>