• 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

built a program that can directly run in the same page

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to built a program that will contain 2 combo box for user to select and some empty field is for retrieve the data from the database. what i want to do is after the user select the value from the combo box, the page will direct retrieve the data from the database and display on the same screen.what i want is all of this process will be done in one page only.how i can perform like this beside using the AJAX??

thank you

regards,
albert
[ April 07, 2006: Message edited by: Bear Bibeault ]
 
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
What has become known as Ajax, either through the use of XMLHttpRequest or the use of a hidden iframe, is the only means (without resorting to Applets) to make such a thing possible.
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that mean i have to use AJAX.
i want to make sure something, if i want to using AJAX i need to write a javascript code in the relevant page and a server script right?
i already write the javascript part in my program but now i stuck in the server script to ask the server to pass back the value. that because the combo box value can be retrieve using DOM by javascript, i need to get the value from the server script from there change to java then pass back the value to the client page to do the retrieving database process which is in client page. is it my concept is on the track???
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in order to use AJAX in jsp, is it i need to use the dwr api???
i found 1 artical on internet which is " ask to download the API, is it true???
 
Bear Bibeault
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

Originally posted by albert sie:
in order to use AJAX in jsp, is it i need to use the dwr api?



No. Whether your page is generated via JSP or anything else is completely immaterial. Once the page gets to the browser it's just an HTML page like any other.
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
after the client make the request from the first page, is it i need to write a script file to ask the server send back the data that the client request. In my plan is for example A.jsp page is the first page. in A.jsp contain 2 combo box and below the combo box is the empty field that i create using the table to align, for example the field will in this code: <td>Name</td><td>:<%=name%></td> the name will retrieve from the database. What i want is after user select from the combo box the page will make request from the server then send back the combo box value then the A.jsp page will depend on the value return to retrieve the database. i know how to make request but i not sure is how the server will send back the value to the A.jsp??
can anyone give me concept of this. thank you for the help that pour to me. thank you

regards,
albert
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anybody can give me the concept on how to do. i try many way but still cannot get. i try hard to get that but i can't. can anyone give me some help and guidance
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by albert sie:
how the server will send back the value to the A.jsp??

It doesn't. You need to get that concept out of your head.

Remember that your JSP code is executed on the server. It produces some HTML, which can include Javascript, and sends it to the client. At that point, as far as you are concerned, the JSP page no longer exists. It is finished.

Then the browser gets that HTML and renders it. Remember that this is not the JSP page it gets. That JSP page is dead. The browser gets some HTML and renders it. Any Javascript in that HTML will be run whenever the HTML says so. Therefore, when learning about AJAX you only need to understand how it fits into HTML.

There are plenty of examples of AJAX floating about on the Internet. People have even written entire books about the subject. You have already tracked down some examples, so look for more.
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i know the different between the application that using AJAX and without AJAX. The normal web application architecture is the after the user submit, the page will go through the server and the server will get the second page and send back to the client and the client will using "request.getParameter" to get the value, this is the normal web application. Since the ajax can request the value from the server without reload the page, so for the ajax architecture is when the client make request, it will go through the ajax engine first and the AJAX will make the request to the server and the server also will pass back the value to the client through the ajax machine. what i need to do is i also want to do the machanism of decrease the time of reloading of the pages.is it when i submit the page i should point back to the same page so that my value will be past back to the same page???

correct me if i wrong? and where i can get more resources about to use ajax with the jsp and java???


thank you...

albert
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you not read the links I gave to you in your other topic that is covering the smae exact thing?

https://coderanch.com/t/117743/HTML-JavaScript/ask-pass-value

In the are working examples with Java and Ajax for a double combo.

Eric
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops i will go through it now. and 1 thing i want to know is for my situation is it i needed the server site script to get the value from 1st page and pass back to first page???
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by albert sie:
after the client make the request from the first page, is it i need to write a script file to ask the server send back the data that the client request. In my plan is for example A.jsp page is the first page. in A.jsp contain 2 combo box and below the combo box is the empty field that i create using the table to align, for example the field will in this code: <td>Name</td><td>:<%=name%></td> the name will retrieve from the database. What i want is after user select from the combo box the page will make request from the server then send back the combo box value then the A.jsp page will depend on the value return to retrieve the database. i know how to make request but i not sure is how the server will send back the value to the A.jsp??
can anyone give me concept of this. thank you for the help that pour to me. thank you

regards,
albert





your first page is a.jsp right? key in the fallowing code it may help u out in ur problem.

<--a.jsp-->
java.sql.ResulSet result=session.getAttribute("result");

if(result!=null)
{
//write the code here to display result object in jsp
<table><tr><td>reult.getString(1)</td></tr></table>
}
else
{
//write the code here to display 2 combobox
<form action="./actionServlet" method="post">
<select combo1>
<select combo2>
</form>
}


Regards
Ananth
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i get it ups now. thanks everyone here for giving me so much suggestion and help

thank you
 
reply
    Bookmark Topic Watch Topic
  • New Topic