In my web-application I have a the following requirement.
I need to have a dropdown for country.
Based on the country selected I need to display the corresponding states.
I need to fetch both the country and state from database.
I cant use javascript since in production(live), javascript will be disabled.
I guess I have to use ajax to implement this?
Can anyone please tell if there is any better way to implement the above requirement?
I have seen the following link.
Populating cascading dropdown lists in JSP/Servlet
But I dont like to use javascript (since my client will disable javascript in Production environment)
I cant use javascript since in production(live), javascript will be disabled.
Can't use javascript than you would have to refresh the page i.e.:
Select Country from drop-down
Provide a link or button to submit this value (click on this)
Server call, which will retrieve the Country values and also the State values for the country selected
display the JSP with the values retrieved and make the Country which was submitted pre-selected in the drop-down.
I guess I have to use ajax to implement this?
Now my friend you are contradicting your own self, because ajax (I am sorry to say this) is nothing but javascript, it is not some different language than javascript.
Related
Could someone give me an example how to use celltable in case I would like to change url?
I have a simple celltable -
On session select I would like to change url to something like this -
localhost#main?sessions=20,21
I have already read about placeControllers and etc.
But I don't find any example of using url with parameters.
What I have to do when select event is calling?
What I have to do when place(history) event is calling?
Using history token in GWT is quite simple, just read little bit about it here.
Basically when you want to change history token, just build string you want and use History.newItem(token). Not sure what do you want to do afterwards, but usually you have to register handler with History.addValueChangeHandler() to react to new "state"
To find out actually selected items, you need kind of selection model. But not sure when do you want to trigger the change..
Suppose that selected the one value in drop down list, then after selection of value in drop down list same drop down list regenerated again in same JSP Page(as a previous drop down list).
How is to possible? How to do it?
Hard way of doing it
http://jsfiddle.net/daWd9/
Suppose consider that your source dropdown list id is 'list1'. By using document.getElementById('list1') you'll get the details of that element. Then use document.createElement to create a new dropdown list and get the properties from the existing one document.getElementById('list1').
I suppose, you have to select multiple values from same options.
I would have done it using jQuery UI. Please follow the link for demo http://jqueryui.com/demos/autocomplete/#multiple .
Open the link.
Start typing in textbox, options will auto-populate.
You can select one and again start typing.
It will be a good user-friendly solution, in my opinion.
Hope it helps.
There two solutions documented in StackOverflow using AJAX technology
How to call AJAX request on dropdown change event?
How to call AJAX request on dropdown change event?
Please see the above will help you.
By the way I don't understand why you need to
regenerate again in same JSP Page(as a previous drop down list).
I have been developing an AJAX web application using GWT. I've read several blogs and forums about this question and left with no clear idea. I understand that GWT is an AJAX application, that supports only stand-alone web application. By stand-alone, I meant GWT to be a single web page that would suffice the user requirements. However the use case I have is pretty complex and I'm stuck in this use case that doesn't let me proceed.
My usecase(s) goes like this:
Usecase #1: There is an order entry form where user will enter a search string to search for a particular item. With GWT, I could display the result in a table (say celltable). However, when I click a column in the cellTable, I want the value of the column to be sent to the server and display another page that will display only the details of the selected column. I'm not sure how to accomplish this.
Usecase #2: Let's say the web application I develop is called "InventoryControl" and I have different requirements such as:
display Available stock
display Order stock
display Manufactured unit
and Using Java servlets, I could just type http://localhost/availableStock?stockId=1234 on my browser to get the "Display available stock" for the given stockId and then http://localhost:orderStock?stockId=1234 to get the "display order stock" and similarly "display manufactured unit". Is the same possible using GWT? i.e. when I type http://localhost/availableStock?stockId=1234, is it possible to read the parameter being passed and then display the corresponding page?
If these are not meant to be guaranteed by GWT, should I stick with Plain old JAVA servlets/JSP?
Thanks in advance.
Ashok - Please note, what filip suggests above does not require multiple "pages" in the sense of additional html host pages. You can build a panel holding your display of the details, and swap it into the rootpanel of your host in the onSuccess() of your rpc call. The GWT history mechanism allows you to assign anchors to these "places" and provide a mechanism to map these anchors to specific display classes in your code.
GWT already has a mechanism for handling multiple page applications. Have a look at Activities and Places. You can define each page as a place in your application, and use the GWT mechanism to go from place to place at any time. Using places also allows you to easily add tokens/query parameters to each "page", in an OO manner, without having to worry about populating/querying the URL directly. Have a good read of the link!
There is a website,and it has a button on click checks for the value in the textbox and searches for it and displays the result.
How can i with my java code,prove the input and display the appropriate result on my java code.
On seeing the source of the website,i get to know the methods that gets called on the button click.But what and how to further trigger the event and pass the value to textbox and obtain the resut !!
Use a programmatic web browser like HtmlUnit.
I'm not 100% clear on what you're asking for, but it sounds to me like you're trying to get some sort of client-interaction emulation/automation.
Check out Selenium's Java API
I want simple java code that enables submission of same/similar data to multiple websites at a time...All the values are initially asked from the user, and just before submission, only multiple choice values (like radio buttons) and captchas are shown on screen. After the user has filled in these values all forms are submitted.
Is it possible to do this in
(a) Regular java application
(b) Google App ENgine Java application
Also some sites require new user to register and then login, only after that multiple form submission has to be done. Can this be implemented in java and how?
Regards,
Arvind.
You can use Ajax to submit multiple forms.
In the URL below, the author uses Jquery and AJAX with PHP to do it.
Use the same concept using JSP and you should be good.
http://www.9lessons.info/2009/06/submit-multiple-forms-jquery-ajax.html