Hey,
I want to send parameters via submitted form, and then to reload my jsp page:

Should I use onclick command or on submit action to transfer parameters using GET method?

My code:

<body>
        <form action="ShowPatientList.do" id="patientListForm" name="patientListForm" method = "GET">
            <p>ImiÄ™     <input id ="imie" name = "Imie" value = ""></p>
            <p>Nazwisko <input id ="nazwisko" name = "Nazwisko" value = ""></p>
            <p>Pesel    <input id ="pesel" name = "Pesel" value = ""></p>
            <input id ="subbutton" type = "submit" name="Wyszukiwanie" value = "Szukaj" onclick="">
            <c:forEach var="patient" items="${allPatients}">
                <p  onmouseover="style.backgroundColor='blue', style.cursor='pointer', style.width='320px'"
                    onmouseout="style.backgroundColor='white'"
                    onclick='method = "GET", window.location="ShowPatientDetail.do?guid="+<c:out value="${patient.guid}"/>'>
                    <c:out value="${patient.name}"/>
                    <c:out value="${patient.surname}"/>
                    <c:out value="${patient.pesel}"/>
                </p>
            </c:forEach>
        </form>
    </body>

I don't think method type matter (GET or POST) in this case, in case of form submission you better use onSubmit action rather than onClick. CMIIW.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.