jsppage:
<form name="Form1" action="addPatientPrg.do" method="post">
</form>
Struts.xml:
<action name="*Prg" class="com.allClass.Action.PatientRegAction" method="{1}">
<result name="addPatient" type="redirectAction">addPatientOkPrg</result>
<result name="addPatientOk">/Patient/registration.jsp</result>
</action>
PatientRegAction:
public String addPatient(){
ActionContext.getContext().getSession().put("bpNo",police_bp_no);
boolean fg = true;
con = dbc.connectDB();
if (con == null) {
fg = false;
}
if (fg) {
try {
st=con.createStatement();
String sql="select 'R'||(130100000000+seq_op_registration.nextval) secValues from dual";
ResultSet rs1=st.executeQuery(sql);
while(rs1.next()){
secVal=rs1.getString("secValues");
}
query1 = "insert into op_registration (reg_no, national_id, full_name,reg_dt, fname, mname,dob,age_yy,age_mm, " +
"age_dd, blood_group, gender, pat_mobile,marital_status,pat_type,entered_by,entry_timestamp, " +
"spouse_name, rel_id, police_bp_no)" +
" values " +
" ('"+secVal+"' , " +
" '"+national_id+"' , " +
" '"+full_name+"' , " +
" to_date('" + datVal + "','DD/MM/YYYY') , " +
" '"+fname+"' ," +
" '"+mname+"' ," +
" to_date('" + dob + "','DD/MM/YYYY') , " +
" "+Integer.parseInt(age_yy)+" ," +
" "+Integer.parseInt(age_mm)+" ," +
" "+Integer.parseInt(age_dd)+" ," +
" '"+blood_group+"' ," +
" '"+gender+"' ," +
" '"+pat_mobile+"' ," +
" '"+marital_status+"' ," +
" '"+patType_id+"' ," + // kaniz pat_type,
"'Shyfuzzaman', " +
" to_date('" + datVal + "','DD/MM/YYYY') , " +
" '"+spouse_name+"' ," +
" "+rel_id+" ," +
" '"+police_bp_no+"' " +
" )";
st.executeUpdate(query1);
} catch (SQLException sq) {
sq.printStackTrace();
} finally {
try {
if (rs != null) {
rs.close();
}
con.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
return "addPatient";
}
public String addPatientOk(){
String bpNo=String.valueOf(ActionContext.getContext().getSession().get("bpNo"));
hrvPoliceInfo= new HrvPoliceInfo();
hrvPoliceInfo = regitrationLoadPageSQL.getPatientDataByBp(bpNo);
opBloodGroupList = regitrationLoadPageSQL.getBloodGroupData();
opRelationRegistrationList = regitrationLoadPageSQL.getRelationPatientDataByBp(bpNo);
return "addPatientOk";
}
Field Error Message
JAVA page:
---------
addFieldError("fieldOne", "hellow");
addFieldError("fieldTwo", "hellow2");
JSP page:
---------
<s:fielderror><s:param>fieldOne</s:param></s:fielderror>
<s:fielderror><s:param>fieldTwo</s:param></s:fielderror>
<form name="Form1" action="addPatientPrg.do" method="post">
</form>
Struts.xml:
<action name="*Prg" class="com.allClass.Action.PatientRegAction" method="{1}">
<result name="addPatient" type="redirectAction">addPatientOkPrg</result>
<result name="addPatientOk">/Patient/registration.jsp</result>
</action>
PatientRegAction:
public String addPatient(){
ActionContext.getContext().getSession().put("bpNo",police_bp_no);
boolean fg = true;
con = dbc.connectDB();
if (con == null) {
fg = false;
}
if (fg) {
try {
st=con.createStatement();
String sql="select 'R'||(130100000000+seq_op_registration.nextval) secValues from dual";
ResultSet rs1=st.executeQuery(sql);
while(rs1.next()){
secVal=rs1.getString("secValues");
}
query1 = "insert into op_registration (reg_no, national_id, full_name,reg_dt, fname, mname,dob,age_yy,age_mm, " +
"age_dd, blood_group, gender, pat_mobile,marital_status,pat_type,entered_by,entry_timestamp, " +
"spouse_name, rel_id, police_bp_no)" +
" values " +
" ('"+secVal+"' , " +
" '"+national_id+"' , " +
" '"+full_name+"' , " +
" to_date('" + datVal + "','DD/MM/YYYY') , " +
" '"+fname+"' ," +
" '"+mname+"' ," +
" to_date('" + dob + "','DD/MM/YYYY') , " +
" "+Integer.parseInt(age_yy)+" ," +
" "+Integer.parseInt(age_mm)+" ," +
" "+Integer.parseInt(age_dd)+" ," +
" '"+blood_group+"' ," +
" '"+gender+"' ," +
" '"+pat_mobile+"' ," +
" '"+marital_status+"' ," +
" '"+patType_id+"' ," + // kaniz pat_type,
"'Shyfuzzaman', " +
" to_date('" + datVal + "','DD/MM/YYYY') , " +
" '"+spouse_name+"' ," +
" "+rel_id+" ," +
" '"+police_bp_no+"' " +
" )";
st.executeUpdate(query1);
} catch (SQLException sq) {
sq.printStackTrace();
} finally {
try {
if (rs != null) {
rs.close();
}
con.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
return "addPatient";
}
public String addPatientOk(){
String bpNo=String.valueOf(ActionContext.getContext().getSession().get("bpNo"));
hrvPoliceInfo= new HrvPoliceInfo();
hrvPoliceInfo = regitrationLoadPageSQL.getPatientDataByBp(bpNo);
opBloodGroupList = regitrationLoadPageSQL.getBloodGroupData();
opRelationRegistrationList = regitrationLoadPageSQL.getRelationPatientDataByBp(bpNo);
return "addPatientOk";
}
Field Error Message
JAVA page:
---------
addFieldError("fieldOne", "hellow");
addFieldError("fieldTwo", "hellow2");
JSP page:
---------
<s:fielderror><s:param>fieldOne</s:param></s:fielderror>
<s:fielderror><s:param>fieldTwo</s:param></s:fielderror>
No comments:
Post a Comment