安卓手机如何打开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>