Write a swing in JavaScript to determine whether to cancel the cancellation, and decide whether to execute this function to control data insertion into the database. Next we will introduce the final goal of this implementation method, write a swing in JavaScript to determine whether to cancel the function. However, a problem occurs during execution, if you want to know how to solve this problem, please refer to the following code for details:
The Code is as follows:
<%
Boolean foo = false;
If (theqingjiadays <3) & (thetiqiandays> = 1) | (theqingjiadays <10)
& (Theqingjiadays> = 3) & (thetiqiandays> = 3) | (theqingjiadays> = 10) & (thetiqiandays> = 7 ))){
Foo = true;
} Else {
// Do you want to continue without asking for leave in advance as required?
%>
Script
Var select = confirm ('Leave is not performed in advance as required. Continue? ');
If (select = true ){
Foo = true;
}
If (select = false ){
Foo = false;
Window. location. href = "qingjiaquxiao. jsp? Id = <% = qj. getId () %> ";
}
Script
You want to replace the script with a Swing window and cancel it to determine whether to execute the script, because the code in <%> is always executed first, the data will be inserted directly into the database and cannot be controlled.
The Code is as follows:
<%
}
}
// Insert a database
If (foo = true ){
Try
{
Insert statement
The Code is as follows:
QingjiaDAO. addQingJiaInfo (qj );
QingjiaDAO. addQingJiaMingxi (qjmingxi );
QingjiaDAO. updateQingJiaInfo (qj );
}
Catch (InfrastructureException ie ){
Out. println (ie. toString ());
}
Finally {
HibernateUtil. commitTransaction ();
HibernateUtil. closeSession ();
}
}
%> How can I implement a swing code in java to control this module? What I want to know is whether the script can pass the parameters of this page through window. location. href to another page?
Later, I saw on the Internet that I wanted to implement the above transfer. I could simulate the get commit and get the link on another page to analyze and obtain the parameters.
I tried it according to this thinking, but it was not implemented. The key was that I could not do it myself, but I solved the problem myself later, later I found that too many parameters were passed by myself, and some modifications were made below, as shown in the following details:
The Code is as follows:
Window. location. href = "qingjiaapplysave. jsp? Qingjiatypeid = <
% = Request. getParameter ("qingjiatypeid") %>
&
Figure = <
% = Request. getParameter ("figure") %>
&
Qingjiastartdate1 = <
% = Request. getParameter ("qingjiastartdate1") %>
&
Qingjiaenddate1 = <
% = Request. getParameter ("qingjiaenddate1") %>
&
Reason = <
% = Request. getParameter ("reason") %>
&
Startdaterange1 = <
% = Request. getParameter ("startdaterange1") %>
&
Enddaterange1 = <
% = Request. getParameter ("enddaterange1") %> ";