当前位置:首页 » 文件管理 » jsf上传文件

jsf上传文件

发布时间: 2024-11-30 20:08:48

① 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 -->

② JSPX和JSFF文件类型之间的区别ADF框架内

JSFF用于在自动进稿器JSPX页面片段被用于常规JSF页面
你可以有JSFF内ADF taskflows然后将它们包括内部JSPX页面。
jsff不是一个可运行的目标。如果你想运行此页应该包括内部JSPX页面。 一个更重要的一点是,当我们使用ADF任务流,我们使用jsff片段
或者可以说是: -
.jspx页面JSP / XML表示 ,它是一个独立的页面,这意味着它可以在没有任何支持或基页运行。 Jdeveloper中11克Release1支持.jspx页面,但这不是在JDeveloper11克Release2,Release2支持Facelets的意思.jsf( 明确的是,.jsf和.jsff是不一样的东西)。

.jsff(JSF片段)页是JSF的一个片段(Java服务器面)页,有时页变得过于复杂和大,这是不容易编辑这些页,在这种情况下,它应该在一些片段来分割。 JSF页面可以在一些规模较小的页面片段被打破,以避免在编辑的困难和保持页面片段不能独立运行,它需要.jsf(JSF页)或 .jspx的基础(JSP / XML)页面
注: - (.jsf和.jsff是不一样的东西)
.jsf VS .jspx
JSPX是按照惯例,一个JSP / XML表示,而.jsf是约定一个个小面表示。 无论是“更兼容”,但Facelets的是推荐的方式前进,只要你是在11.1.2或更高版本。
11.1.2.x使用.jsf为默认值(为Faclets),其中作为11.1.1.x使用.jspx
一般的Facelets被认为是更好的性能,因为它是更严格的集成与JSF lifcycle,也不需要运行前被编译
JSPX文档和Facelets的机器人支持JDeveloper中11克R2和我们equallly支持它们的功能(双方存在非常小的差异)
JSPX文件在JDeveloper11克R1的唯一选择
JSFF用于页面片段,而JSPX用于普通自动进稿器的网页,在技术上也可以使用JSPX作为页面片段。 当您使用JDeveloper向导创建一个页面片段,默认的扩展名将会jsff。
据甲骨文文件“没有特殊理由使用.jsff较完整的JSF页面和页面片段时,你的工作在Application Navigator在JDeveloper之间的快速分化等。”

③ 跪求jsf文件上传例子。。

这个还真做过
界面
<h:form id="upLoadExcel" enctype="multipart/form-data" >
请选择Excel文件   <t:inputFileUpload id="fileupload"
value="#{ExcelListBean.upFile}"
storage="file"
maxlength="200000"/>
<f:verbatim></f:verbatim><br></br><br></br>
<h:commandButton value="提交EXCEL" action="#{ExcelListBean.addWhiteList}" styleClass="formStylebutton" type="submit" />
</h:form>

后台
导的是这个文件
import org.apache.myfaces.custom.fileupload.UploadedFile;
好像要导三个jar..
myfaces-api-1.1.5.jar
myfaces-extensions-1.0.9.jar
myfaces-impl-1.1.5.jar

javax.servlet.ServletContext sc=(javax.servlet.ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext();
String trace=sc.getRealPath("/")+saveName;
System.out.println(".............URL: "+trace);
FileOutputStream fileOutputStream =
new FileOutputStream(trace); //上传的文件写服务器目录
while (in.read(buffer) > 0) {
fileOutputStream.write(buffer);
}

热点内容
android手机装linux 发布:2024-12-01 00:35:14 浏览:1
php模块配置 发布:2024-12-01 00:30:00 浏览:95
九成脚本 发布:2024-12-01 00:23:33 浏览:815
存储内存和运行内存的区别 发布:2024-12-01 00:03:39 浏览:253
编译状态图原理 发布:2024-11-30 23:54:22 浏览:738
谷歌搜索缓存服务器地址 发布:2024-11-30 23:38:59 浏览:503
箍筋加密原因 发布:2024-11-30 23:33:38 浏览:416
千兆路由器有哪些配置 发布:2024-11-30 23:33:36 浏览:411
产品配置具体指哪些 发布:2024-11-30 23:28:21 浏览:16
apt编译环境 发布:2024-11-30 23:28:12 浏览:382