• 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

requestdispatcher

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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}.
 
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
"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
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 212
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic