ボタンによるページの移動に問題があります。
私の現在のxhtmlスニペットは次のようなものです:
<p:layoutUnit position="west" size="200" header="Menü" resizable="true" closable="true" collapsible="true">
<p:column>
<p:commandButton type="button" value="New Project" icon="ui-icon-document" action="#{createProject.create()}"/>
<p:commandButton type="button" value="All Projects" icon="ui-icon-folder-open"/>
<p:commandButton type="button" value="Edit" icon="ui-icon-pencil"/>
<p:commandButton type="button" value="Delete" icon="ui-icon-closethick"/>
<p:separator />
<p:commandButton type="button" title="Yazdır" icon="ui-icon-print"></p:commandButton>
</p:column>
</p:layoutUnit>
ここで、[新しいプロジェクト] をクリックしても、関連するページに移動しません。
私のビーンファイル:
@ManagedBean
@RequestScoped
public class CreateProject {
/**
* Creates a new instance of CreateProject
*/
public String create() {
return "newproject.xhtml";
}
}
ボタンがクリックされたときにユーザーをナビゲートするにはどうすればよいですか?
編集:これが私のfaces-configです
<faces-config
version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<managed-bean>
<managed-bean-name>loginBean</managed-bean-name>
<managed-bean-class>com.ibb.source.LoginBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>myProjects</managed-bean-name>
<managed-bean-class>com.ibb.source.MyProjects</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>myCalendar</managed-bean-name>
<managed-bean-class>com.ibb.source.MyCalendar</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/panel.xhtml</from-view-id>
<navigation-case>
<from-outcome>create</from-outcome>
<to-view-id>newproject.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>createProject</managed-bean-name>
<managed-bean-class>com.ibb.source.CreateProject</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>inPlaceEditor</managed-bean-name>
<managed-bean-class>com.ibb.source.InPlaceEditor</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>projectsList</managed-bean-name>
<managed-bean-class>com.ibb.source.ProjectsList</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>panel.xhtml</from-view-id>
<navigation-case>
<from-outcome>newproject</from-outcome>
<to-view-id>/newproject.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>allProjects</managed-bean-name>
<managed-bean-class>com.ibb.source.AllProjects</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>allProjectsList</managed-bean-name>
<managed-bean-class>com.ibb.source.AllProjectsList</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>