• 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 a variable and print in same page

 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need to get a variable from a combobox and print in same page.Is it possible.If yes,please guide me to do this.
The following is the code to select ratio from combobox


Thanks
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are probably generating a form through this servlet code, action attribute value of this form should map to the same servlet.
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This servlet name is campaignselection.java.I am submitting the values to another servlet as follows.

Now I have to submit the form to same servlet?
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so far as my knowledge goes it can be achieved in 3 ways
1. Submit to the same servlet
2. If submitted to another servlet, the second servlet forwards the request back to the servlet which generates the form
3. If submitted to another servlet, the second servlet displays the output and includes the first servlet, so from user point of view it will appear on the same page.
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for you reply.But my actual problem is ,if i submit the form two frames will be opened ,In one frame the main page displays with a combo box to choose a network and stop button.another frame will show which network I have selected and submitted.If i select a network from the combo box and click stop button ,I am unable to close the second frame.Thats why i tried to use stop as link instead of a button and call a javascript function which forwards the whole frames to the page we required.But using stop as link(ie)


By using this i can able to close the two frames and open the new page.But i am unable to get the variables which is selected in the combo box.

Thats why i thought if i am able to print the variable selected in the combox in the samepage ,i will put that in session and get that in session when clicking stop.

If it is a wrong method,please give me a suggestion to do this.

Thanks again.
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe you can always pass the selected combo box value as a querystring

i.e.



now in servlet (i.e. url pattern AsiaLogout) you can always receive this value


 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


a href='http://localhost:8080/Voicebroadcast/AsiaLogout?commboxvalue=thevalueselected'


The value selected is dynamic.Then what should i mention there?
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
//the following code snippet might provide you some help, just a html page, as per your requirement you need to embed inside servlet, but for presentation logic its always better to use jsp


 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
sorry for the delayed reply.thanks for your reply.It works fine. As per your suggestion i have changed the servlet to jsp.Thanks a lot.
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic