Top > SAStrutsあれこれ > お次は住所情報のリストをXMLで返してみましょう
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 
 
 
 
 
 
 
 
 
-
|
|
|
|
!
import tutorial.dto.Addresses;
===================================
    /**
     * 住所情報のリストをXMLで返します
     * @return
     * @throws IOException
     * @throws JAXBException
     */
    @Execute(validator = false)
    public String index2() throws IOException, JAXBException {
        Addresses addresses = new Addresses();
        addresses.addressList = addressService.findAll();
        sendXML(Addresses.class, addresses);
        return null;
    }

Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 
 
 
 
 
 
 
 
-
|
|
|
!
package tutorial.dto;
 
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import tutorial.entity.Address;
 
@XmlRootElement(name="Addresses")
public class Addresses {
    
    @XmlElement(name="Address")
    public List<Address> addressList;
}
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Addresses>
    <Address>
        <id>1</id>
        <name>STREET 1</name>
        <version>1</version>
    </Address>
    <Address>
        <id>2</id>
        <name>STREET 2</name>
        <version>1</version>
    </Address>
    <Address>
        <id>3</id>
        <name>STREET 3</name>
        <version>1</version>
    </Address>
    <Address>
        <id>4</id>
        <name>STREET 4</name>
        <version>1</version>
    </Address>
    <Address>
        <id>5</id>
        <name>STREET 5</name>
        <version>1</version>
    </Address>
    <Address>
        <id>6</id>
        <name>STREET 6</name>
        <version>1</version>
    </Address>
    <Address>
        <id>7</id>
        <name>STREET 7</name>
        <version>1</version>
    </Address>
    <Address>
        <id>8</id>
        <name>STREET 8</name>
        <version>1</version>
    </Address>
    <Address>
        <id>9</id>
        <name>STREET 9</name>
        <version>1</version>
    </Address>
    <Address>
        <id>10</id>
        <name>STREET 10</name>
        <version>1</version>
    </Address>
    <Address>
        <id>11</id>
        <name>STREET 11</name>
        <version>1</version>
    </Address>
    <Address>
        <id>12</id>
        <name>STREET 12</name>
        <version>1</version>
    </Address>
    <Address>
        <id>13</id>
        <name>STREET 13</name>
        <version>1</version>
    </Address>
    <Address>
        <id>14</id>
        <name>STREET 14</name>
        <version>1</version>
    </Address>
</Addresses>

リロード   新規 編集 凍結解除 差分 添付 複製 名前変更   ホーム 一覧 単語検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS
Last-modified: 2012-08-08 (水) 23:26:11 (2923d)