The ultimate goal is to write a swing in JavaScript to implement confirmed cancellation and decide whether to execute this function. However, during the execution process, a problem occurred. Every time it is executed, it will be inserted directly. Inserting data into the database is out of control. If you want to know how to solve this problem, please refer to the code details below:
<%
boolean foo=false;
if (((theqingjiadays<3)&&(thetiqiandays>=1))||((theqingjiadays< ;10)
&&(theqingjiadays>=3)&&(thetiqiandays>=3))||((theqingjiadays>=10)&&(thetiqiandays>=7))){
foo=true;
}else{
//Failed to ask for leave in advance as required, do you want to continue
%>
<script> <br>var select=confirm('Failed to ask for leave in advance as required, do you want to continue?'); <br>if(select==true){ <br>foo=true; <br>} <br>if(select==false){ <br>foo=false; <br>window.location.href=" qingjiaquxiao.jsp?id=<%=qj.getId()%>"; <br>} <br></script>
I want to replace this script with a Swing one Window, implement confirmation and cancellation to decide whether to execute, because each execution always executes the code in <% %> first, and then directly inserts the data into the database, which is out of control
<%
}
}
//Insert into the database
if(foo==true){
try
{
Insert statement
qingjiaDAO.addQingJiaInfo(qj);
qingjiaDAO.addQingJiaMingxi(qjmingxi);
qingjiaDAO.updateQingJiaInfo(qj);
}
catch (InfrastructureException ie){
out.println(ie.toString());
}
finally{
HibernateUtil.commitTransaction();
HibernateUtil.closeSession();
}
}
%>A piece of swing code in java is needed to control this module. How to implement it? And what I want to know is whether it is possible to pass the parameters of this page to another page through window.location.href through a script?
Later I saw on the Internet that if you want to achieve the above transfer, you can simulate get submission, and analyze and obtain the parameters after getting the link on another page.
I tried following this idea, but it didn’t work. The key was that I didn’t know how to do it. However, I later solved the problem myself because I later found out that I passed too many parameters myself. Here are the following Made some modifications, the following details:
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")%>";