[英]How to get input value from form to servlet
I have the following form:我有以下表格:
<form action="get_eD_XML" method="POST" enctype ="application/xml">
<input value = '<?xml version="1.0" encoding="UTF-8"?><ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:epsos="urn:epsos-org:ep:medication" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><typeId extension="POCD_HD000040" root="2.16.840.1.113883.1.3"/><templateId root="1.3.6.1.4.1.12559.11.10.1.3.1.1.2"/><templateId root="1.3.6.1.4.1.19376.1.5.3.1.1.1"/><id extension="KoF9cw5Rjh7Waq/K" root="2.16.470.1.100.1.2.1000.990.1"/><code code="60593-1" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" codeSystemVersion="2.59" displayName="Medication dispensed.extended Document"><translation code="60593-1" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="eDispensation"/></code><title>Medication dispensed</title><effectiveTime value="20190624074224+0000"/><confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25" codeSystemName="Confidentiality" codeSystemVersion="913-20091020" displayName="normal"/><languageCode code="en-US"/><setId nullFlavor="NI"/><recordTarget><patientRole><id extension="1" root="2.16.470.1.100.1.1.1000.990.1"/><addr><country>CY</country><streetAddressLine>21, Dimokritou, 1000, Strovolos, Nicosia</streetAddressLine></addr><telecom use="H" value="tel:+99000000"/><telecom use="H" value="mailto:l.petr@testmail.com"/><patient><name><given>Leonidas</given><family>Petrou</family></name><administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1" codeSystemName="AdministrativeGender" codeSystemVersion="913-20091020" displayName="Male"/><birthTime value="19900101"/><languageCommunication><templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1"/><languageCode code="en-GB"/></languageCommunication></patient></patientRole></recordTarget><author typeCode="AUT"><functionCode code="2262" codeSystem="2.16.840.1.113883.2.9.6.2.7" codeSystemName="ISCO" codeSystemVersion="2008" displayName="Pharmacists"/><time value="20190624074224+0000"/><assignedAuthor classCode="ASSIGNED"><id extension="21229" root="2.16.470.1.100.1.2.1000.990.1"/><addr><streetAddressLine nullFlavor="NI"/><city nullFlavor="NI"/><state nullFlavor="NI"/><postalCode nullFlavor="NI"/><country>MT</country></addr><telecom use="WP" value="mailto:pharmacist@openncp.com"/><assignedPerson classCode="PSN" determinerCode="INSTANCE"><name><family nullFlavor="NI"/><given>pharmacist</given></name></assignedPerson><representedOrganization><id extension="21229" root="2.16.470.1.100.1.2.1000.990.1"/><name> pharmacist</name><telecom use="WP" value="mailto:pharmacist@openncp.com"/><addr><streetAddressLine nullFlavor="NI"/><city nullFlavor="NI"/><state nullFlavor="NI"/><postalCode nullFlavor="NI"/><country>MT</country></addr></representedOrganization></assignedAuthor></author><custodian typeCode="CST"><assignedCustodian classCode="ASSIGNED"><representedCustodianOrganization classCode="ORG" determinerCode="INSTANCE"><id root="2.16.470.1.100.1.2.1000.990.1"/><name>Country Custodian Name</name><telecom nullFlavor="NI"/><addr><country>MT</country></addr></representedCustodianOrganization></assignedCustodian></custodian><legalAuthenticator contextControlCode="OP" typeCode="LA"><time value="20120927112208"/><signatureCode code="S"/><assignedEntity classCode="ASSIGNED"><id root="2.16.470.1.100.1.2.1000.990.1"/><addr><streetAddressLine>4, Breydel Street</streetAddressLine><city>Brussels</city><postalCode>B-1000</postalCode><state nullFlavor="UNK"/><country>BE</country></addr><telecom nullFlavor="NI"/><assignedPerson><name><family>Firstname</family><given>Organisation</given></name></assignedPerson><representedOrganization classCode="ORG" determinerCode="INSTANCE"><id root="2.16.470.1.100.1.2.1000.990.1"/><name>Kansaneläkelaitos</name><telecom nullFlavor="NI"/><addr use="PST"><streetAddressLine>N/A</streetAddressLine><city>City</city><postalCode>N/A</postalCode><state nullFlavor="UNK"/><country>MT</country></addr></representedOrganization></assignedEntity></legalAuthenticator><inFulfillmentOf><order moodCode="RQO"><id extension="Prescriptions" root="2.16.620.1.101.10.3.29.54290"/></order></inFulfillmentOf><relatedDocument typeCode="XFRM"><parentDocument classCode="DOCCLIN"><id extension="Prescriptions" root="2.16.620.1.101.10.3.29.54290"/></parentDocument></relatedDocument><component><structuredBody><component><section><templateId root="2.16.840.1.113883.10.20.1.8"/><templateId root="1.3.6.1.4.1.12559.11.10.1.3.1.2.2"/><id extension="D-Prescriptions" root="2.16.470.1.100.1.2.1000.990.1"/><code code="60590-7" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" codeSystemVersion="2.59" displayName="Medication dispensed.brief Document"><translation code="60590-7" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Medication dispensed"/></code><title>Dispensation: D-Prescriptions</title><text><table width="100%"><thead><tr><th>Active Ingredient (ATC)</th><th>Pharmaceutical Dose Form</th><th>Strength</th><th>Number of Units per intake</th><th>Frequency of Intake</th><th>Duration of treatment</th><th>Number of Prescribed Packages</th><th>Size of the package prescribed and package type</th><th>Route of Administration</th><th>Substitution</th><th>Onset Date of treatment</th><th>Instructions to patient</th><th>Advise to the dispenser</th></tr></thead><tbody><tr ID="medicine.1"><td>levothyroxine sodium (ATC: H03AA01)</td><td>Tablet</td><td>100 mg</td><td>1</td><td>1 before breakfast (from lat. ante cibus matutinus)</td><td>30 days</td><td>1</td><td>30 x 2 [iU]/mL , Blister</td><td>Oral use</td><td>none</td><td>2019-05-29</td><td>NA</td><td>NA</td></tr></tbody></table></text><entry typeCode="COMP"><supply classCode="SPLY" moodCode="EVN"><templateId root="2.16.840.1.113883.10.20.1.34"/><templateId root="1.3.6.1.4.1.19376.1.5.3.1.4.7.3"/><templateId root="1.3.6.1.4.1.12559.11.10.1.3.1.3.3"/><id extension="medicine.1" root="2.16.470.1.100.1.2.1000.990.1"/><quantity unit="1" value="30.0"/><product><manufacturedProduct classCode="MANU"><templateId root="1.3.6.1.4.1.12559.11.10.1.3.1.3.1"/><manufacturedMaterial classCode="MMAT" determinerCode="KIND"><epsos:id extension="medicine.1" root="1.3.6.1.4.1.12559.11.10.1.3.1.3.3"/><code code="10219000" codeSystem="0.4.0.127.0.16.1.1.2.1" codeSystemName="EDQM" codeSystemVersion="2017-04-14" displayName="levothyroxine sodium"/><name>levothyroxine sodium</name><epsos:desc>100 mg</epsos:desc><epsos:formCode code="10219000" codeSystem="0.4.0.127.0.16.1.1.2.1" codeSystemName="EDQM" codeSystemVersion="2017-04-14" displayName="Tablet"/><epsos:asContent classCode="CONT"><epsos:containerPackagedMedicine classCode="CONT" determinerCode="INSTANCE"><epsos:name>levothyroxine sodium</epsos:name><epsos:formCode code="10219000" codeSystem="0.4.0.127.0.16.1.1.2.1" codeSystemName="EDQM" codeSystemVersion="2017-04-14" displayName="Tablet"/><epsos:capacityQuantity unit="1" value="2"/><epsos:capTypeCode nullFlavor="NA"/></epsos:containerPackagedMedicine></epsos:asContent><epsos:asSpecializedKind classCode="GEN"><epsos:generalizedMedicineClass classCode="MMAT"><epsos:code code="H03AA01" codeSystem="2.16.840.1.113883.6.73" codeSystemName="Anatomical Therapeutic Chemical" codeSystemVersion="2017-01" displayName="levothyroxine sodium"/><epsos:name>levothyroxine sodium, 100 mg, 30 x 2 [iU]/mL , Blister</epsos:name></epsos:generalizedMedicineClass></epsos:asSpecializedKind><epsos:ingredient xmlns="urn:epsos-org:ep:medication" classCode="ACTI"><epsos:quantity><epsos:numerator unit="mg" value="100" xsi:type="epsos:PQ"/><epsos:denominator unit="[iU]/mL" value="1" xsi:type="epsos:PQ"/></epsos:quantity><epsos:ingredient classCode="MMAT" determinerCode="KIND"><epsos:code code="H03AA01" codeSystem="2.16.840.1.113883.6.73" codeSystemName="Anatomical Therapeutic Chemical" codeSystemVersion="2017-01" displayName="levothyroxine sodium"/><epsos:name>levothyroxine sodium</epsos:name></epsos:ingredient></epsos:ingredient></manufacturedMaterial></manufacturedProduct></product><performer typeCode="PRF"><time value="20190624074224+0000"/><assignedEntity><id extension="21229" root="2.16.470.1.100.1.2.1000.990.1"/><addr><streetAddressLine nullFlavor="NI"/><city nullFlavor="NI"/><state nullFlavor="NI"/><postalCode nullFlavor="NI"/><country>MT</country></addr><telecom use="WP" value="mailto:pharmacist@openncp.com"/><assignedPerson><name><family nullFlavor="NI"/><given>pharmacist</given></name></assignedPerson><representedOrganization><id extension="21229" root="2.16.470.1.100.1.2.1000.990.1"/><name> pharmacist</name><telecom use="WP" value="mailto:pharmacist@openncp.com"/><addr><streetAddressLine nullFlavor="NI"/><city nullFlavor="NI"/><state nullFlavor="NI"/><postalCode nullFlavor="NI"/><country>MT</country></addr></representedOrganization></assignedEntity></performer><participant typeCode="PRF"><participantRole classCode="LIC"><id nullFlavor="NI"/><scopingEntity classCode="ORG"><id nullFlavor="NI"/></scopingEntity></participantRole></participant><entryRelationship typeCode="REFR"><substanceAdministration classCode="SBADM" moodCode="INT"><id extension="medicine.1" root="2.16.620.1.101.10.3.29.54290"/><text><reference value="#medicine.1"/></text><statusCode code="active"/><effectiveTime xsi:type="IVL_TS"><low value="20190529"/><high value="20190628"/></effectiveTime><effectiveTime institutionSpecified="true" operator="A" xsi:type="PIVL_TS"><period nullFlavor="NA"/></effectiveTime><routeCode code="20053000" codeSystem="0.4.0.127.0.16.1.1.2.1" codeSystemName="EDQM" codeSystemVersion="2017-04-14" displayName="Oral use"/><doseQuantity nullFlavor="UNK"/><consumable typeCode="CSM"><manufacturedProduct classCode="MANU"><templateId root="1.3.6.1.4.1.12559.11.10.1.3.1.3.1"/><manufacturedMaterial classCode="MMAT" determinerCode="KIND"><code code="10219000" codeSystem="0.4.0.127.0.16.1.1.2.1" codeSystemName="EDQM" codeSystemVersion="2017-04-14" displayName="Tablet"/><name>levothyroxine sodium</name><epsos:desc>100 mg</epsos:desc><epsos:formCode code="10219000" codeSystem="0.4.0.127.0.16.1.1.2.1" codeSystemName="EDQM" codeSystemVersion="2017-04-14" displayName="Tablet"/><epsos:asContent classCode="CONT"><epsos:containerPackagedMedicine classCode="CONT" determinerCode="INSTANCE"><epsos:name>Eurthyrox</epsos:name><epsos:formCode code="10219000" codeSystem="0.4.0.127.0.16.1.1.2.1" codeSystemName="EDQM" codeSystemVersion="2017-04-14" displayName="Tablet"/><epsos:capacityQuantity unit="1" value="2"/><epsos:capTypeCode nullFlavor="NA"/></epsos:containerPackagedMedicine></epsos:asContent><epsos:asSpecializedKind classCode="GEN"><epsos:generalizedMedicineClass classCode="MMAT"><epsos:code code="H03AA01" codeSystem="2.16.840.1.113883.6.73" codeSystemName="Anatomical Therapeutic Chemical" codeSystemVersion="2017-01" displayName="levothyroxine sodium"/><epsos:name>levothyroxine sodium, 100 mg, 30 x 2 [iU]/mL , Blister</epsos:name></epsos:generalizedMedicineClass></epsos:asSpecializedKind><epsos:ingredient xmlns="urn:epsos-org:ep:medication" classCode="ACTI"><epsos:quantity><epsos:numerator unit="mg" value="100" xsi:type="epsos:PQ"/><epsos:denominator unit="[iU]/mL" value="1" xsi:type="epsos:PQ"/></epsos:quantity><epsos:ingredient classCode="MMAT" determinerCode="KIND"><epsos:code code="H03AA01" codeSystem="2.16.840.1.113883.6.73" codeSystemName="Anatomical Therapeutic Chemical" codeSystemVersion="2017-01" displayName="levothyroxine sodium"/><epsos:name>levothyroxine sodium</epsos:name></epsos:ingredient></epsos:ingredient></manufacturedMaterial></manufacturedProduct></consumable><entryRelationship typeCode="COMP"><sequenceNumber value="1"/><supply classCode="SPLY" moodCode="RQO"><independentInd value="false"/><quantity unit="{packages}" value="30.0"/></supply></entryRelationship><entryRelationship inversionInd="true" typeCode="SUBJ"><observation classCode="OBS" moodCode="EVN"><code code="SUBST" codeSystem="2.16.840.1.113883.5.6" codeSystemName="ActClass" displayName="Substitution"/><value code="N" codeSystem="2.16.840.1.113883.5.1070" codeSystemName="SubstanceAdminSubstitution" codeSystemVersion="913-20091020" displayName="none" xsi:type="CD"/></observation></entryRelationship></substanceAdministration></entryRelationship></supply></entry></section></component></structuredBody></component></ClinicalDocument>'/>
<input type="submit" value="Test" />
</form>
I need to get the input value.我需要获取输入值。
I'm using the following servlet
code to get the input value, but the String eD is empty.我正在使用以下
servlet
代码来获取输入值,但 String eD 为空。 Any help please?请问有什么帮助吗?
@WebServlet("/get_eD_XML")
public class get_eD_XML extends CEFCYServlet {
private static final long serialVersionUID = 1L;
//private PatientSummaryConf globalVal;
public get_eD_XML()
{
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
{
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
{
String eD = IOUtils.toString(request.getReader());
System.out.println(eD);
}
}
Change input as follows:更改输入如下:
<input type="hidden" name="param1" value="your value" />
And in the servlet you can get it:在servlet中你可以得到它:
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String eD = request.getParameter("param1");
System.out.println(eD);
}
UPDATE:更新:
The W3C specification mandates that every form input element has a name attribute specified. W3C 规范要求每个表单输入元素都有一个指定的名称属性。 Otherwise that element will not be processed.
否则,该元素将不会被处理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.