Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Framework How to get the browsed file path into controller bean using JSF icefaces
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Pat Lee
How to get the browsed file path into controller bean using JSF icefaces
0 Answer(s)      2 years and 11 months ago
Posted in : Framework


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.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
How to get the browsed file path into controller bean using JSF icefaces
How to get the browsed file path into controller bean using JSF icefaces ... system/machine 2) Path of the file from which I browsed need to be stored... two logs I'm getting serverpath of the file.. But I want exact browsed path
How to get the full path location using <input type=file>
How to get the full path location using input type=file  Hi. I have used input type=file> in HTML to select an image. But it selects only the image but not with its full path location. how to do it? Thanks in advance
Advertisements
How to get full path of the uploaded file using commons fileupload jar file
How to get full path of the uploaded file using commons fileupload jar file  I want to upload file to database with its full path. Because of the security reasons, the browsers provide only the file name when using normal file
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
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
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
How to get Output for a Bean problem
How to get Output for a Bean problem  Hello Kindly tell me a simple Program on Bean to get the Output using JSP code
How to create file and save it into user defined path using jsp/servlet?
How to create file and save it into user defined path using jsp/servlet?  Hi.. Onclick event I have created one file.When file will create it should asked where to save file(like browse option
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
PHP Get Absolute Path
This example shows you how you can get the absolute path of a file. We... can get the absolute path of the file. Code: <?php//to know your absolute path echo realpath(dirname("absolutepath.php")); ?>
how to get the image path when inserting the image into pdf file in jsp - JSP-Servlet
how to get the image path when inserting the image into pdf file in jsp  I am using the below code but i am getting the error at .getInstance. i am using the itext.jar now.Plz help to me <% Document document=new
how to get the image path when inserting the image into pdf file in jsp - JSP-Servlet
how to get the image path when inserting the image into pdf file in jsp  Hi Friend, my image path;C:/images/photo.jpg. i am getting the below error error: The type Image is ambiguous document.open(); Image
how to get java path name
How to write script in Java  <html> <head> <script>alert('ok')</script> </head> </Html>
Java file absolute path
Java file absolute path In this section, you will learn how to get the absolute path of the file. Description of code: If you want to locate a file without... in the constructor of File class whose absolute path we want to know. Then call
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
ICEfaces
ICEfaces       ICEfaces is a standards-compliant extension to JavaServer Faces (JSF) for building and deploying rich AJAX applications that Smooth, incremental page updates with in-place
JSF Manage Bean
JSF Manage Bean   how to register JSF manage bean? Please give me an example. Thanks!   JSF Manage Bean Example
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
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
need solution to get file name from path which should give by user
need solution to get file name from path which should give by user  how do i write a program in java that i should get file path from arguments.currently this code creates the file at d:\ but i need to get this file name
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 retrieve file name and path of an excel spreadsheet imported into Oracle Database
How to retrieve file name and path of an excel spreadsheet imported into Oracle... Oracle database and I want to know how to retrieve the path of the file... table for just the path and filename. Is there a way to do this using PL/SQL
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
File path for jar file
not found for the template file. Also I had tried to get that path from user...File path for jar file  Hi Experts, I have created one eclipse... path of the template, which is working as per expectation. But I have created
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
how to upload multiple files in jsp and saving the path in database and the file in folder
how to upload multiple files in jsp and saving the path in database and the file in folder  how to upload multiple files in jsp and saving the path in database and the file in folder I have created a form for the upload of files
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
Advertisements
 

 

 

DMCA.com