• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP to servlet

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 25
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
 
On my planet I'm considered quite beautiful. Thanks to the poetry in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic