If it's an array of strings, you don't need to have *anything*--the property tag will display the top-most value stack value by default. If the cities are an object, the property tag's value attribute should be the name of the city property you want to display.

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336

posted Feb 16, 2010 09:13:12

0

It is an Arrayist of objects like...

say Australia,
sydney,hobart,Adelaide...

so now what would property take as I have put hem in a session and iterate?

If the cities are an object, the property tag's value attribute should be the name of the city property you want to display.

That tells me nothing about what kind of objects they are. Are they strings or not?

like this?
this doesn't work !!!

Correct, it doesn't, because you're using random expressions to try to get it to work, instead of doing what I told you to.

If the objects in the list are strings you don't *need* a "value" attribute in your property tag. If they're objects *containing* a string with the city name, then the "value" attribute should be the name of the object property containing the city's name.

So how is the map being filled? It'd be a *lot* quicker if you'd post everything related. It's clearly *something* you're doing wrong, and I'd rather just get it all dealt with at once rather than drag this out over days.

You mean you're trying to populate a field on the page you're on by making an Ajax request?

If so, that most certainly won't work--the entire page you're on is rendered before anything else happens, that's just how web applications and JSP work--everything in the JSP happens on the server side. If you want to make an Ajax request and populate a field on the current page then you'd need to write the JavaScript to actually *do* that.

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336

posted Feb 18, 2010 10:46:42

0

Hey ! Thanks David.Now I know the reason...

The reason why I am making an Ajax request is to get the cities of the country selected! If there are alternative ways then I could be extremely happy to know!

If you want to make an Ajax request and populate a field on the current page then you'd need to write the JavaScript to actually *do* that.

What should be my next step.What should the javascript contain and what will be the way to populate it?

I gave you a direct link to sample code. How much simpler can we make it?

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336

posted Feb 20, 2010 01:46:46

0

Thanks, David and Bear for those inputs.

Like in this example...

Looks superb,you could see a "select.php" there.

I was wondering how it would be in struts2 after having prepared the json object as shown in my code.I was talking about an example with struts2 which I thought I couldn't find out beacause jquery and php(atleast for the example) are unknown to me so still coming to terms with them .

I think i would need to change that "select.php" to "cityAction.action"

Now if I try to modify this according to my one,I could do this...

But I don't know what the above one does...

I am fighting it out and will continue till I do so !!!

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336

posted Feb 21, 2010 22:28:52

0

After the Ajax call is made on selecting the country,I passed the country.Now,I have got this in my Action class...