In a JSF Web Application

Is there anyway in the .JSP, Javascript or Backing Bean to iterate over all the files in a directory on the server?
I want to iterate over all the files in my images directory
development
http://localhost:8080/<app name>/images
production
http://<domain>/images
Something like the like what Alex Wong is doing here... but as I say in a Web Application
http://www.javapractices.com/Topic68.cjp

The why is that I would like to be able to put up some image files, then when the user clicks to go to a certain page, that directory would be read and the thumbnails of the images in that directory would be displayed. I'm doing this to a degree currently in a javascript, accessing the directory via www.<domain>/images, but in the current case, the names of the files are already known.
That's why I need to be able to iterate over any files that are in the directory, not just known files.

Similar Messages

  • Creating a JSF Web application from scratch.

    hi,
    i have created a JSF web application, but not from scratch i had to use a jsf example included in the final specification of the JSF download, as a template to create my own application, by deleting and editing the example files with my own.
    i tried to do it from scratch including all the settings, parameters and files that should be in place, but i sill get an error when starting the app in tomcat.
    Unfortunately i dont have the error listing anymore since i have got around the problem through alternate path. however i do remember that it came with cannot find FacesServlet, or something to do with the FacesServlet.
    if anyone could shed some light on this it would be really great because it so frustrating.
    many thanks.
    dharam

    cannot find FacesServlet, or something to do with the FacesServlet.It might appear not because you have a wrong project structure, but because you point to the entry jsp file directly without using the servlet mapping in your URL. Check this first.
    Sergey : jsfTutorials.net

  • Jsf web application has to be restarted everytime a broken pipe exception

    Hi,
    My jsf web application using tomcat is experiencing a sql exception "java.sql.SQLException: System or internal error java.net.SocketException: Broken pipe" when it tries to connect to database.
    Everytime this exception happens I have to restart the application and the application runs fine then.
    Is there a way to handle this exception that we don't have to restart the application.
    -kap

    It depends....
    How do you have (where) the connection, how you obtain them, etc?

  • Access an Application Module Client Interface in a JSF Web Application

    How to Access an Application Module Client Interface in a JSF Web Application
    I use this code but class ValueBinding is deprecated in JDeveloper11g
    FacesContext fc=FacesContext.getCurrentInstance();
    ValueBinding vb=fc.getApplication().createValueBinding("#{data}");
    BindingContext bc=(BindingContext)vb.getValue(fc);
    DCDataControl dc=bc.findDataControl("SRServiceDataControl");
    ApplicationModule am=(ApplicationModule)dc.getDataProvider();

    user581394,
    JDeveloper 11 and the introduction of ADF Faces RC introduces a new dependency, which is JSF 1.2. The createValueBinding on the FacesContext object is deprecated in JSF 1.2. To resolve an expression in JSF 1.2 use the following method or something similar.
        public static Object resolveExpression(String expression) {
            FacesContext facesContext = getFacesContext();
            Application app = facesContext.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();
            ELContext elContext = facesContext.getELContext();
            ValueExpression valueExp =
                elFactory.createValueExpression(elContext, expression,
                                                Object.class);
            return valueExp.getValue(elContext);
        }--RiC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Does any body have any design patterns of JSF Web Application Developping?

    Can any one answer me some questions?
    #1.I am an amatuar of people who develop Web Application.For some reason,We choose the JSF to develop our item.through some introduction,I know the UI component of JSF is resided in Server side,is it right?but I am a little confused that:if there are many users who are exploring our jsf website.(to simplify my question,image I had just one web page and just one button)How many UI components(buttons) will be there?How it(they?) works?
    #2.Does any body have the success experience (for example design pattern)to develop web applications?if We just concern about the Add,Delete,Modify,Query operations of some data.
    I just do my job according to my feeling.
    I will give every page a pagebean(backing bean),and I am not sure how to combine the business data with the pagebean.some one suggested that I should use delegate pattern to separate my business log and page logic.But I am still confused by following things:
    #2.1 does JSF have the same ability to help us construct the model dialog just like swing to
    help us control the operation flow?
    #2.2 If there is not,Does the following way work?I put every tabledata's property as corresponed component.if user choosed the row in the table,My Listener will syncronize the row data to the components.But
    #2.2.1 if JSF has the components according to the web users' number,how can My Listener tell which component should be update?Should I maintain the map?
    #2.2.2 If the problem I imaged above is false,Does any body can tell me how to custom      the ListDataModel,so I can use it like Swing?because now I can just use some view data to insert into ListDataModel,but after some selection operation,my business object must be find according to the selected data,it is not an interesting job!
         I am waiting for your advice!

    Ok I'll try to explain Step by step please correct me if I make any mistake because I have not played much with shared variables.
    To create a shared variable to an RT target go to the target if tou have already otherwise add an RT target by right clicking the Project>>Add targets and Devices
    Then in the target Right clikc and select the variable as shown below.
    Then once the Shared variable settings window opens Enter a variable name and then Select the type "Network Published"
    In the right side you can select the data type for the shared variable and even you can choose your custome controls.
    After selecting the data type go for the Network and select buffering if required else leave it if you are planning to use the variable just for display purpose.
    Then you can enable the RT FIFO if required (Not able to explain how it works and why it is used).
    Then after completing the Shared variable setup you can access the variable in the VI in both the Host and the RT.
    You can bind the variable to a control so that if any data from the RT is coming you can read the data from that control.
    Once you have placed your shared variable in the BD you can change the access typr to read or write depending on your need.
    This might not explain the complete shared variable concept but I believe that this would defenelty give you a kick off to start using the shared variable. Please correct or add more comments if anybody know better.
    Good luck.
    The best solution is the one you find it by yourself

  • JSF Web Applications

    Hi,
    I have just started on JSF after working on struts for quite some time.Is the any web application with JSf and facelets demonstrating features like session handling,best practices like use of Business delegates etc just like the petstore sample application?
    Regards
    Raj

    Hi,
    I have just started on JSF after working on struts for quite some time.Is the any web application with JSf and facelets demonstrating features like session handling,best practices like use of Business delegates etc just like the petstore sample application?
    Regards
    Raj

  • Ll / seeking FREE open source JSP / JSF Web application Tomcat/5.5.15

    hi all,
    We have a need to set-up a web site for a community based (non profit organisation) football / soccer) club.
    The web hosting machine is based on JSP / JSF running on Apache Tomcat/5.5.15 & Sun Microsystems Inc. VM 1.5.0_06-b05.
    OS is Windows 2003 V 5.2
    The database backend is based on MySQL, mysql-essential-5.0.18-win32.
    We need to add content related to:
    a) Players contact details;
    b) Teams;
    c) Match reports;
    d) News;
    ... and other dynamic content
    We are looking for an out-of-the box FREE open source Web application we can deploy on the web hosting machine.
    Any suggestions will be appreciated.
    Thanks
    Trajano

    I haven't tried ICEFaces or JBoss seam or Apache MyFaces, so I can't really compare them.
    ICEFaces appears to be a nice framework/tool from looking at their site, even though it's open source I think one has to pay for support, you might want to take that into consideration while making your decision.
    Apache MyFaces, is fully community driven - so you get free support from the community.
    I don't know about JBoss seam.

  • Intention of JSF (web applications or web sites?)

    Hi,
    I want to write a web application that has a similar look and feel to todays desktop applications. Thus I don't need a typical web site look (title on the top, navigation bar etc.) but a more desktop look (a menu bar on the top, a status bar on the bottom etc.)
    Although I like JSF I am not sure, if this framework is the best for this job. Thus I wanted to ask, if you can tell me the intention of JSF:
    Is it to build web sites or is it also to build web applications without the typical web site look and feel? With JSF both is possible of course. And with the adequat JavaScript library on the client side it looks very nice (e.g. ExtJS).
    But was this one of the intentions of JSF? Or was it primarily to build usual web sites with a page flow etc.? And maybe another framework is better for what I am going to do?
    I only don't want to use a JSF for something it has not been made for.
    Greetings
    Mike

    wpafbuser1 wrote:
    I don't see what the point is in making a distinction between web sites and web apps. Are you trying highlight the difference between say Apache vs. JBoss?I'm not sure what you mean by "the difference between say Apache vs. JBoss" but here's what I meant. When I think a web site, I think of a site where the interaction tends to be more reading, clicking from page to the next, etc., like, for example a news site. With a web app, I tend to think of statefulness, business processes, etc, like an online accounting system, content management system, etc. The distinction is probably pretty academic, though...
    Well you need to decide if you're making a simple web site that serves static content or i fyou're making an application with a GUI. There's a big difference.Exactly.
    For a desktop-like application, I say web browsers in general are a bad choice. I'd use Web Start if possible and write a GUI. In any case, Hehe. That's a completely different (though very valid argument(
    AJAX is the last thing I'd use (now you're writing HTML, XML, AJAX, Java, etc..). Echo2 provides 1 single API rather than hacking several. Flex, while I haven't used much, seems to also provide a much cleaner solution. Fair enough, and that's not an uncommon opinion. I'm probably somewhere in the middle, but, for what I've been asked to do since the web 2.0 hype started, Ajax has been sufficient. I'm not Echo2 expert, but isn't that just an HTML/JS interface with a Java backend with Ajaxy operations? For really, really complex and dynamic UIs Flex (or JavaFX :) might be more appropriate.
    Again, I haven't used JSF so I can't say much about it. But I see lots of projects all the time and JSF seems to be slow for adoption so far. Just my personal experience.Hmm. I've used it for about three years now, fwiw, and really, really like it. Which probably isn't worth much. I will admit, though, that JSF isn't always the right tool (thus the discussion here). As far as adoption goes, it seems to be growing much faster than the other frameworks out there, but I may have tinted glasses... ;)

  • JSF - Web Application Fast

    Hai Respected Friend
    Sorry for posting this doubt in this site because this not a JSF related Question.
    I have some doubt regrading Web Page working fast . Actually some website is working vary fast while some one is not . please let me know normally web site working speed based on what
    1) Java Technology , Server (Application , Webserver). or
    2) Our client ,m/c Hardware requirement or Server m/c Hardware requirement include RAM speed , Processor Speed. or
    3) Data base server or
    4) Net Connection service Provider speed .
    Advance Thanks for your later Reply .
    Thanks
    Selvakumar

    It depends....
    How do you have (where) the connection, how you obtain them, etc?

  • JSF Web Application - endless redirecting loop

    I've created a simple JSF WebApplication, just one page, one static text. When I deploy it to the bundled server, everything is OK. When I deploy it to a remote server, that I have access to (Sun Java System Application Server Enterprise Edition 8.1_02), and I browse to its URL (http://server:port//Webapplication), the browser shows me an error. IE just displays Page cannot be displayed error, Firefox tells me, that the app. ended up in a redirection loop.
    When I browse to /Webapplication/faces/Page1.jsp, everything is ok.
    What can be wrong?

    Hello
    We are looking at doing the same thing (iviews in Sharepoint)
    Any luck in solving the problem ?
    thank you
    Robin

  • Problem in JSF with Swing in a web application

    hi
    i am using jsf for my online projects.my problem is that when i use Swing concept ,the server is closed automatically when i click the swing dialog option 'OK', how can i protect server being closed automatically when user click the the options of Swing dialog box.it is so tedious because my application is going to integrate
    with online server?
    my swing java file is
    * FileExistsDialog.java
    package com.obs.ftw.util.alert;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.Rectangle2D;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.plaf.metal.MetalLookAndFeel;
    * FileExistsDialog: A JOptionPane-like dialog that displays the message
    * that a file exists.
    public class FileExistsDialog extends JDialog {
    * The component that gets the focus when the window is first opened
    private Component initialFocusOwner = null;
    * Command string for replace action (e.g., a button).
    * This string is never presented to the user and should
    * not be internationalized.
    private String CMD_REPLACE = "OK"/*NOI18N*/;
    * Command string for a cancel action (e.g., a button).
    * This string is never presented to the user and should
    * not be internationalized.
    private String CMD_CANCEL = "CANCEL"/*NOI18N*/;
    // Components we need to access after initialization
    private JButton replaceButton = null;
    private JButton cancelButton = null;
    public FileExistsDialog(){
         System.out.println("INSIDE THE FILE EXIST DIALOG");
         JFrame frame = new JFrame() {
         public Dimension getPreferredSize() {
         return new Dimension(200,100);
         frame.setTitle("Debugging frame");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.pack();
         frame.setVisible(false);
    FileExistsDialog dialog = new FileExistsDialog(frame, true);
         dialog.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent event) {
         System.exit(0);
         public void windowClosed(WindowEvent event) {
         System.exit(0);
         dialog.pack();
         dialog.setVisible(true);
    * Creates a new FileExistsDialog
    * @param parent parent frame
    * @param modal modal flag
    public FileExistsDialog(Frame parent,boolean modal) {
    super(parent, modal);
         //initResources();
         System.out.println("INSIDE THE FILE EXIST DIALOG CONSTRUCTOR");
    initComponents();
    pack();
    * Determines the locale, loads resources
    /* public void initResources() {
         Locale locale = Locale.getDefault();
    resources = ResourceBundle.getBundle(
              "samples.resources.bundles.FileExistsDialogResources", locale);
    imagePath = resources.getString("images.path");
    }*/ // initResources()
    * Sets all of the buttons to be the same size. This is done
    * dynamically after the buttons are created, so that the layout
    * automatically adjusts to the locale-specific strings.
    private void equalizeButtonSizes() {
         System.out.println("INSIDE THE equalizeButtonSizes()");
    String[] labels = new String[] {
    replaceButton.getText(),
         cancelButton.getText()
         // Get the largest width and height
         Dimension maxSize= new Dimension(0,0);
         Rectangle2D textBounds = null;
         Dimension textSize = null;
    FontMetrics metrics =
              replaceButton.getFontMetrics(replaceButton.getFont());
         Graphics g = getGraphics();
         for (int i = 0; i < labels.length; ++i) {
         textBounds = metrics.getStringBounds(labels, g);
         maxSize.width =
         Math.max(maxSize.width, (int)textBounds.getWidth());
         maxSize.height =
         Math.max(maxSize.height, (int)textBounds.getHeight());
    Insets insets =
         replaceButton.getBorder().getBorderInsets(replaceButton);
    maxSize.width += insets.left + insets.right;
    maxSize.height += insets.top + insets.bottom;
    // reset preferred and maximum size since BoxLayout takes both
         // into account
    replaceButton.setPreferredSize((Dimension)maxSize.clone());
    cancelButton.setPreferredSize((Dimension)maxSize.clone());
    replaceButton.setMaximumSize((Dimension)maxSize.clone());
    cancelButton.setMaximumSize((Dimension)maxSize.clone());
    } // equalizeButtonSizes()
    * This method is called from within the constructor to
    * initialize the dialog.
    private void initComponents() {
         System.out.println("INSIDE THE initComponents()");
         // Configure the window, itself
    Container contents = getContentPane();
    contents.setLayout(new GridBagLayout ());
    GridBagConstraints constraints = null;
    setTitle("Waring");
         // accessibility - all applets, frames, and dialogs should
         // have descriptions
         this.getAccessibleContext().setAccessibleDescription("Descriptions");
         addWindowListener(new WindowAdapter() {
         public void windowOpened(WindowEvent event) {
              // For some reason the window opens with no focus owner,
              // so we need to force the issue
         if (initialFocusOwner != null) {
              initialFocusOwner.requestFocus();
              // Only do this the 1st time the window is opened
              initialFocusOwner = null;
         public void windowClosing(WindowEvent event) {
         System.out.println("INSIDE THE windowClosing");     
         // Treat it like a cancel
              windowAction(CMD_CANCEL);
         // image
    JLabel imageLabel = new JLabel();
    imageLabel.setIcon(
    new ImageIcon("/images/degraded_large.gif"));
    // accessibility - set name so that low vision users get a description
    imageLabel.getAccessibleContext().setAccessibleName("OK");
    constraints = new GridBagConstraints ();
    constraints.gridheight = 2;
    constraints.insets = new Insets(12, 33, 0, 0);
    constraints.anchor = GridBagConstraints.NORTHEAST;
    contents.add(imageLabel, constraints);
    // header
    JLabel headerLabel = new JLabel ();
    headerLabel.setText("SAMPLE");
    headerLabel.setForeground(
         new Color(MetalLookAndFeel.getBlack().getRGB()));
    constraints = new GridBagConstraints ();
    constraints.insets = new Insets(12, 12, 0, 11);
    constraints.anchor = GridBagConstraints.WEST;
    contents.add(headerLabel, constraints);
         // Actual text of the message
         JTextArea contentTextArea = new JTextArea();
    contentTextArea.setEditable(false);
    contentTextArea.setText("SAMPLE");
    contentTextArea.setBackground(
              new Color(MetalLookAndFeel.getControl().getRGB()));
    // accessibility -- every component that can have the
         // keyboard focus must have a name. This text area has no
         // label, so the name must be set explicitly (if it had a
         // label, the name would be pulled from the label).
    contentTextArea.getAccessibleContext().setAccessibleName(
              "CONTENTNAME");
    constraints = new GridBagConstraints ();
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.insets = new Insets(0, 12, 0, 11);
    constraints.anchor = GridBagConstraints.WEST;
    contents.add(contentTextArea, constraints);
         // Buttons
         JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout (new BoxLayout(buttonPanel, 0));
         replaceButton = new JButton();
         replaceButton.setActionCommand(CMD_REPLACE);
    replaceButton.setText("OK");
    replaceButton.setToolTipText("TO OK");
         replaceButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent event) {
         windowAction(event);
    buttonPanel.add(replaceButton);
    // spacing
    buttonPanel.add(Box.createRigidArea(new Dimension(5,0)));
         cancelButton = new JButton();
         cancelButton.setActionCommand(CMD_CANCEL);
    cancelButton.setText("CANCEL");
    cancelButton.setNextFocusableComponent(replaceButton);
         cancelButton.setToolTipText("TO CANCEL");
         cancelButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent event) {
         windowAction(event);
    buttonPanel.add(cancelButton);
    constraints = new GridBagConstraints ();
    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.insets = new Insets(12, 12, 11, 11);
    constraints.anchor = GridBagConstraints.WEST;
    contents.add(buttonPanel, constraints);
         // Equalize the sizes of all the buttons
         equalizeButtonSizes();
         // For some reason, the dialog appears with no input focus.
         // We added a window listener above to force the issue
         initialFocusOwner = replaceButton;
    } // initComponents()
    * The user has selected an option. Here we close and dispose the dialog.
    * If actionCommand is an ActionEvent, getCommandString() is called,
    * otherwise toString() is used to get the action command.
    * @param actionCommand may be null
    private void windowAction(Object actionCommand) {
         System.out.println("INSIDE THE WINDOW ACTION");
         String cmd = null;
    if (actionCommand != null) {
         if (actionCommand instanceof ActionEvent) {
         cmd = ((ActionEvent)actionCommand).getActionCommand();
         } else {
         cmd = actionCommand.toString();
         if (cmd == null) {
         // do nothing
         } else if (cmd.equals(CMD_REPLACE)) {
         System.out.println("your replace code here...");
         } else if (cmd.equals(CMD_CANCEL)) {
         System.out.println("your cancel code here...");
         setVisible(false);
         dispose();
    } // windowAction()
    * This main() is provided for debugging purposes, to display a
    * sample dialog.
    // main()
    } // class FileExistsDialog
    and calling java function is
    public String fileDialog(){
         return "Success";
    public void processFile(ActionEvent event){
         System.out.println("INSIDE THE FILE DIALOG");
         FileExistsDialog file     = new FileExistsDialog();
         System.out.println("SUCCESS");
    called from
         <h:commandButton action="#{userLogin.fileDialog}" actionListener="#{userLogin.processFile}"></h:commandButton>
    pls help me as soon
    advance thanks
    rgds
    oasisdeserts

    Swing is GUI library for use in desktop applications.
    JSF is a web application framework which runs on an application server and is accessed by clients via web browsers.
    To fully understand what you have done, try accessing your application from a different machine than the server.
    To answer your question, don't invoke System.exit() if you would like the process to continue. But that is the least of your problems.

  • For a new web application project - Struts OR JSF ?

    Hi ,
    We are starting a new web application project and want to decide whetehr to us Struts or JSF ?
    Currently, mots of the other development teams are using Struts .
    We need to know pros and cons of each to decide one way or the other.
    Any help is appreciated .
    Thanks

    Those are the articles and presentation about this topic:
    http://homepage1.nifty.com/algafield/barcia.html
    http://www.jroller.com/comments/dgeary/Weblog/top_ten_reasons_to_prefer
    http://websphere.sys-con.com/read/46516.htm
    http://www.pjug.org/JavaServerFaces.pdf
    Sergey : http://jsfTutorials.net

  • How to display BLOB image column with WEB application, JSF, ADF BC

    I looking for a way to display the content from a blob column on a WEB application, JSF, ADF BC
    The blob column contains a JPEG image.
    About the application
    The model contains a viewobject where the blob column attribute (photoimg) type is of type : BlobDomain
    Now I have to create the view to display the content of photoimg inside a JSF-JSP page.
    Any advice ?

    Search is your friend
    How to display the content of a BLOB column in a ADF/BC pages ?
    John

  • Call a JSF application from a Standar Web application (JSP)

    Hi all,
    We have 2 aplication, one is JSF and the other one is standar web jsp.
    We want to invoke from the standard web application to the JSF application and pass param from the jsp to the *.jsf page.
    how can I do that?
    Thanks.

    You can open a jsf page from any other application.
    <form action="http://hostip:port/app/MyPage.jsf?key1=value1&key1=value1">
    as we do in any other jsp page.
    Now in JSF application, in MyPage.jsf write a scriptlet to get the parameters and from there you can use these params.
    You can get a managed Bean reference in your jsp page. Here is the code for that.(ResultsInExcelBean is my managed bean.)
    FacesContext fc = FacesContext.getCurrentInstance();
         ResultsInExcelBean resultsInExcelBean = (ResultsInExcelBean)fc.getApplication().createValueBinding("#{ResultsInExcelBean}").getValue(fc);     
    Hope this helps you.
    Sravan

  • Merging Two JSF, ADF BC Web Applications into One web application

    What would be the best way to take two JSF, ADF BC web applications written by two developers and merge them into one web application. Any place to start would be greatly appreciated. I'm using Oracle JDeveloper - 11.1.1.4.0
    Edited by: Sunanda on Jul 26, 2011 4:13 AM

    Take a look at this thread:
    Merging Two JSF, ADF BC Web Applications into One...
    Although the thread is old, but it provides about the types of contents you would need to take into consideration while merging.
    With the knowledge from the above thread, you could use refactor option in the JDeveloper menu to move the contents from one project to another.
    Thanks,
    Navaneeth

Maybe you are looking for

  • How can I remove the Endnote Separator Line from Pages?

    Hello! I am creating a book using Pages and have lots of footnotes (Currently running Pages 5.2.2).. There is an Endnote Line Separator which I am trying to remove. Does anyone know how to remove this line? We don't want it in the final design & are

  • HOW TO DELETE A CONDITION TABLE??

    HI DOES ANYONE KNOWS HOW TO DELETE CONDITION TABLE? THANKS

  • Spa508 firmware upgrade failed

    I bought a spa500ds and need to upgrade the firmware on my 508G to use it. When I try to upgrade to 7.5.4, or 7.5.3 I get a failure.  I was able to upgrade to 7.5.1a fine.  All firmware was downloaded from cisco this morning and unziped I see my tftp

  • My activation code doesn't work. I HAVE PAID YOU!

    My activation code (Product Key) doesn't work! Why even send it at all if you know its not going to work. Why does Adobe software install so easily yet Microsoft . . . nothing but problems. Your order number: [Deleted number] Order date: November 14,

  • What happened to the alarm icon for Events with alarms

    Upon upgrading to iCal 3.0, I notice that events that have alarms attached no longer display with the little "bell" icon on them (indicating that an alarm is attached). Any way to get these to appear again? -- Dave