struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nani2ratna <nani2ra...@gmail.com>
Subject Struts2 JQuery select box
Date Thu, 04 Mar 2010 12:29:15 GMT

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
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
	<head>
	  <sj:head jqueryui="true" locale="za" jquerytheme="smoothness"/>
	</head>
	<body>
<div class="loginmodules">
<s:form action="updatePMDetails" id="updatePMDetails" namespace="/secure"
theme="simple" cssClass="form1">
	<fieldset class="form1bg">		
 	<legend>Product Master Description Details</legend>
 		<dl>
			<dt><s:actionerror cssClass="error"/> </dt>
			<dd><s:fielderror cssClass="error"/> </dd>
		</dl>
	 	<dl>
	 		<dt><s:label id="label_skuid" key="pminfo.skuid"/></dt>
			<dd><s:textfield title="SKUID tooltip" id="skuid" name="prodmDatPm.skuid"
readonly="true"/></dd>
		</dl>
		<dl>
			<dt><s:label id="label_prodcat" key="pminfo.prodcat"/></dt>
			<dd><s:textfield id="prodcat" name="prodmDatPm.prodcat"
readonly="true"/></dd>
		</dl>
		<dl>
			<dt><s:label id="label_websitecate" key="pminfo.website_category"/></dt>
			<dd>
				<s:url id="remoteurl" action="JsonAction"/> 
				<sj:select href="%{remoteurl}" cssClass="category" list="prodCatList"
listKey="prodcat" listValue="prodcat_desc"
				key="prodmDatPm.website_category"
value="prodmDatPm.website_category"></sj:select>
			</dd>
		</dl>
<s:form>
</body>
</html>


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<PmProdCat> prodCatList;
	private ProdmDatPmService prodmDatPmService;

	public List<PmProdCat> getProdCatList() {
		return prodCatList;
	}
	public void setProdCatList(List<PmProdCat> 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<PmProdCat>();
		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

<package name="pm-json" extends="json-default">
    
    </package>



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


Mime
View raw message