• Post Reply Bookmark Topic Watch Topic
  • New Topic

requestdispatcher

 
Jyoti Jadhav
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I want to send HTML data to servlet and after processing result should be displayed on other html form text field using forward method of RequestDispatcher...how to do this

i want to try using req.setAttribute(attributename,value)
what is attributename is that same as html form element name.
I want to write code following prob using request dispatcher-
1.enter 2 numbers thro' html form
2.submit that form
3.come in servlet to calculate average
4.send that average value to other html from element(text field)

thanks in advance
jyoti
[ November 16, 2007: Message edited by: Jyoti Jadhav ]
 
prakash chauhan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried using
request.getParameter("parametername");

to get html form parameters and then to forward it to another html page
using
request.setAttribute("ATTRIBUTENAME", attributevalue);

?
[ November 15, 2007: Message edited by: prakash chauhan ]
 
jasson jasson
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jyoti Jadhav:
Hi
I want to send HTML data to servlet and after processing result should be displayed on other html form text field using forward method of RequestDispatcher...how to do this

thanks in advance
jyoti


you can use "String str = request.getParameter(htmlparameter)",this method can get a Parameter from html field and you must request.setAttribute("Parameter",str),and forward to other html,then you may use EL expression
to get the Parameter ,like this ${Parameter}.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jasson jasson", you have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Be aware that accounts with invalid display names are disabled.

bear
JavaRanch Sheriff
 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jasson jasson:


you can use "String str = request.getParameter(htmlparameter)",this method can get a Parameter from html field and you must request.setAttribute("Parameter",str),and forward to other html,then you may use EL expression
to get the Parameter ,like this ${Parameter}.


I have a doubt here..
Can we use EL in HTML files also or we can use it only in JSPs?
 
sudhir nim
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pranav Pal:


I have a doubt here..
Can we use EL in HTML files also or we can use it only in JSPs?


It can be used with JSP only.
 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sudhir nim:


It can be used with JSP only.


Yes, sudhir. I tried to use EL in HTML, but, obviously, it didn't work.

So, Jyoti, you need to set request attribute in servlet and then forward the request to a JSP, not an HTML, using RequestDispatcher
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!