• 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

how to get values from jsp pages

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everybody,
I Am New To JSP-SERVLETS & I Have Working On Example Where I Have 1 Jsp Page Where We Select Color & When
Click On Next We Get 2nd JSP Page Where We select Brands & In This 2nd JSP Page I Get Value Of Color using

colorbrand = request.getParameter("color");
session.setAttribute("col",colorbrand);

and set in session with variable named "col"

On 2nd JSP Page I Have Next Button WHcih goes To 3rd JSP Page Where It Shows Price Selection & In This 3rd JSP
Page I Get Values Of Color & Brand As

brandprice = request.getParameter("brand");
session.setAttribute("br",brandprice);

brandcol = session.getAttribute("col").toString();
out.println("Brand :"+ brandprice +"Color :"+ brandcol);

So IN 3rd JSP Page I Get 3 Values i.e color,brand & price & Then I Call Servlet Which Does Processing
& Shows Result According To Color,Brand & Price Selected in my result.jsp,But Problem Which I Am Facing Is
In My Servlet Code I Have Written As

String col = session.getAttribute("col").toString();// null values
String brand = session.getAttribute("br").toString();
String price = request.getParameter("price");

& I Get null values for color ie "col",so is there any way that I can get this values of color & brand.

Thank-You
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rahul,

Do you get null values for both color and brand? This sentence is little confusing "I Get null values for color ie "col",so is there any way that I can get this values of color & brand." If its just color value that is null then may be its the issue with not using the right attribute name while retrieving the value.
 
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
Hmmm, I'm trying to look at your code, but the stubborn forum software has made it look all wonky. If you use CODE tags when posting code to the forums (see the FAQ at ⇒ UseCodeTags ⇐) they tell it "Hey! Keep your hands off my formatting!" and your code will look just like when you cut and pasted it into the reply. Cool, no?
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rahul, you are setting "col" in session and getting correctly in your servlet, looks fine. Could you just verify if you are setting some value (just give SOP). That would clearly show what you are setting in session


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic