-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Dear All,
I wrote a hql query for searching multiple criteria as follows.
@SuppressWarnings("unchecked")
public List<Item> findAllAdvance(String advance) {
String hql = "FROM Item WHERE description = ? and multi = ? and charge = ? ";
return getHibernateTemplate().find(hql, advance);
}
And then wrote a java class and its implementation like this.
public void submit2(){
String advance = ((Textbox)getFellow("advance")).getValue().trim();
Listbox listbox = (Listbox)getFellow("items");
listbox.getItems().clear();
ApplicationContext ctx =
WebApplicationContextUtils.getRequiredWebApplicationContext(
(ServletContext)getDesktop().getWebApp().getNativeContext());
Adminop admin = (Adminop)ctx.getBean("adminop");
List<Item> items = admin.getSearchedItem2(advance);
Iterator<Item> it = items.iterator();
while(it.hasNext()){
Item item = (Item)it.next();
Listitem li = new Listitem();
li.setValue(item);
li.appendChild(new Listcell(item.getFilepath()));
li.appendChild(new Listcell(item.getStrform()));
li.appendChild(new Listcell(item.getDescription()));
li.appendChild(new Listcell(item.getQcmeth()));
li.appendChild(new Listcell(item.getBasisset()));
li.appendChild(new Listcell(item.getInfo()));
li.appendChild(new Listcell(item.getPg()));
li.appendChild(new Listcell(item.getEs()));
li.appendChild(new Listcell(item.getMulti()));
li.appendChild(new Listcell(item.getCharge()));
li.appendChild(new Listcell(item.getEnergy()));
li.appendChild(new Listcell(item.getEnthalpy()));
listbox.appendChild(li);
}
}
The problem is,
If I write the 3 strings, let's say "cysteine 1 0", in the textbox with the id "advance" and run it,
it doesn't recognise it as 3 separated parameters [1] [0] but only as a single parameter [cysteine 1 0].
how could I make it that the strings which I wrote in the textbox can be recognised as 3 parameters, so that hql can know?
Please, Don't cross post.
Only a hint!
If you will write 3 parameters in one line of a textbox! How do you secure the inputs.
If it's not better to do the 3 Parameters in 3 different textboxes?
Asked: 2009-12-10 08:34:10 +0800
Seen: 371 times
Last updated: Dec 10 '09