Paradigm Shift Design

ISHITOYA Kentaro's blog.

include先のページ操作

メモ

include先のページをどうやって操作するんだろうと思ったら,簡単にできるらしい.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:te="http://www.seasar.org/teeda/extension" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="/stuvie/css/index.css"/>
<title>Stuvie</title> 
</head>
<body>
<te:include te:src="/common/lectureList.html" />
</body></html>

として,

public class IndexPage extends AbstractCrudPage{
  private LectureListPage lectureListPage;
  public IndexPage(){
  }

  public Class prerender() {
    this.lectureListPage.setTest("from study");
    return null;
  }
	
  public LectureListPage getLectureListPage() {
    return lectureListPage;
  }

  public void setLectureListPage(LectureListPage lectureListPage) {
    this.lectureListPage = lectureListPage;
  }
}

と,LectureListPageを定義してgetter/setterを定義しておけば,Includeしているページをいじれるようになる.


teeda-html-exampleのexamples.teeda.web.includeを参照のこと.