0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SalesCubeでテーブルから取得したidとnameをプルダウンに反映させる方法

Posted at

WarehouseService.java に下記メソッドが実装されているとする。

public List<WarehouseJoin> hhooggee() throws ServiceException {
	try {
		return this.selectBySqlFile(WarehouseJoin.class,
				"warehouse/test.sql").getResultList();
	}catch (Exception e) {
		throw new ServiceException(e);
	}				
} // function

test.sql は下記のとおりである。

SELECT
  WAREHOUSE_CODE
  ,WAREHOUSE_NAME
  ,WAREHOUSE_ZIP_CODE
  ,WAREHOUSE_ADDRESS_1
  ,WAREHOUSE_ADDRESS_2
  ,WAREHOUSE_TEL
  ,WAREHOUSE_FAX
  ,MANAGER_NAME
  ,MANAGER_KANA
  ,MANAGER_TEL
  ,MANAGER_FAX
  ,MANAGER_EMAIL
  ,WAREHOUSE_STATE
  ,CRE_FUNC
  ,CRE_DATETM
  ,CRE_USER
  ,UPD_FUNC
  ,UPD_DATETM
  ,UPD_USER
FROM
	WAREHOUSE_MST_TRADE

このとき、InputPOrderAction.java から、下記のように呼び出すとよい。

List<WarehouseJoin> nagoya = warehouseService.hhooggee();
int sszz = nagoya.size();
java.lang.System.out.println("yamatoken いんとさいず: " + sszz );						

this.yamatoList.clear();
for(int i=0 ; i < sszz ; i++){
	LabelValueBean bean = new LabelValueBean( nagoya.get(i).warehouseName , nagoya.get(i).warehouseCode );
	this.yamatoList.add(bean);
}

ビュー側は下記のようにしておく。

<html:select property="ctaxRate" styleId="ctaxRate" tabindex="107" style="width: 135px;" onchange="changeTaxRate()">
    <html:options collection="yamatoList" property="value" labelProperty="label"/>
</html:select>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?