Html5+js page Pass value to Java background tips

Source: Internet
Author: User

Page Pass Value Tips

Usually we do in the Web project, generally an HTML page will have several steps, Step_num①,step_num②,step_num③, generally first show Step_num①, according to the jump condition display Step_num②,step_num① hidden, Then jump Step_num③,step_num①,step_num② hidden, Step_num③ display.

Idea: (JS sets the global variable, where to add a input tag, assign the value to an input, and then let input hide).

First of all, I do the structure of the page, into the xxx.html page, through the JS send Ajax.postform request, request a action,action call handler, each function to request an action.

The first two days to do is such a page, and then in the value of the time encountered a human brain pain problem, need to show in Step_num① and not show the value, to step_num③ corresponding to the background Java code, I am also drunk, tried several methods are not good use, and finally, With a little trick.

In JS, first set a global variable, such as Var groupid= ""; , and then the Step_num① from the background action from the GroupID assigned to GroupID, how to pass the page three corresponding Java background it?

Now step_num③ the corresponding HTML code to write such a statement: <input id= "Chuanzhi" name= "Chuanzhi" type= "hidden"/>

Then put $ ("#chuanzhi") in the corresponding JS code. val (GroupID);

This way you can go through Request.getparameter ("Chuanzhi") in the Step_num③ corresponding Java background, and get the groupid you want.

Tips for Html5+js page values to Java background

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.