This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JSP and the fly likes Save the form data and go back to main page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Save the form data and go back to main page " Watch "Save the form data and go back to main page " New topic
Author

Save the form data and go back to main page

Priya Rengaraj
Greenhorn

Joined: Dec 20, 2011
Posts: 1
Hi,

Please help me on the following:

I have a employee main jsp which where employeee search is performed. On the same page, I have a button to Create an employee. (createEmployee.jsp) .
In the createEmployee Page , when I enter the form data and click on save button, I need to submit the form and save the data and also go back to main page displaying the created employee information in the main page.

I need to use document.form.action and submit and need not window.open............ The create page looks like

<html>
..........
<form action = "createEmployee.jsp" method = "post" name = "createEmpForm">

.......... Form elements and data .............
........... Scriplets to call methods that save data....

<button name = "Save" onclick = "onSave()"; type = "submit"; .........../>
</form>

javascript function:

onSave(){
document.createEmpForm.action = "EmployeeMain.jsp";
documen.createEmpForm.submit();
}


But it doesnt work...

Please help with sample codes if possible.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56528
    
  14

Priya Rengaraj wrote:But it doesnt work...

Be more specific, please: ItDoesntWorkIsUseless


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Save the form data and go back to main page
 
Similar Threads
Form Tokens
Help me with session tracking example
add a new text field at every press of a button
Add new text field on each press of a button and retrieve values
populate the form field with the submitted input