Category:JSP

  • Detailed explanation of five JSP page Jump methods

    Time:2021-7-30

    1. RequestDispatcher.forward() It works on the server side. When forward () is used, the servlet engine transmits HTTP requests from the current servlet or JSP to another servlet, JSP or ordinary HTML file, that is, your form is submitted to a.jsp. In a.jsp, forward () is used to redirect to b.jsp. At this time, all […]

  • Analysis of JSP against SQL injection attack

    Time:2021-7-29

    General idea of SQL injection attack:Find the SQL injection location;Judge the server type and background database type;Determination of enforceabilityFor some attackers, SQL injection is generally adopted. Next, I also talk about my feelings about SQL injection.Injection method:Theoretically, there will be types in the authentication web page, such as:For the select * from admin where username […]

  • JSP connection MySQL configuration and use

    Time:2021-7-28

    1、 Software downloadDownload the following two tools directly from the MySQL official website: mysql-5.1.32-win32.msi and mysql-gui-tools-5.0-r17-win32.msiThe former is the MySQL installation file, and the latter is the MySQL tool installation file, including JDBC2、 Environment configuration Copy MySQL connector-java-5.0.4-bin.jar from MySQL \ MySQL tools for 5.0 \ Java \ lib to D: \ Tomcat 6.0 \ […]

  • Java eclipse startup parameters

    Time:2021-7-27

    After referring to some materials, I have summarized some commonly used command arguments at startup. If there are any errors, I hope you can point out them.-arch [processor architecture] Description: Specifies the type of processor to useExample: Eclipse – arch x86 or eclipse – arch SPARC-application [id] Description: specify the application to run. The ID […]

  • Tips for outputting pictures in rows on JSP pages

    Time:2021-7-26

    <table border=”0″ cellpadding=”2″> <c:forEach items=”${pics}” var=”pic” varStatus=”status”> <c:if test=”${((status.index)%3)==0}”><tr></c:if> <td> <input class=’Input-0-border’ name=”bk_no” type=”radio” value=”${pic.piccode}” <c:if test=”${status.index==0}”>checked</c:if> onClick=’changeVal(this.value)’/> <c:if test=”${not empty(pic.logoPath)}”><img src=”${pic.logoPath}”></c:if> <c:if test=”${empty(pic.logoPath)}”><c:out value=”${pic.picname}”/></c:if> <input type=”hidden” name=”bk_name” value=”<c:out value=”${pic.picname}”/>”> </td> <c:if test=”${((status.index+1)%3)==0}”></tr></c:if> </c:forEach> </table>

  • Three solutions to avoid repeated submission of JSP form

    Time:2021-7-25

    1 JavaScript, set a variable, and only one submission is allowed.  <script language=”javascript”>    var checksubmitflg = false;    function checksubmit() {    if (checksubmitflg == true) {    return false;    }    checksubmitflg = true;    return true;    }    document.ondblclick = function docondblclick() {    window.event.returnvalue = false;    }    document.onclick […]

  • Solve the problem that El is not supported in JSP development

    Time:2021-7-24

    The problem lies in the web.xml declaration when building a web project.The web.xml declaration part is generally divided into the following versions of XSD,web-app_2_2.dtd web-app_2_3.dtd web-app_2_4.xsd web-app_2_5.xsd List the web.xml declaration of each version in more detail, as follows:web-app_2_2.dtd <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN” “http://java.sun.com/dtd/web-app_2_2.dtd”> web-app_2_3.xsd <?xml version=”1.0″ […]

  • Using FCKeditor control in JSP page (JS usage)

    Time:2021-7-23

    It can be combined with PHP, JavaScript, ASP, asp.net, ColdFusion, Java, ABAP and other programming languages“ “Fck” in the name of “FCKeditor” is the abbreviation of Frederico Caldeira knabben, the author of the editor. The fckeeditor control can be downloaded from the official websitehttp://www.fckeditor.net, this example mainly uses FCKeditor_ Readers can download some contents in […]

  • Creating and deleting cookies in Java

    Time:2021-7-22

    //Write cookie operationCookie cooki; cooki=new Cookie(“bbs_ 0001”,String.valueOf(num));// User IDcooki.setMaxAge(60*60*24*365);// Cookie timecooki.setPath(“/”); // According to the needs of the individual, it can be created in the path of different functionsresponse.addCookie(cooki); //Empty cookie operationCookie[] cookies=request.getCookies(); try { for(int i=0;i<cookies.length;i++) { Cookie cookie = new Cookie(“bbs_0001”,null); cookie.setMaxAge(0); //cookie.setPath(“/”);// Fill in according to the path where you created the […]

  • JSP reads the parameters of connecting to the database from web. XML

    Time:2021-7-21

    JSP or servlet page code: Copy codeThe code is as follows: String driver = application. getIni tParameter (“driver”) ; String url = application.getInitParameter(“url”); String user = application.getInitParameter(“user”); String pass = application.getInitParameter(“pass”); Web.xml needs to read: Copy codeThe code is as follows: <context-param> <param-name>driver</param-name> <param-value>com.mysql.jdbc.Driver</param-value> </context-param> <context-param> <param-name>url</param-name> <param-value>jdbc:mysql://localhost:3306/j2ee</param-value> </context-param> <context-param> <param-name>user</param-name> <param-value>root</param-value> </context-param> <context-param> <param-name>pass</param-name> […]

  • JSP does not support El expression, the solution is

    Time:2021-7-20

    If you have the following, it means servlet 2.3 / JSP 1.2.<!–CTYPE web-app PUBLIC </sp–> “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN” “http://java.sun.com/dtd/web-app_2_3.dtd”> By default, servlet 2.3/jsp 1.2 does not support El expressions, while servlet 2.4/jsp 2.0 does.If the following settings of web.xml do not support El expressions:<web-app version=”2.5″ xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”> resolvent:1. Modify the […]

  • JSP gets the browser and operating system information of the client

    Time:2021-7-19

    string agent = request.getheader(“user-agent”); stringtokenizer st = new stringtokenizer(agent,”;”); st.nexttoken(); //Get the browser name of the userstring userbrowser = st.nexttoken(); //Get the user’s operating system namestring useros = st.nexttoken(); You can also get the information of the local machine in this way:Operating system informationsystem.getproperty(“os.name”); // Win2003 is Win XP?system.getproperty(“os.version”); system.getproperty(“os.arch”); Browser:request.getheader(“user-agent”) Another red envelopeRequest. Getheader […]