From jsp page : From Save button onclick="teacherHistory()"
---------------------------------------------------------------------
<script type="text/javascript">
function teacherHistory(){
var teacherName = document.getElementById("teacherName").value;
//As combo
var des1 = document.getElementById('designation');
var designation = des1.options[des1.selectedIndex].value;
//alert("designation"+designation);
//***** Start this portion is use for get Gender radio button value //gender(genderOne,genderTwo,genderThree)
var radiosA=document.getElementsByName('gender');
//alert("radiosA"+radiosA);
var statusValA;
for (var i = 0, length = radiosA.length; i < length; i++) {
if (radiosA[i].checked) {
statusValA=radiosA[i].value; // statusValA (It is pass as action)
//alert("statusValA:"+statusValA);
break;
}
}
var dob = document.getElementById("dob").value;//alert("dob"+dob); //dob
//window.location="teacherHisSavePageLadmin.do?"
//window.location="teacherHisSavePageLadmin.do?reg_noA="+reg_noA;
window.location="teacherHisSavePageLadmin.do?teacherName="+teacherName+"&statusValA="+statusValA;
}
</script>
Now Struts configuration :
------------------------------
<!--Back up <action name="*Ladmin" class="com.allClass.Action.LoginAdminEditAction" method="{1}">
<result name="adminTcEdit">/adminTCfromEdit.jsp</result>
<result name="teacherHisSavePage">/adminTCfromEdit.jsp</result>
</action> -->
<!-- For Redirect Action Message -->
<action name="*Ladmin" class="com.allClass.Action.LoginAdminEditAction" method="{1}">
<result name="adminTcEdit">/adminTCfromEdit.jsp</result>
<result name="teacherHisSavePage" type="redirectAction">teacherHisSavePageOkLadmin</result>
<result name="teacherHisSavePageOk">/adminTCfromEdit.jsp</result>
</action>
LoginAdminEditAction.java :
--------------------------------
public class LoginAdminEditAction {
public String adminTcEdit(){
designationList();
districtList();
nationalityList();
religionList();
payscaleList();
return "adminTcEdit";
}
//^^^^^^^^^^^^^^ Common part Start ^^^^^^^^^^^^^^
//New action For Page save
private String SaveVal;
public String teacherHisSavePage(){
System.out.println("Save"+SaveVal);
/*designationList();
districtList();
nationalityList();
religionList();
payscaleList();*/
LoginAdminEditSql loginAdminEditSql = new LoginAdminEditSql();
loginAdminEditSql.insertTeacherHis(teacherName,designation,mpoIndex,statusValA,dob,homeDistrict,nationality,religion,statusValM,firstJoinDateTeach,joinPresentPost,joinThisInstitute,statusValAF,statusValSGM,dateGetMpo,payscale,basicSalary,allowancesHouseRent,allowancesMedical,allowancesEducation,allowancesConveyance,fromInstitute,others);
return "teacherHisSavePage";
}
//^^^^^^^^^^^^^^ Common part End ^^^^^^^^^^^^^^
For Use Redirect Action :
------------------------------
public String teacherHisSavePageOk(){
designationList();
districtList();
nationalityList();
religionList();
payscaleList();
return "teacherHisSavePageOk";
}
N.B: teacherHisSavePage = adminTCfromEdit.jsp (No value)
teacherHisSavePageOk = adminTCfromEdit.jsp (With value)
}
---------------------------------------------------------------------
<script type="text/javascript">
function teacherHistory(){
var teacherName = document.getElementById("teacherName").value;
//As combo
var des1 = document.getElementById('designation');
var designation = des1.options[des1.selectedIndex].value;
//alert("designation"+designation);
//***** Start this portion is use for get Gender radio button value //gender(genderOne,genderTwo,genderThree)
var radiosA=document.getElementsByName('gender');
//alert("radiosA"+radiosA);
var statusValA;
for (var i = 0, length = radiosA.length; i < length; i++) {
if (radiosA[i].checked) {
statusValA=radiosA[i].value; // statusValA (It is pass as action)
//alert("statusValA:"+statusValA);
break;
}
}
var dob = document.getElementById("dob").value;//alert("dob"+dob); //dob
//window.location="teacherHisSavePageLadmin.do?"
//window.location="teacherHisSavePageLadmin.do?reg_noA="+reg_noA;
window.location="teacherHisSavePageLadmin.do?teacherName="+teacherName+"&statusValA="+statusValA;
}
</script>
Now Struts configuration :
------------------------------
<!--Back up <action name="*Ladmin" class="com.allClass.Action.LoginAdminEditAction" method="{1}">
<result name="adminTcEdit">/adminTCfromEdit.jsp</result>
<result name="teacherHisSavePage">/adminTCfromEdit.jsp</result>
</action> -->
<!-- For Redirect Action Message -->
<action name="*Ladmin" class="com.allClass.Action.LoginAdminEditAction" method="{1}">
<result name="adminTcEdit">/adminTCfromEdit.jsp</result>
<result name="teacherHisSavePage" type="redirectAction">teacherHisSavePageOkLadmin</result>
<result name="teacherHisSavePageOk">/adminTCfromEdit.jsp</result>
</action>
LoginAdminEditAction.java :
--------------------------------
public class LoginAdminEditAction {
public String adminTcEdit(){
designationList();
districtList();
nationalityList();
religionList();
payscaleList();
return "adminTcEdit";
}
//^^^^^^^^^^^^^^ Common part Start ^^^^^^^^^^^^^^
//New action For Page save
private String SaveVal;
public String teacherHisSavePage(){
System.out.println("Save"+SaveVal);
/*designationList();
districtList();
nationalityList();
religionList();
payscaleList();*/
LoginAdminEditSql loginAdminEditSql = new LoginAdminEditSql();
loginAdminEditSql.insertTeacherHis(teacherName,designation,mpoIndex,statusValA,dob,homeDistrict,nationality,religion,statusValM,firstJoinDateTeach,joinPresentPost,joinThisInstitute,statusValAF,statusValSGM,dateGetMpo,payscale,basicSalary,allowancesHouseRent,allowancesMedical,allowancesEducation,allowancesConveyance,fromInstitute,others);
return "teacherHisSavePage";
}
//^^^^^^^^^^^^^^ Common part End ^^^^^^^^^^^^^^
For Use Redirect Action :
------------------------------
public String teacherHisSavePageOk(){
designationList();
districtList();
nationalityList();
religionList();
payscaleList();
return "teacherHisSavePageOk";
}
N.B: teacherHisSavePage = adminTCfromEdit.jsp (No value)
teacherHisSavePageOk = adminTCfromEdit.jsp (With value)
}
No comments:
Post a Comment