struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adam pinder <apin...@hotmail.co.uk>
Subject RE: Struts2 JQuery select box
Date Thu, 04 Mar 2010 14:05:01 GMT

 

can you not call javascript with an onchange and do ajax call in javascript to action class
... i guess it depends on what ajax stuff you're doing but i have done it that way.

 

good luck

 

adam


 
> Date: Thu, 4 Mar 2010 05:18:09 -0800
> From: nani2ratna@gmail.com
> To: user@struts.apache.org
> Subject: RE: Struts2 JQuery select box
> 
> 
> I was using normal select only.
> But now i need to do ajax stuff when user change the select box.
> So jquery is doing this stuff.First i tried with two select boxes.
> Then i tried to do atleast on select box.
> Even one select box also not working.
> Now I have to use this jquery select box to complete this task fast.
> or else i need to write so much code to do this task.
> 
> Thanks
> RS
> 
> 
> adam pinder wrote:
> > 
> > 
> > 
> > why did you choose to use jquery rather than just normal struts select and
> > let the action class create an array of objects (i use an object that has
> > a key/value pair)
> > 
> > i haven't used jquery but not sure what extra it adds.
> > 
> > adam
> > 
> > 
> > ----------------------------------------
> >> Date: Thu, 4 Mar 2010 04:29:15 -0800
> >> From: nani2ratna@gmail.com
> >> To: user@struts.apache.org
> >> Subject: Struts2 JQuery select box
> >>
> >>
> >> Hi,
> >>
> >> I am trying to use http://code.google.com/p/struts2-jquery/ for loading
> >> select box.
> >> I just followed this link
> >> http://www.weinfreund.de/struts2-jquery-showcase/index.action#.
> >>
> >> Every thing is executing fine.
> >> But the list not loading properly.
> >> I am new to JSON.
> >>
> >> I changed below jsp page which was working fine with normal select box.
> >>
> >> my code is
> >>
> >> JSP
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> > 
> >>> theme="simple" cssClass="form1">
> >> 
> > 
> >> Product Master Description Details
> >> 
> > 
> > 
> >> 
> > 
> > 
> >> 
> > 
> > 
> >> 
> > 
> >> 
> > 
> > 
> >> 
> > 
> > 
> >> 
> > 
> >> readonly="true"/>
> > 
> >> 
> > 
> >> 
> > 
> > 
> >> 
> > 
> > 
> >> 
> > 
> >> readonly="true"/>
> > 
> >> 
> > 
> >> 
> > 
> > 
> >> 
> > 
> > 
> >> 
> > 
> > 
> >> 
> >>> listKey="prodcat" listValue="prodcat_desc"
> >> key="prodmDatPm.website_category"
> >> value="prodmDatPm.website_category">
> >> 
> > 
> >> 
> > 
> >> 
> >> 
> >> 
> >>
> >>
> >> Above jsp got almost 100 fields. I just trancated it.
> >>
> >>
> >> Action:
> >>
> >>
> >> import java.util.ArrayList;
> >> import java.util.List;
> >>
> >> import org.apache.struts2.convention.annotation.Action;
> >> import org.apache.struts2.convention.annotation.Actions;
> >> import org.apache.struts2.convention.annotation.ParentPackage;
> >> import org.apache.struts2.convention.annotation.Result;
> >>
> >> import co.za.xxx.ecm.actions.EcmAction;
> >> import co.za.xxx.ecm.business.vo.masterFile.PmProdCat;
> >> import co.za.xxx.ecm.service.productmaster.ProdmDatPmService;
> >>
> >> @ParentPackage(value = "pm-json")
> >> public class JsonAction extends EcmAction {
> >>
> >> /**
> >> *
> >> */
> >> private static final long serialVersionUID = -3858830120549401006L;
> >>
> >> private List prodCatList;
> >> private ProdmDatPmService prodmDatPmService;
> >>
> >> public List getProdCatList() {
> >> return prodCatList;
> >> }
> >> public void setProdCatList(List prodCatList) {
> >> this.prodCatList = prodCatList;
> >> }
> >> public ProdmDatPmService getProdmDatPmService() {
> >> return prodmDatPmService;
> >> }
> >> public void setProdmDatPmService(ProdmDatPmService prodmDatPmService) {
> >> this.prodmDatPmService = prodmDatPmService;
> >> }
> >>
> >> @Actions( {
> >> @Action(value = "/JsonAction", results = {
> >> @Result(name = "success", type = "json")
> >> })
> >> })
> >> public String execute(){
> >> System.out.println("This is execute method in json action calss");
> >> prodCatList = new ArrayList();
> >> prodCatList = prodmDatPmService.getProdCatList();
> >> System.out.println(prodCatList);
> >> return SUCCESS;
> >> }
> >>
> >> public String getJSON()
> >> {
> >> System.out.println("This is getJSon method in json action calss");
> >> return execute();
> >> }
> >> }
> >>
> >> Struts.xml
> >>
> >> 
> >>
> >> 
> >>
> >>
> >>
> >> When jsp loading, its calling my action class.
> >> Action class calling service class and loading list into prodcatList.
> >> But its not getting into list box.
> >>
> >> Can anybody please explain whats the problem is.
> >>
> >> Thanks in advance
> >> RS
> >> --
> >> View this message in context:
> >> http://old.nabble.com/Struts2-JQuery-select-box-tp27780125p27780125.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >> 
> > _________________________________________________________________
> > Do you have a story that started on Hotmail? Tell us now
> > http://clk.atdmt.com/UKM/go/195013117/direct/01/
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://old.nabble.com/Struts2-JQuery-select-box-tp27780125p27780606.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  
_________________________________________________________________
Got a cool Hotmail story? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message