0

This is my success.jsp page which is having a button name Employee List, which opens a new page viewEmployee.jsp, i want to include the viewEmployee.jsp page inside my success.jsp page only on button click

<html>
<body>
<form action="index.jsp">
    <table>
        <tr>
            <td align="left">Welcome !! <%=session.getAttribute("user")%></td>
            <td align="right">&nbsp; <input type="submit" value="Logout"></td>
        </tr>
    </table>
    <hr>

    <h2>Choose your action to perform...</h2>
    <table align="center">
        <tr>
            <td><h3>
                    <input type="button" value="Employee List" onclick="window.location='viewEmployee.jsp'" /> |

                    </h3></td>
            <td><h3>
                    <a href="addEmployee.jsp">Add Employee </a> |
                </h3></td>
            <td><h3>
                    <a href="deleteEmployee.jsp">Delete Employee </a> |
                </h3></td>
            <td><h3>
                    <a href="updateEmployee.jsp">Update Employee </a>
                </h3></td>
        </tr>
    </table>
    <%
        session.invalidate();
    %>

</form>

Divesh
  • 11
  • 1
  • 3
  • 1
    Welcome to Stack Overflow! You mentioned the intended behavior. In what way is your current solution not providing the intended behavior? – David L Apr 09 '15 at 19:31
  • possible duplicate of [Include another JSP file](http://stackoverflow.com/questions/9110148/include-another-jsp-file) – Robert Moskal Apr 09 '15 at 19:36
  • If you want to reload the page on button click, should be obvious, submit a form. If you want to add the output of a page to this one on button click without refreshing, use Ajax. – developerwjk Apr 09 '15 at 19:38

1 Answers1

0

Perhaps you can try this solution. Hope its help

html code inside form

 <input type="button" value="Employee List" onClick="fnTest();" />

Javascript

function fnText()
{
    document.mainform.action="/home/folder/viewEmployee.jsp";
    document.mainform.submit();
}

add another form after end of first form

<form name="mainform" method="post" ></form>
user3835327
  • 1,194
  • 1
  • 14
  • 44