如何在一个动作中在多个文本区域中获取jquery文本编辑器

时间:2013-03-19 04:58:12

标签: java jquery jsp textarea text-editor

我有一个jquery文本编辑器&有一个多文本区域我想在一个动作的每个文本区域中显示jquery文本编辑器,但只有第一个文本区域我能够显示文本编辑器

这是我的Jquery代码

<script type="text/javascript" id="themeUIPhysicalFinding">
  $(document).ready(function () {
      var options = {
          width: 962,
          height: 230,
          controls: "bold italic underline strikethrough subscript superscript | font size " +
                  "style | color highlight removeformat | bullets numbering | outdent " +
                  "indent | alignleft center alignright justify | undo redo | " +
                  "rule link image unlink | cut copy paste pastetext | print source"
      };

      var editor = $("#editor").cleditor(options)[0];

     // $("#editor").kendoEditor({
         // encoded: false
        // });
      //alert("asdfasdf");
      $("#Generate").click(function () {

          alert($("#editor").value());
          //$("#editor").val("");
      });

  });
</script>

我的Java脚本操作代码

function getPatientInformationTest(){
    var admissionNo=document.getElementById("apnNo").value;

    var url = "getPatientDemographyActionTestIPDPatientInfo.do?patientAdmissionNo="+admissionNo;
    makeRequestNoImage(url,"patientDischargeDiv" ,"themeUIPhysicalFinding");

这是我的HTML代码

<%@taglib prefix="s" uri="/struts-tags"%>
<!-- 

-->
<div>

<table border="0" class="" width="100%">
<tr>
<td><fieldset><legend>Patient Demography </legend><table width="100%" style="border:0px solid #FFFFFF"  cellpadding="0" cellspacing="0">

      <tr>
        <td>HN</td>
        <td><s:property value='deschargeInfo.patientRegistrationNo'/></td>
      </tr>

      <tr>
        <td>Age</td>
        <td><s:property value='deschargeInfo.patientAge'/></td>
      </tr>
      <tr>
        <td>Name</td>
        <td><s:property value='deschargeInfo.patientName'/></td>
      </tr>
      <tr>
        <td>Gender</td>
        <td><s:property value='deschargeInfo.patientGender'/></td>
      </tr>


      <tr>
        <td>Contact Info</td>
        <td><s:property value='deschargeInfo.patientContactNo'/></td>
      </tr>

    </table></fieldset></td>
<td><fieldset><legend>Doctor's Info</legend><table width="100%" border="0" style="border:0px solid #FFFFFF"  cellpadding="0" cellspacing="0">
   <tr>
        <td>Admitted Under</td>
        <td><s:property value='deschargeInfo.patientAdmittingUnder'/></td>
      </tr>
      <tr>
        <td>Admitted By</td>
        <td><s:property value='deschargeInfo.patientAdmittingDoctor'/></td>
      </tr>
       <tr>
        <td>Department Name</td>
        <td><s:property value='deschargeInfo.departmentName'/></td>
      </tr>

</table></fieldset></td>
<td><fieldset><legend>Admission Information</legend><table width="99%" border="0" style="border:0px solid #FFFFFF"  cellpadding="0" cellspacing="0">



      <tr>
        <td>Date Of Admission</td>
        <td><s:property value='deschargeInfo.patientDateOfAdmission'/></td>
      </tr>
      <tr>
        <td>Date Of Discharge</td>
        <td><s:property value='deschargeInfo.patientDateOfDischarge'/></td>
      </tr>
        <tr>
        <td>Length of LOS</td>
        <td><s:property value=''/></td>
      </tr>
      <tr>
        <td>Ward No</td>
        <td><s:property value='deschargeInfo.patientWordNo'/></td>
      </tr>
      <tr>
        <td>Bed/Cabin No</td>
        <td><s:property value='deschargeInfo.patientBedNo'/></td>
      </tr>


    </table></fieldset></td>
</tr>

<tr>

<td height="265" colspan="3"><div id="headerRemoveDiv">


 <table class="subTableCC" width="100%">
    <tr>

        <th width="100%">Header Name</th>
        <!--  <th width="42">Remove</th>-->
    </tr>
    <s:iterator status="stat" value="deschargeList">
    <tr>

        <td width="100%">
        <s:property value="headerName" />
        </td>

    </tr>
     <tr>


    <td width="100%" height="211" colspan="8" style="padding:0px;">
    <textarea name="textarea" cols="150" rows="13" id="<s:property value='headerNo'/>" ></textarea></td>
  </tr>
    </s:iterator>
</table></div></td>
</tr>

</table>
</div>

这是我的Java动作类代码

public String getPatientDemographyActionTest(){

    PatientDischargeInfo patientDischargeInfo = new PatientDischargeInfo();
    deschargeInfo=patientDischargeInfo.getPatientInfoForDescharge(patientAdmissionNo);
    DepartmentHeaderInfo departmentHeaderInfo = new DepartmentHeaderInfo();
    deschargeList=departmentHeaderInfo.getDepartmentHeader(patientAdmissionNo);
    ActionContext.getContext().getSession().put(sessionVariable.getHeaderInfo(), deschargeList);

    return "getPatientDemographyActionTest";
}

这是我的SQL代码

        public PatientDeschargeInfo getPatientInfoForDescharge(
                String p_admission_no) {

            //String vDAY_PK_NO = "";
            if (dbConnection == null) {
                dbConnection = new DatabaseConnection();
            }

            String strProcedure = "{call pkg_discharge.prc_dispatinfo(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
            try {
                connection = dbConnection.connectDB();
                cs = connection.prepareCall(strProcedure);

                cs.setString(1, p_admission_no);
                cs.registerOutParameter(2, java.sql.Types.DATE);
                cs.registerOutParameter(3, java.sql.Types.DATE);
                cs.registerOutParameter(4, java.sql.Types.VARCHAR);
                cs.registerOutParameter(5, java.sql.Types.VARCHAR);
                cs.registerOutParameter(6, java.sql.Types.VARCHAR);
                cs.registerOutParameter(7, java.sql.Types.VARCHAR);
                cs.registerOutParameter(8, java.sql.Types.VARCHAR);
                cs.registerOutParameter(9, java.sql.Types.VARCHAR);
                cs.registerOutParameter(10, java.sql.Types.VARCHAR);
                cs.registerOutParameter(11, java.sql.Types.VARCHAR);
                cs.registerOutParameter(12, java.sql.Types.VARCHAR);
                cs.registerOutParameter(13, java.sql.Types.VARCHAR);
                cs.registerOutParameter(14, java.sql.Types.VARCHAR);
                cs.registerOutParameter(15, java.sql.Types.VARCHAR);
                cs.registerOutParameter(16, java.sql.Types.VARCHAR);
                cs.registerOutParameter(17, java.sql.Types.VARCHAR);


                cs.execute();
                //deschargeInfo = new PatientDeschargeInfo();
                deschargeInfo.setPatientDateOfAdmission(cs.getDate(2));
                deschargeInfo.setPatientDateOfDischarge(cs.getDate(3));
                deschargeInfo.setPatientRegistrationNo(cs.getString(4));
                deschargeInfo.setPatientName(cs.getString(5));
                deschargeInfo.setPatientNationalId(cs.getString(6));
                deschargeInfo.setPatientGender(cs.getString(7));
                deschargeInfo.setPatientBloodGroup(cs.getString(8));
                deschargeInfo.setPatientContactNo(cs.getString(9));
                deschargeInfo.setPatientAge(cs.getString(10));
                deschargeInfo.setPatientAdmittingDoctor(cs.getString(11));
                deschargeInfo.setPatientAdmittingUnder(cs.getString(12));
                deschargeInfo.setPatientBedNo(cs.getString(13));
                deschargeInfo.setPatientWordNo(cs.getString(14));
                deschargeInfo.setPatientAddress(cs.getString(15));
                deschargeInfo.setDepartmentId(cs.getString(16));
                deschargeInfo.setDepartmentName(cs.getString(17));

               // vDAY_PK_NO = cs.getString(9);

            } catch (Exception ex) {
                ex.printStackTrace();
            } finally {
                try {
                    cs.close();
                    connection.close();
                } catch (SQLException ex) {
                    ex.printStackTrace();
                }
            }
//          System.out.println("pkStrring " + vDAY_PK_NO);
            return deschargeInfo;
        }

SQL代码是..

public List<PatientDeschargeInfo> getDepartmentHeader(String ADMISSION_NO){
    List<PatientDeschargeInfo> deschargeInfo = new ArrayList<PatientDeschargeInfo>() ;
    boolean fg = true;
    con = dbc.connectDB();

    if (con == null) {
        fg = false;
    }
    if(fg){
        try{
            st=con.createStatement();

                    String qty ="select LKP_ID , (select lkp_name " +
                            "from   m00_lkp " +
                            "where  grp_id =10 " +
                            "and    rsta   = 0 " +
                            "and    lkp_id = a.lkp_id) head_name " +
                            "from   eh_discheadmap a " +
                            "where  dept_no = ( select parent_dept " +
                            "from   hr_dept " +
                            "where  dept_no = (select dept_no  " +
                            "from   ip_admission " +
                            "where  admission_no = '"+ADMISSION_NO+"'))";

            System.out.println("Qry :"+qty);

            rs = st.executeQuery(qty);
            while (rs.next()) {
                //deschargeInfo.setPatientAddress(rs.getString(""));
                //deschargeInfo.setPatientAdmissionNo(rs.getString(""));
                PatientDeschargeInfo patientDeschargeInfo = new PatientDeschargeInfo();
                patientDeschargeInfo.setHeaderName(rs.getString("head_name"));
                patientDeschargeInfo.setHeaderNo(rs.getInt("LKP_ID"));
                deschargeInfo.add(patientDeschargeInfo);

                //resultList.add(deschargeInfo);
            }
            } catch (SQLException sq) {
            sq.printStackTrace();
        } finally {
            try {
                if (rs != null) {
                    rs.close();
                }
                con.close();
            } catch (SQLException ex) {
                ex.printStackTrace();
            }
        }
    }
    return deschargeInfo;
}

0 个答案:

没有答案