JSP/Forms
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   lisa_oneill
Posted On:   Tuesday, July 2, 2002 03:11 AM

I don't know if this is possible and it's kinda difficult to explain. I have a form which shows a list of records from a table. Beside each record there is a checkbox. It the checkbox is checked(?!!) it takes the value from the first field and passes it onto the next page. But what I want to do is when the box is checked I want to pass on the values from the first two fields as it's a combined primary and I'm using these values for a search condition where in delete sql statement. Here is the code for passing one value is it possible to pass two?? for (int i=0;i { %> <%=v1.get(i)%> <%=v2.get(i)%> <%=v3.get(i)%>    More>>

I don't know if this is possible and it's kinda difficult to explain. I have a form which shows a list of records from a table. Beside each record there is a checkbox. It the checkbox is checked(?!!) it takes the value from the first field and passes it onto the next page. But what I want to do is when the box is checked I want to pass on the values from the first two fields as it's a combined primary and I'm using these values for a search condition where in delete sql statement. Here is the code for passing one value is it possible to pass two??


			

for (int i=0;i

{
%>






<%=v1.get(i)%> <%=v2.get(i)%> <%=v3.get(i)%> <%=v1.get(i)%>">
<%
}%>
   <<Less

Re: JSP/Forms

Posted By:   John_Ewing  
Posted On:   Tuesday, July 2, 2002 06:46 AM

Just concatinate the values on the JSP and split in theServlet them using java.util.StringTokenizer:


On the JSP:


for (int i=0;i
">
<%}%>


In your Servlet:


String key[] = request.getParameterValues("delete");
String part1, part2;
StringTokenizer st;
for(int i=0; i st = new StringTokenizer(key[i],",");
part1 = st.nextToken();
part2 = st.nextToken();
process(part1, part2);
}

Also if you are using Java 1.4 you could use the new RegEx package.


Good Luck!


John
About | Sitemap | Contact