How to pass hidden values
There is a row which has 2 fields
<td >燭icket No</td> <td >燘ill No</td>
<td ><input type="text" name="<%= ticketNo+ %>" value="" size=10></td>
<td ><INPUT TYPE="TEXT" NAME="<%=billNo+"%> value="" size=10></td>
I want to pass the values entered in the row along with one hidden value called as rowId. The rowId is attached to the ticketNo and billNo values.
How to do this?.........Plz Help
Any idea , if there are many rows?
[540 byte] By [
vishala] at [2007-10-2 8:55:38]

You can use input of hidden type and place it next to your ticketno or billno input tag.
it will not visible in your page or disturb your table layout when output to browser.
Since it's hidden, you can omit the size="".
<input type="hidden" name="" value="">
Hope it helps.
[nobr]Here is a basic servlet that reads three parameters from a form. One of the is hidden. You can see that its no different from reading non hidden form fields.
-S-
//
// The Servlet
//
package sample;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class TestServlet extends HttpServlet {
private final String CLASS_NAME = "TestServlet";
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doWork(req,res);
}
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doWork(req,res);
}
private void doWork(HttpServletRequest req, HttpServletResponse res)
throws IOException {
String val1 = req.getParameter("Value1");
String val2 = req.getParameter("Value2");
String val3 = req.getParameter("Value3");
System.out.println("Val1: " + val1 + "\nVal2: " + val2 + "\nVal3" + val3);
}
}
//
// JSP Page with hidden fields, posts to our Servlet
//
<html>
<head>
<title>Test Page</title>
</head>
<body>
<form action="/Test" name="" method="Post">
<input type="text" name="Value1" value="This is value 1">
<input type="Hidden" name="Value2" value="This is hidden value 2">
<input type="text" name="Value3" value="This is value 3">
<br>
<input type="Submit" value="Submit Form">
</form>
</body>
</html>
//
// web.xml servlet entry and mapping
//
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>sample.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/Test</url-pattern>
</servlet-mapping>
</web-app>
[/nobr]