Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp

 
sachin cknd
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everybody,
i am very new to jsp and facing a very priliminary problem.
please help me.
i have a html form in which i am accepting text im text field and i want to pass this text to my jsp program on pressing submit in html.
how can i accept this data from html in jsp prog?
i am familiar with servlet programming.
i have tried with object.getParameter("");
i am getting the html content of JSP file but i am not getting the dynamically generated page.
can i use this method in jsp or their is any other way.
please suggest me
thanx in advance
 
Sowmya Vinay
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To access the form parameters, you will have to use getParameter method of "request" object. "request"(instance of HttpServletRequest) is an implicitly available object for any JSP. If you have named your text field as "text1", then to extract its value use: String t1 = request.getParameter("text1");
 
Raukutam Sandeep
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sachin,

u have to use the 'request' object(this object is implicit one..u need not declare) in JSP to capture the value passed from HTML page..
Suppose, u have a text field by name 't1', then in JSP page,
u have to write the code as
<% String name=request.getParameter("t1");
out.println(name);
%>
U said u are familiar with servlet prog..so it won't be a problem for u..
try this and get back!!
best of luck!!
regds,
Sandeep.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic