Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing a hidden values to servlets from HTML

 
sharaf navas
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
i'm designing an index page consists of links to some of my JSP pages and some
send to my ControllerServlet by "POST" method.The problem is how do i pass different types of hidden values to my ControllerServlet. i was trying to create a multipe forms but it wasn't working at all. to help me
here is my code
-------------------------------------------------------------
<body><form action="/control" method="POST">
<p><a href="http://localhost:8070/JSP/AddNewEmployee.jsp">Add Employee</a></p>
<p><a href="http://localhost:8070/JSP/AddNewGroup.jsp">Add Group</a></p>
<p><input type=hidden name="action" value="findAllEmployee"/><input type="submit" value="List all Employee" name="btnListallEmp"/> List All Employee</p>
</form>
<form action="/control" method=post>
<p><input type=hidden name="action" value="findAllGroup"/><input type="submit" value="List all Group" name="btnListallEmp"/> List All Group</p>
</form>
</body>

help to get better solution


thanks
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not great at Javascript, but how about this:

 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't use the controller for dispatching all requests?
THose two links to JSP do not seem a good design.
Try this:

[ September 12, 2006: Message edited by: Oricio Ocle ]
 
sharaf navas
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys
i did but further i get this error

Its seems to be like that i shouldn't add any write on response stream. but i haven't added any of out.write on my Servlet
help need
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the message is clear. Your controller was fordwarding after the response was commited.
This seems to be a specific problem of your framework, maybe caused by a wrong configuration...
You could find more useful information in other forums, such jsp forum or application frameworks...
Regards
 
sharaf navas
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic