安卓手機如何打開jsf文件
1. 如何查看自己的jsf版本 PS:項目是現成的,jar包看不出來。
怎麼可能看不出來?
找到JSF的JAR包,從文件名當然看不出來,展開JAR包,看到META-INF,再找到下面的MANIFEST.MF文件,裡面就可以看到版本信息了。
希望對你有所幫助。
2. jsf是什麼文件
JSF主要由兩個部分組成:一套功能強大的API函數,用來表示UI組件、管理組件狀態、處理事件、進行輸入有效性驗證,以及對國際化和可訪問性的支持;一套包含各種頁面元素的並允許自定義的JSP標簽庫,用來在JSP頁面中顯示JSF的界面。通過使用JSF所提供的簡單而又實用的模型,任何開發人員都可以快速輕松地開發Web應用程序。他們可以使用大量現成的可重用的UI組件,並將這些組件與數據源連接,還可以很容易地將客戶端事件和伺服器端的事件處理程序綁定。強大的JSF技術可以很好地處理和管理任何復雜的用戶界面,使開發人員可以將注意力集中在應用程序的開發上。
3. 如何打開isf後綴文件
可以用Notepad++軟體打開isf後綴文件。
工具/材料:以Notepad++、isf後綴文件為例。
1、首先在桌面上,選中isf後綴文件。
4. Android 加入Jquery mobile 頁面問題
這么半天沒人回答,估計是你的描述很多老手也看不懂吧。。。
java頁面?哪來的java頁面?你是指jsp頁面?grails頁面?還是jsf頁面?
activity是指哪個?java web相關結構太多,每個公司用的都不一樣,所以需要你說詳細點
另外架構不同用的東西也不一樣,如果你用的是以前標準的MVC框架,裡面本身就用到servlet來做控制處理,怎麼可能不通過servlet,不過既然你用別的方法能在js裡面調用.java文件的話,那麼我就按你的思路說好了,方法一般情況下有2種:
1、你知道每個方法有返回值吧,所以既然可以調用java的方法,那麼如果你需要在java中的方法中的值,那麼直接在方法中結尾部分用return返回值就好了。(如果你這個方法不是單獨為頁面返回值用的,那麼這個方式不能用)
2、我不知道你用的是什麼結構,但是一般來說,每個結構前台頁面都有自己的獲取後台參數的方法,比如jsf用&{}、grails+jquery+groovy用${}等。不過jsf調用的參數,是後台java類文件中的成員變數,而jquery調用的是後台傳遞的參數(也就是類似return)或者存放到session中的值
你看看你能用哪種吧,如果可以最好把1個前台html頁面和後台你所說的那個含有方法的java代碼拿出來看看
不明白請追問,如果對你有幫助,記得採納~
5. 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 -->
6. JSF日期控制項點擊沒有任何反應,也就是日期控制項的click事件失效,這是怎麼回事
很有可能是瀏覽器不兼容問題。或者是jsf包沖突。IE9就和jsf存在兼容性問題。
建議使用其他瀏覽器測試,或者檢查並升級jsf包文件。
7. jsf字體怎麼轉換成shx字體
在軟體SolidWorks字型檔fonts
和2007CAD字型檔Fonts
還有2012CAD字型檔里的文件都是SHX格式的字型檔文件在網上也可以下載
不需要那麼麻煩的,下載出來放到打標軟體安裝目錄里的Fonts文件里重新打開軟體就可以了。
8. jsf怎麼導出為excel文件
有一個很簡單的方法,不用任何組件就可以導出為Excel:
在jsp頁面的開始部分中加入:
<%
response.setContentType("application/vnd.ms-excel;charset=gbk");
%>
那麼打開這個頁面的時候就會彈出一個下載對話框讓用戶打開或另存Excel文件. 當然Excel文件的格式和頁面是一致的,試試這個:
<%@ page language="java" pageEncoding="gbk"%>
<%
response.setContentType("application/vnd.ms-excel;charset=gbk");
%>
<html>
<body>
<table>
<tr><td>姓名</td><td>性別</td><td>出生日期</td></tr>
<tr><td>張三豐</td><td>男</td><td>2008-8-8</td></tr>
<tr><td>李四花</td><td>女</td><td>2008-12-12</td></tr>
</table>
</body>
</html>
9. jsf中怎麼做導入導出
以Excel導入為例
(記得導入一些包:
import org.apache.myfaces.custom.fileupload.UploadedFile;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellReference;
import com.meadvillegroup.weberp.budget.XlsReader;
)
private UploadedFile teFile;//get&set別忘了
//文件導入
public String uploadTe() {
System.out.println("執行文件導入");
System.out.println(" teFile = " + teFile);
if (teFile==null) {
writeMessage("InputForm:teFile","請選擇需要上傳的文件");
return null;
}
long fileSize = teFile.getSize();
String uploadedFileName = FileUtil.trimFilePath(teFile.getName());
boolean ok = false;
try {
if (fileSize==0) {//文件是空的
writeMessage("InputForm:teFile","無法找到上傳文件"+uploadedFileName);
}else if (fileSize>UPLOAD_LIMIT) {
writeMessage("InputForm:teFile","上傳文件"+uploadedFileName+"太大");
} else {
InputStream is = teFile.getInputStream();
loadFromFile(is);
is.close();
}
ok = true;
} catch (IOException e) {
writeMessage("InputForm:teFile", "上傳異常,請檢查文件並重試");
e.printStackTrace();
} catch (Exception e) {
writeMessage("InputForm:teFile", "上傳出錯,請檢查文件並重試");
e.printStackTrace();
}
System.out.println(" ok = " + ok);
return (ok ? "返回頁面" : null);
}
//讀取文件並上傳
private void loadFromFile(InputStream is) throws Exception {
if(null!=beDetailList){//這個beDetailList是rich:dataTable的List
beDetailList.clear();
}
XlsReader reader = new XlsReader();
HSSFWorkbook wb = new HSSFWorkbook(is);
// [Start] Read Settings
Map<String,Object> settings = new HashMap<String,Object>();
HSSFSheet settings_sheet = (HSSFSheet)wb.getSheet("Settings");
if (settings_sheet!=null) {
for (Iterator rowItr = settings_sheet.rowIterator(); rowItr.hasNext();) {
HSSFRow row = (HSSFRow)rowItr.next();
String key = null;
List<String> valueList = new Vector<String>();
for (Iterator cellItr = row.cellIterator(); cellItr.hasNext();) {
HSSFCell cell = (HSSFCell)cellItr.next();
if (cell.getCellNum()==0) {
if (cell.getCellType()==HSSFCell.CELL_TYPE_STRING) {
key = cell.getRichStringCellValue().getString();
}
} else {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC:
valueList.add(Double.toString(cell.getNumericCellValue()));
break;
case HSSFCell.CELL_TYPE_FORMULA:
case HSSFCell.CELL_TYPE_STRING:
valueList.add(cell.getRichStringCellValue().getString());
break;
default: break;
}
}
}
if (key!=null) {
if (valueList.size()>0) {
settings.put(key, new CellReference(valueList.get(0)));
}
}
}
}
CellReference dataStartRow_cellRef = (CellReference)settings.get("Data.startRow");
CellReference dataEndRow_cellRef = (CellReference)settings.get("Data.endRow");
// for backward-compatibility
if (dataStartRow_cellRef==null) dataStartRow_cellRef = new CellReference("$B$2");//從哪裡開始
if (dataEndRow_cellRef==null) dataEndRow_cellRef = new CellReference("$B$10");//結束(可以看到就讀了8行數據,自己設置大小,不要太大啦,會死機)
// [End] Read Settings
HSSFSheet sheet = (HSSFSheet)wb.getSheetAt(0);
beDetailList = new Vector<BeDetail>();
detailAuxList = new Vector<BeDetailAux>();
double totalLocalAmount = 0;
for (int r = dataStartRow_cellRef.getRow(); r <= dataEndRow_cellRef.getRow(); r++) {
System.out.println("r = " + r);
CellReference applyType_cellRef = new CellReference(r, 1);
CellReference participants_cellRef = new CellReference(r, 2);
CellReference company_cellRef = new CellReference(r, 3);
CellReference purpose_cellRef = new CellReference(r, 4);
CellReference remarks_cellRef = new CellReference(r, 5);
CellReference currency_cellRef = new CellReference(r, 6);
CellReference amount_cellRef = new CellReference(r, 7);
CellReference receipt_cellRef = new CellReference(r, 8);
//下面是從文件中拿到值
//類型
long type=0;
String applyType=(String) reader.getCellValue(sheet, applyType_cellRef);
//參與人
String participants=(String) reader.getCellValue(sheet, participants_cellRef);
//公司
String company=(String) reader.getCellValue(sheet, company_cellRef);
//目的
String purpose=(String) reader.getCellValue(sheet, purpose_cellRef);
//備注
String remarks=(String) reader.getCellValue(sheet, remarks_cellRef);
//貨幣
String currency=(String) reader.getCellValue(sheet, currency_cellRef);
//金額
String amountVo=reader.getCellValue(sheet, amount_cellRef)==null?"0":reader.getCellValue(sheet, amount_cellRef).toString();
//收據單
String receipt=(String) reader.getCellValue(sheet, receipt_cellRef);
//放到一個對象BeDetail裡面
BeDetail be=new BeDetail();
be.setApplyType(type);
be.setParticipants(participants);
be.setCompany(company);
be.setPurpose(purpose);
be.setRemarks(remarks);
be.setCurrency(currency);
be.setAmount(new BigDecimal(df_2dp.format(Double.parseDouble(amountVo))));
be.setReceipt(receipt);
//把一個一個對象BeDetail加到List裡面 beDetailList.add(be);
}
}
裡面還有很多驗證和計算刪掉了,免得眼花。慢慢研究吧
10. 如何使用jsf上傳文件
使用jsf加myfaces的upload插件實現上傳文件的功能
需要的jar包:tomahawk-1.1.6.jar,jsf-impl.jar,commons-fileupload-1.2.jar,commons-io-1.3.2.jar,commons-el-1.0.jar
程序:
package model.map;
import control.MapMDelegate;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import org.apache.myfaces.custom.fileupload.UploadedFile;
public class FileUploadForm {
public FileUploadForm() {
}
private String name;
private UploadedFile upFile;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setUpFile(UploadedFile upFile) {
this.upFile = upFile;
}
public UploadedFile getUpFile() {
return upFile;
}
public String upload() throws IOException {
try {
InputStream in = new BufferedInputStream(upFile.getInputStream());
try {
byte[] buffer = new byte[(int)upFile.getSize()];
Date now = new Date();
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMddHHmmss");
String dt2 = sdf2.format(now);
//取得後綴名
String name = upFile.getName();
int l = name.lastIndexOf(".");
name = name.substring(l);
//生成2位隨機數
Random random = new Random();
String sRand="";
String rand = null;
for (int count=0;count<2;count++){
rand=String.valueOf(random.nextInt(10));
sRand+=rand;
}
//生成在伺服器端保存的文件名
String saveName = dt2 + sRand + name;
this.setName(saveName);
String trace = D:\\"+ saveName;//本地測試
FileOutputStream fileOutputStream =
new FileOutputStream(trace); //這里可以把上傳的文件寫伺服器目錄,或者資料庫中 ,或者賦值給name用於文件名顯示
while (in.read(buffer) > 0) {
fileOutputStream.write(buffer);
}
} catch (Exception x) {
System.out.print("Exception");
FacesMessage message =
new FacesMessage(FacesMessage.SEVERITY_FATAL,
x.getClass().getName(), x.getMessage());
FacesContext.getCurrentInstance().addMessage(null, message);
return null;
}
finally {
in.close();
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.getExternalContext().getApplicationMap().put("fileupload_bytes",
upFile.getBytes());
facesContext.getExternalContext().getApplicationMap().put("fileupload_type",
upFile.getContentType());
}
System.out.println("End");
return "OK";
} catch (Exception x) {
System.out.print("Exception");
FacesMessage message =
new FacesMessage(FacesMessage.SEVERITY_FATAL,
x.getClass().getName(), x.getMessage());
FacesContext.getCurrentInstance().addMessage(null, message);
return null;
}
}
public boolean isUploaded() {
FacesContext facesContext = FacesContext.getCurrentInstance();
return facesContext.getExternalContext().getApplicationMap().get("fileupload_bytes") !=
null;
}
}
頁面:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=GBK"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030"/>
<title>add-map</title>
</head>
<body>
<h:outputText value="#{MapMDelegate.msg}" style="color:rgb(255,0,0);"/>
<h:form enctype="multipart/form-data">
<t:inputFileUpload value="#{fileuploadForm.upFile}"/>
<br/>
<h:message for="fileupload"/><h:commandButton value="上傳"
action="#{fileuploadForm.upload}" />
</h:form>
<h:form>
<br/>
圖紙名稱 <h:inputText value="#{fileuploadForm.name}" disabled="true"/>
</h:form>
</body>
</html>
</f:view>
記得要在工程的web.xml文件中加入filter
<!--Tomahawk-->
<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB</description>
<param-name>uploadMaxFileSize</param-name>
<param-value>10m</param-value>
</init-param>
<init-param>
<description>Set the threshold size - files
below this limit are stored in memory, files above
this limit are stored on disk.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB</description>
<param-name>uploadThresholdSize</param-name>
<param-value>1k</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
還有把你的程序設置成request哦
<managed-bean>
<managed-bean-name>fileuploadForm</managed-bean-name>
<managed-bean-class>model.map.FileUploadForm</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>