The ultimate goal is to write a swing in JavaScript to determine whether or not to perform this function, but in the process of execution, there is a problem, and each time it is executed, it is inserted directly into the database and is not controlled. To find out how to solve this problem, refer to the following code details:
Copy Code code as follows:
<%
Boolean foo=false;
if ((theqingjiadays<3) && (thetiqiandays>=1) | | ((THEQINGJIADAYS<10)
&& (theqingjiadays>=3) && (thetiqiandays>=3) | | ((theqingjiadays>=10) && (thetiqiandays>=7)) {
Foo=true;
}else{
Not in advance of the prescribed leave, whether to continue
%>
<script>
var select=confirm (' Not required to leave early, whether to continue? ');
if (select==true) {
Foo=true;
}
if (Select==false) {
Foo=false;
Window.location.href= "Qingjiaquxiao.jsp?id=<%=qj.getid ()%>";
}
</script>
To replace the script with a swing window, implement the Cancel to determine whether to execute, because each execution always executes the code in the <%%>, and inserts the data into the database directly, without controlling the
Copy Code code as follows:
<%
}
}
Insert Database
if (foo==true) {
Try
{
Insert statement
Copy Code code as follows:
Qingjiadao.addqingjiainfo (QJ);
Qingjiadao.addqingjiamingxi (Qjmingxi);
Qingjiadao.updateqingjiainfo (QJ);
}
catch (Infrastructureexception IE) {
Out.println (Ie.tostring ());
}
finally{
Hibernateutil.committransaction ();
Hibernateutil.closesession ();
}
}
%> needs a piece of Java Swing code to control the module, how should it be implemented? And what you want to know is whether you can pass the parameters of the page through Window.location.href to another page via a script?
Later on the Internet to see that is to achieve the above pass, you can simulate get submit, in another page after the link analysis to obtain parameters.
According to this thinking to try, but did not achieve, the key is not how to do it, but then I solved the problem myself, because later found that I have passed too many parameters, the following has made a partial change, such as the following details:
Copy Code code 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")%> ";