You are here
Home > Programming > Java > Struts2 > Tutorial Produce Consume JSON Apache Struts2

Tutorial Produce Consume JSON Apache Struts2

Tutorial Produce Consume JSON Apache Struts2
  • Tambahkan class sebagai objek action dengan nama “ConsumeAction” di package “com.wijaksana.belajar.struts2.action” dan tambahkan implements ServletRequestAware (org.apache.struts2.interceptor.ServletRequestAware), berikut fullscriptnya:
  • Tambahkan class sebagai objek action dengan nama “ProduceAction” di package “com.wijaksana.belajar.struts2.action”, berikut fullscriptnya:
  • Buka file struts.xml (src/main/resources), replace script didalam tag <struts> dengan script dibawah ini:
  • Tambahkan file “consume.html” (src/main/webapp), replace dengan script dibawah ini:
  • Tambahkan file “index.jsp” (src/main/webapp/WEB-INF), replace dengan script dibawah ini:
  • Tambahkan file “result.jsp” (src/main/webapp/WEB-INF), replace dengan script dibawah ini:
  • Selesai, bisa kita test sekarang
  • Klik kanan project name >> Run As >> Maven Build… >> pada isian goals ketik “jetty:run” >> klik RUN
  • Buka browser http://localhost:8080
  • Selamat mencoba,

    salam berbagi,
    wijaksana

    Leave a Reply

    Top