خرید بک لینک

Vote count: 0

I need to pass the id parameter from task.jsp to edit.jsp.

I tried using the set and get parameter with input type as hidden, but was unable to get the id in the edit.jsp

This is a part of my task.jsp page

<tr>
                <%-- <td><%=currentTask.getId()%></td> --%>
                <td><%=currentTask.getTaskDescription()%></td>
                <td><%=currentTask.getDate()%></td>
                <td><%=currentTask.getUser().getUserName()%></td>
                <td><input id="<%=currentTask.getId()%>" type="button"
                    onclick="editAction(this)" value="Edit" /></td>
                <td><input id="<%=currentTask.getId()%>" type="button"
                    onclick="deleteAction(this)" value="Delete" /></td>
            </tr>
            <%
                }
            %>
        </table>
    </div>
    <p />
    <input type="button"
        onclick="window.location='/HibeateWebApp/login.jsp';"
        value="Logout">

    <%
        System.out.println(userName);
    %>
</form>
<b><a href="CreateTask.jsp?userName=${userName}"> Click here
        to add a new task </a></b>


<script>
    function editAction(item) {
        int id = item.id;
</script>
<input type="hidden" name="id" id="id" />
<script>
    document.getElementById("id").value = id;
        document.form.action = "edit.jsp";
        document.form.submit();
        console.log(item.id);
    }
</script>


<script>
    function deleteAction(item) {
        console.log(item.id);
    }
</script>

This is the error I get in my console when I click on the edit button - ReferenceError: editAction is not defined

How do I pass the parameter from task.jsp and get it is edit.jsp

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 11 فروردين 1395 ساعت: 16:47

صفحه بندی