Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP to servlet

 
prathiba panati
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
How to retieve value of a variable from JSP to SERVLET.
In this program i need to retrieve value of rows and columns to servlet

<html>
<body text="black" >
<form name="pp" action="./updateinbox" method="post">
<br><br><br><br><br><br><br><br><br><br><br>
<p>
<%
Integer rows=(Integer)request.getAttribute("rows");
Integer cols=(Integer)request.getAttribute("cols");

%>
for(int i=0;i<rows;i++)
{
%>
<tr>
<%
for(int j=1;j<=cols;j++)
{%>
<td>  
<%=request.getAttribute("arr["+i+"]["+j+"]")%>

</td>
<%}%>

<td><select name="aa[<%=i%>]">
<option>accept</option>
<option>Reject</option></select>
</td>

</tr>

<% } %>

</table>
<input type="submit" value="Submit">

</form>
</body>
</html>
[ March 23, 2007: Message edited by: Bear Bibeault ]
 
                            
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your question is not clear can you explain me clearly so that i can answer your question...iam project manager for infosys..and post your address and phonenumber.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by santosh billal:
your question is not clear can you explain me clearly so that i can answer your question...iam project manager for infosys..and post your address and phonenumber.


santosh,
Please don't ask people to post their address and phone number.
If you wish to help the original poster, do so here, so everyone benefits from your answers.

See:
http://faq.javaranch.com/view?UseTheForumNotEmail
for more information on why doing this hurts the whole community.
 
prathiba panati
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry
Actually my problem is i have a variable named rows in my JSP and i need that value to be retrieved in the next servlet program (which is mapped through the action of form)
 
Ludmila Snova
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to store the variable in the hidden field or in URL as parameter.
For example,



And then in servlet retrieve them from request.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the essentially the same question that you asked here. Please do not post the same question more than once. I've closed the other topic.
 
bharat salunkhe
Greenhorn
Posts: 25
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just pass this value to servlet while you call eg. xyz.jsp?id=3
or simple access in servlet request.getparameter("id");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic