How to get the browsed file path into controller bean using JSF icefaces
Hi All,
I've a requirement as,
1) Need to browse a file from my local system/machine
2) Path of the file from which I browsed need to be stored in a variable in controllerbean.
This thing I've done as below,
1)...
filePathAccess.jsp
< ice:inputFile id="inputFileName" width="600" autoUpload="true" value="#{fileAccessDataBean.inputFileName}"
actionListener="#{fileAccessControllerBean.browse}"
/>
2)...
FileAccessDataBean.java
private String inputFileName;
public String getInputFileName() {
return inputFileName;
}
public void setInputFileName(String inputFileName) {
this.inputFileName = inputFileName;
}
FileAccessControllerBean.java
public class FileAccessControllerBean {
/** latest file uploaded by client. */
private FileInfo currentFile;
FileAccessDataBean fileAccessDataBean = new FileAccessDataBean();
/**
* This method is for gettingsetting browse.
* @param event ActionEvent
*/
public void browse(ActionEvent event) {
InputFile inputFile = (InputFile) event.getSource();
String filePath = null;
LOG.debug("XXX Getting File Info into currentFile..." + inputFile);
currentFile = inputFile.getFileInfo();
LOG.info("XXX current File Name... " + currentFile.getFileName());
filePath = inputFile.getFileInfo().getPhysicalPath();
LOG.info("XXX physical path... " + filePath);
fileAccessDataBean.setInputFileName(inputFile.getFileInfo().getPhysicalPath());
File file = currentFile.getFile();
filePath = file.getAbsolutePath();
LOG.info("XXX absolute path.. " + filePath);
}
}
=========================================================
Browsed file location: C:\Documents and Settings\personInfo.xml
XXX Getting File Info into currentFile... personInfo.xml
XXX current File Name... personInfo.xml
XXX physical path File Name... U:\glassfish.frontend\domains....\personInfo.xml
XXX absolute path.. U:\glassfish.frontend\domains....\personInfo.xml
in the above two logs I'm getting serverpath of the file.. But I want exact browsed path that is C:\Documents and Settings\personInfo.xml
how can I get the path? Is there any other way to browse the file and get the path of the file into controllerbean?
PLEASE HELP ME OUT It's very urgent requirement for me.
View Answers
Ads
Related Tutorials/Questions & Answers:
Advertisements
How to get path of a file in iOS?
How to
get path of a
file in iOS? Hi
iOS project I have added a
file abg.jpg, Now I want to know the
path of the image
file when installed in iOS.
Pl let's know the code.
Thanks
Hi,
You can use following code
How to get the output of JSP program using Bean
How to
get the output of JSP program
using Bean Hi
Kindly go... program for the above one by
using Bean and i opened the Tomcat webserver... visit the following link:
http://www.roseindia.net/jsp/
using-
bean-counter.shtml
How to get the output of jsp program using Bean
How to
get the output of jsp program
using Bean Hello my Roseindia...;
Next i created JSP program for the above one by
using Bean and i opened..." %>
<HTML>
<HEAD>
<TITLE>Use
Bean Counter Example <
How to get project path
How to
get project path my problem is,i have one jar
file,in that one xml is their,i am adding this jar
file to my project,my question is
how i can open or
get that xml
path
How to get project path
How to
get project path my problem is,i have one jar
file,in that one xml is their,i am adding this jar
file to my project,my question is
how i can open or
get that xml
path
How to Store Image using JSF
How to Store Image
using JSF Hi
How to upload images in db.
using jsf. For
jsf photo uploading .. I used this one code for upload image.........
public void save(Registrationbean
bean) {
try {
PreparedStatement
How to get xml file form http port using web service
How to
get xml
file form http port
using web service hi
I am suresh i am
using netbeans 6.9 to develop a web service for getting xml from http port... struck with getting xml
file.
How to access xml
file in web service?
Please Help
insert rows from browsed file to sql database
insert rows from
browsed file to sql database i need to insert rows... the databases
using odbc i can do this. but after browsing and uploaded the
file, content of the
file has to go to database.
how can i insert record into database
How to store url path in file ?
How to store url
path in
file ? Hi,
How to store url
path in
file... = robot.createScreenCapture(new Rectangle(1000,700));
String
file = "C:/xampp...";
This is store phiscal directory but i want store url
path like
how to get description for each file
how to
get description for each file hi,
how to
get description for each
file using php or java script.....
condtion:two text boxes for each
file
if the user select 10
file to upload........
get the description
icefaces
icefaces I am
using Facelets with
ICEfaces 1.8. I have a
file details.jspx that is called in two different panels on the same page. What I want... details.jspx has one datatable
HOW TO solve these two datatables rendering problem.I
JSF Manage Bean
JSF Manage
Bean how to register
JSF manage
bean? Please give me an example.
Thanks!
JSF Manage
Bean Example
how to get file extension in java
how to
get file extension in java Hi,
I want to
get the
file extension in Java.
how to
get file extension in java?
Thanks
Hi,
Here is sample code to
get file extension in Java:
package examples;
import
icefaces
icefaces I am
using Facelets with
ICEfaces 1.8. I have a
file details.jspx that is called in two different panels on the same page. What I want to do is add a binding attribute to the ice ataTable in details.jspx but when I do
How to change uploaded file root path ?
How to change uploaded
file root
path ? I have
file upload php script.
File upload working is good. But I can't find where saving that
file. I think the files saving in mysql directory.
How to change directory to my desired
path
Creating Bean Class In JSF using NetBeans
Creating
Bean Class In
JSF using NetBeans
 ... illustrates
how to create the
Bean Class. This is also called
the Backing
Bean... steps are used to create the
bean class in the
JSF
application:-
Step1
how to create bean using jsp and servlet
how to create
bean using jsp and servlet public class SampleBean {
private String fname=null;
private String lname=null;
private int age=0;
private String gender=null;
private String phone=null;
}
Please visit
How to write to file using FileWriter
How to write to
file using FileWriter hi,
How to write to
file using FileWriter
thanks,
Hi,
To writing in a
file in Java program we... of the FileWriter class can be created
using the following of its constructor i.e. FileWriter
Problem in getting file path in js
Problem in getting
file path in js hi,
I am
using ofbiz framework ,
How i can
get the
file path in javascript for input type = "
file" and i am
using only firefox not other browser. so please help me it is very important for me
How to write to file using FileOutputStream
How to write to
file using FileOutputStream Hi friends,
Please help me in java program.
How to write to
file using FileOutputStream?
thanks,
Hi,
To write a
file using FileOutputStream, we have to use
File Path compare in java
File Path Comparison :compareTo
File Path Comparison :compareTo
In this section, we will discuss
how to compare pathname of two
file for the
equality