导航:首页 > 编程语言 > 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相关的资料

热点内容
国外对社交网络交流特性的研究 浏览:860
java写入txt文件覆盖 浏览:74
橙什么网站 浏览:707
钉钉文件包传给微信 浏览:274
iphone4s运行ios84 浏览:906
word文件不难修改 浏览:626
苹果手机中有些特别的表情符在哪 浏览:802
网络语滂是什么意思 浏览:625
js上传文件名 浏览:707
jshtml生成图片插件下载 浏览:220
java创建一个html文件 浏览:309
光盘文件读取文件格式 浏览:482
黑莓q30安装程序至内存卡 浏览:216
java判断object为null 浏览:119
看美女的app哪个好 浏览:812
linux系统管理员面试 浏览:880
海报源文件是什么 浏览:168
c编程怎么写使用次数 浏览:733
word类型doc文件怎么打开 浏览:630
论文你是怎么进行数据分析的 浏览:563

友情链接