導航:首頁 > 編程語言 > jsffacesconfig

jsffacesconfig

發布時間:2024-12-12 09:54:44

jsF中 face-config 中的 managed bean 能不能自動生成啊

可以自動生成,不需要在faces-config.xml裡面配置。在Bean的類前面加:
@ManagedBean
@RequestScoped
這樣系統會自動知回道這個類是一個答託管Bean,可以在頁面直接引用它的屬性,在相關事件里直接調用它的方法。

㈡ JSF中<h:form>和<h:datatable>的區別

<h:form> 是表單,提交用的.
<h:datatable> 是取數據用的.和Table差不多.但是它有自動循環功能
<h:dataTable value="#{User.list}"> 他可以自動循環返回的LIST

沒<h:form>照樣的能表布局.但是你提交不了表數據..就和HTML的form差不多
//--------------補充部分代碼-------------
faces-config.xml 代碼
<managed-bean>
<description>
Response for identify the user accessing this application.
</description>
<managed-bean-name>User</managed-bean-name>
<managed-bean-class>com.nsc.reporter.action.User</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

xhtml 部分代碼
<rich:dataTable value="#{User.list}" var="l" rowKeyVar="rekeyVar"> //自動循環User類 裡面的 list
<h:column rendered="true">
<h:outputText value="#{l.username}"/>
</h:column>
<h:column >
<h:outputText value="#{l.password}"></h:outputText>
</h:column>
</rich:dataTable>

//java 部分代碼
private Use use;
private List<Use> list;

public User() {
list =new ArrayList<Use>();
for(int i=0;i<6;i++){
Use use =new Use();
use.setUsername("username"+i);
use.setPassword("pwd"+i);
list.add(use);
}
}

㈢ jsf導航配置文件的問題

我們的是直接配置一個filter.xml文件。希望對你有所幫助。
<!-- filters.xml starts -->
<!-- context-params.xml does not work. put here -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>

<context-param>
<param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
<param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</param-value>
</context-param>

<context-param>
<param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
<param-value>/faces/myFacesExtensionResource</param-value>
</context-param>

<context-param>
<param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/模塊一.xml,
/WEB-INF/模塊二.xml, /WEB-INF/模塊三.xml
</param-value>
</context-param>

<context-param>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
<!--
<description>
This parameter tells MyFaces if javascript code should be allowed in the
rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default: "true"
</description>
-->
</context-param>

<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
<!--
<description>
This parameter tells MyFaces if javascript code should be allowed in the
rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default: "false"

Setting this param to true should be combined with STATE_SAVING_METHOD "server" for
best results.

This is an EXPERIMENTAL feature. You also have to enable the detector filter/filter mapping below to get
JavaScript detection working.
</description>
-->
</context-param>

<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING_METHOD</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
<!--
<description>
If true, rendered HTML code will be formatted, so that it is "human readable".
i.e. additional line separators and whitespace will be written, that do not
influence the HTML code.
Default: "true"
</description>
-->
</context-param>

<context-param>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
<!--
<description>
If true, a javascript function will be rendered that is able to restore the
former vertical scroll on every request. Convenient feature if you have pages
with long lists and you do not want the browser page to always jump to the top
if you trigger a link or button action that stays on the same page.
Default: "false"
</description>
-->
</context-param>

<!-- WelcomeFile Filter -->
<!--
<filter>
<filter-name>WelcomeFile Filter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.WelcomeFileFilter</filter-class>
<description>
Due to the manner in which the JSP / servlet lifecycle
functions, it is not currently possible to specify default
welcome files for a web application and map them to the
MyFacesServlet. Normally they will be mapped to the
default servlet for the JSP container. To offset this
shortcoming, we utilize a servlet Filter which examines
the URI of all incoming requests.
</description>
</filter>
-->

<!-- JavaScriptDetector Filter -->
<!--
<filter>
<filter-name>javascriptDetector</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.JavaScriptDetectorFilter</filter-class>
</filter>
-->

<filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>200m</param-value>
</init-param>
<init-param>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
</init-param>
</filter>

<filter>
<display-name>Ajax4jsf Filter</display-name>
<filter-name>ajax4jsf</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
<init-param>
<param-name>forceparser</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<!-- filters.xml ends -->

閱讀全文

與jsffacesconfig相關的資料

熱點內容
無法創建cad圖紙集文件 瀏覽:788
紙質文件轉換電子版 瀏覽:807
矩陣鍵盤掃描程序原理 瀏覽:986
怎麼開發高級編程 瀏覽:530
政府的拆遷紅頭文件在哪裡找 瀏覽:600
xp串口工具 瀏覽:469
反射javaforname區別 瀏覽:249
java添加計時器和圖片 瀏覽:452
shell編輯文件內容 瀏覽:614
u盤驅動在哪個文件夾里 瀏覽:938
華為手機跟蘋果手機怎麼克隆app 瀏覽:172
cad文件為什麼顯示文件名是否正確 瀏覽:174
程序配置文件能自動轉換成txt 瀏覽:985
r4燒錄卡不同版本 瀏覽:962
怎麼升級qq群為2000 瀏覽:347
微信己冊除的文件怎樣找回來 瀏覽:715
蘋果美國賬號共享2017 瀏覽:252
ps文件修改後打開還是原圖 瀏覽:220
燒卡機蘋果4微信qq哪裡下載 瀏覽:780
ug120找不到指定文件 瀏覽:522

友情鏈接