aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes passing a hidden values to servlets from HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "passing a hidden values to servlets from HTML " Watch "passing a hidden values to servlets from HTML " New topic
Author

passing a hidden values to servlets from HTML

sharaf navas
Greenhorn

Joined: Aug 01, 2006
Posts: 25
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

Joined: Jul 20, 2005
Posts: 10263
    
168

I am not great at Javascript, but how about this:



[My Blog] [JavaRanch Journal]
Oricio Ocle
Ranch Hand

Joined: Nov 30, 2004
Posts: 284

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 ]

SCJP, OCMJD, OCMJEA
sharaf navas
Greenhorn

Joined: Aug 01, 2006
Posts: 25
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

Joined: Nov 30, 2004
Posts: 284

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

Joined: Aug 01, 2006
Posts: 25
thank you..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: passing a hidden values to servlets from HTML