2014-09-17 4 views
0

나는 태피스 트리에 웹 응용 프로그램을 쓰고 있습니다. 내 응용 프로그램에서 친숙한 URL을 사용하고 싶습니다. 지금은이 같은 URL 페이지를 렌더링 할 수 있어요 : 내가하고 싶은Tapestry 5.4 URL 재 작성 및 SEO URL

http://localhost:8080/page/page-name 

와트는 다음과 같이 URL을 렌더링하는 것입니다

http://localhost:8080/page-name 

모든 페이지는 PostgreSQL을 DB에 저장됩니다. 내가 현재 태피스트리 5.4-beta16을 사용하고 있는데 이미 태피스트리 설명서를 읽었습니다 : 지금

http://tapestry.apache.org/url-rewriting.html

http://blog.tapestry5.de/index.php/2010/09/06/new-url-rewriting-api/

을,이 목록의 클래스 DB를 (만에 저장된 모든 페이지입니다

: 시험)에 대한

public class Pages { 

    @Inject 
    private Session session; 

    @Property 
    List<it.garuti.tapestrycms.entities.Pagine> pagine; 

    @Property 
    private it.garuti.tapestrycms.entities.Pagine pagina; 


    void setupRender() { 

     pagine = session.createCriteria(it.garuti.tapestrycms.entities.Pagine.class).list(); 

    } 

} 

그리고이 쇼의 클래스는 페이지 내용입니다

마지막 페이지의 엔티티 :

@Entity 

@Table(name = "pages", schema = "public") 
public class Pages implements Serializable { 

@Id 
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "pagine_seq") 
@SequenceGenerator(name= "pagine_seq", sequenceName = "pagine_id_seq") 
@Column(name = "id", unique = true, nullable = false) 
private long id; 

@Column(name = "titolo", nullable = false, length = 60, unique = true) 
private String titolo; 

@Column(name = "slug", nullable = false, length = 60, unique = true) 
private String slug; 

@Column(name = "contenuto", nullable = false, columnDefinition = "TEXT") 
private String contenuto; 

@Column(name = "data_creazione", nullable = false) 
private Date dataCreazione; 

@Column(name = "data_modifica") 
private Date dataModifica; 

@Column(name = "stato", nullable = false) 
private String stato; 

@ManyToOne(fetch = FetchType.LAZY) 
@JoinColumn(name = "utente_id", nullable = false) 
private Users user; 

getter and setter... 
.... 
} 

탱크 당신 로렌조

답변

1

태피스트리의 특별한 경우는 페이지 클래스 이름 Index이있는 경우는 URL의 페이지 이름이 포함되지 것있다 . 따라서 클래스 이름을 Page으로 변경하면 Index으로 바뀝니다. 명시 적 URL 재 작성을하지 않고도 원하는 것을 얻을 수 있다고 생각합니다.

+0

탱크 랜스 이것은 모든 간단한 솔루션이며 완벽하게 작동합니다. –