This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes JSP to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP to servlet" Watch "JSP to servlet" New topic
Author

JSP to servlet

prathiba panati
Greenhorn

Joined: Mar 09, 2007
Posts: 8
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 ]
santosh billal
Greenhorn

Joined: Dec 15, 2006
Posts: 18
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
prathiba panati
Greenhorn

Joined: Mar 09, 2007
Posts: 8
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

Joined: Aug 31, 2006
Posts: 20
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

Joined: Jan 10, 2002
Posts: 60808
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
bharat salunkhe
Greenhorn

Joined: May 28, 2013
Posts: 25

just pass this value to servlet while you call eg. xyz.jsp?id=3
or simple access in servlet request.getparameter("id");
 
Consider Paul's rocket mass heater.
 
subject: JSP to servlet
 
Similar Threads
Value in dropdown from servlet
accessing jsp array variable in javascript
Passing more than one object between jsp and servlet
servlets/jsp
spaces while populating using s:iterator