Url rewriting Tapestry 5.4 URL重写和SEO URL

Url rewriting Tapestry 5.4 URL重写和SEO URL,url-rewriting,seo,tapestry,friendly-url,Url Rewriting,Seo,Tapestry,Friendly Url,我正在用tapestry编写一个web应用程序。 在我的应用程序中,我希望使用友好的URL。现在,我可以如下方式呈现url页面: http://localhost:8080/page/page-name http://localhost:8080/page-name 我想做的是呈现如下URL: http://localhost:8080/page/page-name http://localhost:8080/page-name 所有页面都存储在Postgresql数据库中。 我目前正在

我正在用tapestry编写一个web应用程序。 在我的应用程序中,我希望使用友好的URL。现在,我可以如下方式呈现url页面:

http://localhost:8080/page/page-name
http://localhost:8080/page-name
我想做的是呈现如下URL:

http://localhost:8080/page/page-name
http://localhost:8080/page-name
所有页面都存储在Postgresql数据库中。 我目前正在使用Tapestry 5.4-beta16,我已经阅读了Tapestry文档:

现在,这是用于列出数据库中存储的所有页面的类(仅用于测试)

最后是页面的实体:

@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...
....
}
坦克你
Lorenzo

tapestry中有一个特殊情况,当您的页面类具有名称
索引时,它将不在URL中包含页面名称。因此,如果您将类
页面
重命名为
索引
,我认为您将实现您想要的,而无需任何明确的url重写

这是每一个简单的解决方案,它工作得非常完美