Steps to introduce a jquery framework into a JSP page for a Java project

Source: Internet
Author: User

Environment: Introducing the Juqery framework into a Java Web project

Tool: MyEclipse8.5

[Steps below]

A: Create a new Java Web Project Testjquery, creating a jquery folder under the Webroot directory

B: Download jquery-1.8.3.min.js into the jquery folder

C: Create a JSP page

<%@ page language= "java" import= "java.util.*" pageencoding= "iso-8859-1"%><%string path = Request.getcontextpath (); String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";%> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >

  

Ps:jquery introduced path interpretation: jquery/jquery-1.8.3.min.js the current page test.jsp as coordinates in the current folder to find, because test.jsp and jquery folders are in the Webroot directory so do not need

'/', if add '/' means to find from the project root directory

D: Publish project, view test.jsp

You can see the tap button click me! can be taken to the value of the text box

Because

The text box is evaluated using the jquery syntax $ ("#test"). attr ("value"); Test is the ID of the text box

So

The jquery framework introduces success in this JSP page

The Ps:juqery framework can easily get the value of an object based on the object ID.

Steps to introduce a jquery framework into a JSP page for a Java project

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.