--- On Fri, 6/13/08, srichin <[EMAIL PROTECTED]> wrote:
> I want the objects id to be the value of the option and
> code to bethe label to be shown in the autocompleter dropdown options.
> 
> I should be shown codes as select options in the dropdown and when I 
> select any of the code, the corresponding id should go as the
> value that has been selected
> 
> Pointers on this would be of great help

I understand what you're trying to do, I don't understand what specific aspect 
you're having a problem with. You said you implemented the action with a 
hard-coded list. An action that uses a database instead is almost exactly the 
same, but it accesses a database instead of using a hard-coded list.

The Struts 2.0 autocompleter docs [1] summarize the usage of the tag; the 
action will be called with the current value in the text box. You use that 
partial value to do a database search (or filter an existing list, or however 
you'll implement that part).

Dave

[1] 
http://struts.apache.org/2.0.11/docs/ajax-tags.html#AjaxTags-autocompleterTag

> newton.dave wrote:
> > 
> > Search a database of city names?
> > 
> > I'm not sure what you're asking.
> > 
> > --- On Thu, 6/12/08, xianwinwin
> <[EMAIL PROTECTED]> wrote:
>>> I have a list of 20,000 cities; I would like the
>>> user to provide at least 2 chars and then present him a'potential
> list'.
> >> 
> >> I managed to do this:
> >> 
> >> JSP
> >> 
> >> <s:autocompleter theme="simple"
> >> list="state"
> name="StateName"/>
> >> 
> >> 
> >> 
> >> Java:
> >> 
> >> public class autocompleter extends ActionSupport
> >> {
> >>   private List state;
> >>   public String execute() throws Exception{
> >>     state = new ArrayList();
> >>     state.add("Bonn");
> >>     state.add("Paris");
> >> .
> >> .
> >> .
> >>  
> >>     return SUCCESS;
> >>   }
> >>   
> >>    public List getState(){
> >>     return state;
> >>   }
> >> }
> >> 
> >> as you can see, the autocompliter is based on the
> >> 'state' I initially
> >> provided. But what if the list is huge???
> >> 
> >> Q: How can I invoke an action once the user types
> a letter
> >> (str) and the
> >> string gets to the invoked-method (based on the
> str the
> >> method will invoke
> >> the appropriate list)
> >> 
> >> thank you!!!
> >> -- 
> >> View this message in context:
> >>
> http://www.nabble.com/struts2%3A-how-to-read-the-%27potenrial-list%27-from-a-database-tp17810726p17810726.html
> >> Sent from the Struts - User mailing list archive
> at
> >> Nabble.com.
> >> 
> >> 
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >> For additional commands, e-mail:
> >> [EMAIL PROTECTED]
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> > 
> > 
> 
> -- 
> View this message in context:
> http://www.nabble.com/struts2%3A-autocompleter---howto-read-the-%27potenrial-list%27-from-a-database-tp17810726p17820863.html
> Sent from the Struts - User mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to