JSF Multiple Clients Example

Hi
I have read a number of examples on how to create JSF pages.
I have also read the tutorial on how to create a PDA application.
However, are there any examples of how a page can be rendered differently depending on what views it (a PDA or a Web Browser for instance)?
I can't seem to find anything which builds a single JSF page and then displays this differently depending on the client.
Cheers
Richard

I was guessing the JDeveloper Forum.
Unless I am wrong and this is the right forum and you have an answer to the question?

Similar Messages

  • Can anyone show me an example of multiple clients(RMI)?

    Hi.
    Can anyone show me one simple example of a server serving multiple clients using RMI?
    I know that I have to use thread but I'm not really use to it...
    Thank you :)

    You don't have to use threads, you don't have to do anything. Any RMI server will service multiple clients simultaneously.

  • How to control one server with multiple clients via TCP/IP

    I am wanting to control a single server with multiple clients.  Only one client would be active at a time, so there would be no conflict.  I want to use TCP/IP.  So far, I have programmed a cluster that passes data back to the server with no problems.  The challenge come in when a second client is added to the mix.  I have't been able to figure out how to turn each client on and send the appropriate data and then turn it off so it doesn't keep sending the same data to the server. 
    Here are the things that I have considered and did some preliminary testing, but don't really know how to impliment:
    1.  Send a numeric on the front of the cluster packet that tells the server that data is on the way.
    2.  Send a boolean on the front of the cluster packet to somehow turn the server TCP/IP on.
    The problem I have found is that LabVIEW TCP/IP doesn't like to be turned on and off.  If it doesn't get the data it expects, it goes into a reset mode and that kills the response time.
    Any help?

    You should consider implementing a set of simple one-byte commands that can be sent back and forth between the Server and the Clients. You can base all of these ideas off the example in the Example Finder under Networking >> TCP and UDP called Multiple Connections - Server.
    You will have two loops in the server VI: one to wait for new connections, and one to send and receive data from the existing connections. For instance, after one of the clients connects, it can request control of the server to send data to it by sending the character "R" for request. Every time the send/receive loop of the Server executes, the first thing it can do is to check all the existing connections to see if any of the clients have sent a control request ("R"). If so, it will create a buffer (array) of control requests. This could be in the form of Connection IDs or indexes in the array for a particular Connection ID. Your choice.
    After the Server receives a request for contol, if it is not already under control by another client, then it can send a response to the first client on the control request list. For instance, the server could send the first client a "S" command for send. Note that after the clients send their control request, they should execute a TCP Read and wait indefinitely for the server to respond with the one-byte "S" command. Then, once the client in control is finished sending data to the server, it could send the character "X" telling the Server to release it from control.
    The example I mentioned above already does a similar thing. Note how when a client wants to disconnect, they send the letter "Q". You can see this in the Multiple Connections - Client VI. The Server then checks each individual connection to see if it's received this one-byte command, and if it has, it closes the connection to the client. This is what you would want to implement, but instead of having just one command, you'll have to distinguish between a few and build up a buffer of control requests.
    Finally, if a client does decide to disconnect in your application, they could send the command "Q" just like the example above. At this point, close the connection and remove that Connection ID from the array of connections. You will also have to handle the case that this client was in the request control waiting line when it disconnected, in which case you need to delete it from that array as well.
    This will definitely work for you, but it will take some work. Best of luck!
    Jarrod S.
    National Instruments

  • Saving string  from multiple clients on a server data structue

    I have a server which receives updates from multiple clients ( in this example, football scores which are updated periodically by the clients.)
    When the server receives the scores it needs to store them and at certain time intervals send the complete list of scores to multiple terminals at various locations.
    I am approaching this task in stages...
    stage 1.
    ..create the clients and server ...test the clients can send the data and the server can receive the data and output to screen..
    this is completed
    stage 2...
    a/ on the server side store the received scores in a data structure (ArrayList<String> is what I'm thinking.)
    b/ periodically output all scores to the screen (maybe every 30 seconds) and empty the ArrayList..am looking at the Timer class for this part..
    stage 3
    create the monitors and output scores to monitors periodically..
    ======================================================
    right now I'm at stage 2a ie trying to store the received scores in a data structure.
    i've created a method saveScore in the StoreScore class which is called by the StoreScore run method...
    The saveScore method creates an ArrayList and adds the score to it...
    Question
    does every thread create a new instance of storedScores and therefore the scores are stored in a multitude of data structures?
    I think the answer is yes and if so then this is not the solution...
    What I'm thinking is , as all scores can be outputted to the server screen via System.out.println, is there not a way of saving all these scores in a single data structure?
    The code below is the server code..
    any advice much appreciated....thank you
    /*=============================================================== */
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.util.concurrent.*;
    class ScoresServer1{
    final static int portNum = 1234; // any number > 1024
    final static int numThreads = 10;
    static ExecutorService pool;
    public static void main(String[] args){
    pool = Executors.newFixedThreadPool(numThreads);
    System.out.println("Server running ...");
    try{  
    ServerSocket servesock = new ServerSocket(portNum);
    // for service requests on port
    while (true){ 
    // wait for a service request on port portNum
    Socket socket = servesock.accept();
    // submit request to pool
    pool.submit(new StoreScore(socket));
    }catch(IOException e){}
    class StoreScore implements Runnable {
    BufferedReader reader;
    Socket sock;
    public StoreScore(Socket clientSOcket) {
    try {
    sock = clientSOcket;
    InputStreamReader isReader = new InputStreamReader(sock.getInputStream());
    reader = new BufferedReader(isReader);
    } catch (Exception ex) { ex.printStackTrace(); }
    public void run() {
    String message;
    try {
    while ((message = reader.readLine()) != null) {
    // System.out.println("latest score: " + message);
    saveScore(message);
    } catch (Exception ex) { ex.printStackTrace(); }
    public void saveScore(String message){
         ArrayList<String> storedScores = new ArrayList<String>();
         storedScores.add(message);
         Iterator<String> t = storedScores.iterator();
              while(t.hasNext()){
                   String s = t.next();
                   System.out.println(s);
    }

    does every thread create a new instance of storedScores and therefore the scores are stored in a multitude of data structures?
    I think the answer is yes and if so then this is not the solution...The answer is yes. However, threads can share data, if they were properly synchronized. You should read the threading tutorial before creating a lot of hard to debug mistakes.
    [http://java.sun.com/docs/books/tutorial/essential/concurrency/]

  • How to handle multiple clients with DatagramSocket

    I am trying to handle multiple clients with 1 datagramSocket bind to one port (basically I have only one port to use, and I can not use TCP or any other ports). At the server side I have two threads one for receiving packets and buffering them, another for processing the packets in the buffer and sending replies.
    I can have multiple clients sending datagramPackets to me and I will have to process the packets and send them to DIFFERENT clients. Ex. Client 1 sends datagramPacket to Server which sends the processed packet to Client 2. Also Client 2 sends a datagramPacket to Server which again processes the packet and sends it to Client1. May have Client 3 and 4 doing the same thing at the same time... and so on...
    My root class is creating the datagramSocket(somePort) and two threads (receiver and sender). How can I use the socket that I created in these two threads??
    I have done the following and I am getting "java.net.bindexception". When I am sending stuff from Client1 to Client2 everything is fine but when I start sending something from Client2 to Client 1, I get the bindexception... Client 1 is using port 3000, Client 2 is using port 4000.
    I really don't have a lot of experience in socket programming so I am not sure if there is a much simpler way to do this. I appreciate all the tips and help that I can get...
    Thanks...
    class UDP_serv
         static DatagramSocket udpSocket;
         final static int SERVER_PORT     = 2000;
         public static void main(String[] args) throws SocketException
              udpSocket= new DatagramSocket(SERVER_PORT);
              new DataReceiver().start ();
              new DataSender().start ();
         static class DataReceiver extends Thread
              DataReceiver()
                   Thread.currentThread().setName("DataReceiver");
              public void run()
                   while (true)
                        byte pckt[] = new byte [MaxMsgSize];          
                        DatagramPacket dp = new DatagramPacket (pckt, pckt.length);
                        try
                             udpSocket.receive (dp);
                             //PUSH TO RECEIVE BUFFER
                        catch(Exception e)
                             e.printStackTrace();
         static class DataSender extends Thread
              DataSender()
                   Thread.currentThread().setName("DataSender");
              public void run()
                   while (true)
                        processDataMsg();
          static void processDataMsg() 
             DatagramPacket op;
             InetAddress DA = null;
             int DP = 0;
             byte [] outPacket = null;
             // POP FROM RECEIVE BUFFER
             // SOME PROCESSING HERE     
             // Set Destination Address (DA)
             // Set Destination Port (DP)
             // DA and DP are the forwarding IP and Port addresses
             // not the addresses original packet was sent from.
             try
              op = new DatagramPacket (outPacket, outPacket.length,DA, DP);
              udpSocket.send(op);
             catch (IOException e)
              e.printStackTrace();
    }Also for development and testing purposes, I am running the two clients and the server on the same machine (windows xp-32b) so all of the Destination IP Addresses are 127.0.0.1. and as I said Ports that I am using are 2000, 3000, 4000 (Server, Client1, Client2).

    Hmm I have minimized the code and it seems to be working now.
    I think I have an error in the header portion of the data I am sending, where I am storing the source IP/Port and destination IP/Port. I think the server in the middle is messing these values up while sending them to the destination Client. Because the destination client actually receives the stuff and sends the reply back to the server, but the reply packet's headers has 0/0 as the dest IP / Port...
    Server is giving me java.net.BindException: Cannot assign requested address error when it tries to forward the reply it received from the client2 as the address it is trying to send is 0!
    I guess it doesnt just give this error when you try to open two sockets to the same port...
    Paul, Thanks for the direction on how to proceed... took me a while get the minimized code but at least figured out the problem. Well still have to make sure that is THE problem though :)
    As far as the statics goes how can I change those to non static ones? Where do I make an instance of the top level class that creates the threads? and how do I pass the DatagramSocket to the threads/ if I dont need to pass how do I call or use the datagramSocket I created in the top level class? I mean do I still kinda have it like a global variable on the top?? A very simple example would be much appreciated...
    I think these might be really basic questions but I am having a rough time with the hierarchy in java...

  • Any plug-in for multiple clients

    Is there any plugin for multiple client access to a given environment?
    For example:
    I have 50 clients to access the data on the server.
    Should I do a layer of manual socket connection to handle the database reads and insertions?
    Or is there a way to connect directly on the environment from clients to server?

    It is unclear in your question what database you are talking about.   Berkeley DB is an embedded database and not a client server database.  It does not have a client plugin.
    thanks
    mike

  • XI, SLD & multiple clients for DEV & QA

    <i>Ref: Re: 3rd party tech systems for multiple business systems...</i>
    I have a question regarding the avoidance of duplicated Configuration (Collaboration Profiles, Logical Routing & Collaboration Agreements) for different clients in the DEV/QA landscape.
    As we know: many projects have multiple clients in DEV and QA. Here is an example landscape:
    SXD_100 - Dev XI server
    SED_100 - config dev
    SED_200 - ABAP dev
    SED_300 - unit test
    SED_400 - sandbox
    <b>[ 1 technical system : 3 business systems ! ]</b>
    LDEV Legacy system
    <b>[ 1 technical system : 1 business system ]</b>
    SXQ_100 - QA XI server
    SEQ_100 - clean config QA
    SEQ_200 - ABAP QA
    SEQ_300 - data migration prep
    SEQ_nnn - yada, yada...
    <b>[ 1 technical system : nnn business systems ! ]</b>
    LQA Legacy system
    <b>[ 1 technical system : 1 business system ]</b>
    <b>The problem:</b>
    SED_400->LDEV is used for prototyping integration
    SED_100->LDEV is used for config development
    SED_200->LDEV is used for ABAP development
    SED_300->LDEV is used for unit tests
    Receiver Determination is able to look into the message for a <b>dynamic receiver</b>, but we are not able to have a <b>sender</b> like "SED*"
    <b>The question:</b>
    Do we really need multiple sets of configuration in the Integration Directory? Is there a way to re-use the configuration for SED_100->LDEV for the other development efforts?
    Any feedback would be greatly appreciated.
    Rgds,
    Derek

    Hi Derek,
    Since there can only one business system in SLD per client in SAP R/3.
    e.g
    SED_100   will have lets say BS_100_Dev
    SED_200  and BS_200_Dev
    In QA
    SEQ_100 -> BS_100_QA
    SEQ_200 -> BS_200_QA
    It is not possible to configure the single scenario catering the Dynamic (multiple) sender agreement to Reciever.
    But for QA you can use set transport target in SLD to reflect the BS_100_Dev -> BS_100_QA, where ever used.
    This doesnot solve the problem of  having dynamic sender service, it is just for information.
    We also faced the same problem of testing a scenario from different clients of SAP :(.
    Cheers,
    Satish

  • Multiple client chat server

    Thanks to the help I got from the good people of this forum today I modified the chat server program which I am making and now it is working a bit better. Right now it can accept several (up to 8) clients and store their open sockets in a SocketCollection list which can later be accessed so that messages get sent to all of them. Problem is that when I send a message, it is displayed instantaneously on the client that sent that message (my machine), but is displayed only after the other clients press enter on the other clients' machines (for testing purposes it was the same machine, different port opened for communication with server which is also on the same machine). To clarify that - all clients and server are the same machine (that shouldn't be a problem, right?). Code for printing incoming data for client program is below:
    while ((fromServer = in.readLine()) != null) {
                if (fromServer!=null){
                       System.out.println(fromServer);
                       System.out.println("print on client screen msg received from server");
                fromUser = stdIn.readLine();
                if (fromUser != null) {
              System.out.println("Client: " + fromUser);
              out.println(fromUser);
    }Code to deliver the message to all clients from the server application is below as well:
    while ((inputLine = in.readLine()) != null) {
                     PrintWriter multiOut;
                   for (int x=0; x<8; x++){
                         System.out.println("INSIDE MULTI-TELL FOR LOOP");
                         if (socketCollection[x]!=null){
                               Socket c=socketCollection[x];
                               try{
                                   System.out.println("tried to send to all\nSocket c = " + c);
                                   out=new PrintWriter(c.getOutputStream(), true);
                                       out.println(c.getInetAddress() + inputLine);
                                catch(IOException ioe){}
    }In the server's DOS window I can clearly see that it enters to display the message to multiple clients and it should send it. The sockets are all different and they point to different ports on different clients' machines. Maybe the problem is just in the client program's code. If you could help me out, it will be greatly appreciated. Thank you very much.

    The sockets get created one by one when each client connects. Afterwards when the thread is made, that socket gets copied into the SocketCollection array which can afterwards be accessed in order for the server to distribute the message to all its connected clients.
    The for loop in the second code example where it takes SocketCollection[x] and gets its outputStream and all that is where it prints the message and sends it to each client (sends it but it is not displayed on the client side until the client sends a message to the server again). My question is how to make it so the client does not have to send a message in order to see the server message (message to all clients) that was sent before.

  • Multiple clients with RMI

    Hi all,
    I'm quite new to developing RMI applications. I have to develop a card game where 4 players can play. How can i connect multiple clients to the server at the same tile. I have to give unique identities to each client. How can I do this..???
    Thanks for any reply!!

    That sounds like an idea. But I am really new to RMI, so do you have an example that i can go from or is there already some similar in the forum u know about ?

  • Purpose of Multiple Clients in Development Server

    can anybody tell me the advantages and
    disadvantages of having multiple clients in a
    development server?

    I don't think there is disadvantage when we have multiple clients for development system
    DEV  SAP system may have multiple clients..
    Main pupose : Changes can be client dependent or client independent
                          Client-independent effects some clients.
                          Client-dependent effects all clients.
    Let me say one example : Dev system has two clients
    100 - Here we can write the code
    200 - Testing will be here ( customizing will done here)
    http://help.sap.com/saphelp_nw04/helpdata/en/8d/933d3c3a926614e10000000a11402f/frameset.htm
    http://www.sap-img.com/general/what-is-sap--landscape.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/96/8a99386185c064e10000009b38f8cf/content.htm
    Thanks
    Seshu

  • TCP multiple client error

    HI everyone,
    I have TCP/IP server running on labview and trying to connect simultaneously with two client in two different computers using the software called Hercules. Whether it is Read or Write, labview interacting with only one client, which is connecting first. The other client software showing it was connected, but there is no shades of data in it.
    This is how labview react with client or not sure whether am making some mistake. Awaiting for the response.
    Thanks and Regards,
    Vijay
    Solved!
    Go to Solution.

    Have you looked at the 'TCP Multiple Connections' example in the Help -> Find Examples... ?
    Essentially you need to keep listening for connections and when you get one, store the connection ID for each new connection and then do your read/write on each connection ID. You could store the connections in an array and do the read/write for each one sequentially but what I tend to do (which is a more advanced architecture) is launch an asynchronous 'connection handler' VI which runs while the connection is active and finishes when the connection is closed or my application shuts down.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • Multiple clients and multiple databases on one system

    Does SAP support having a single system ( Let's call it PEQ for the sake of argument ) having multiple clients ( again, for the sake of argument, call them 200, 250, 260, and 300) allow for each client to have it's own physical database ?
    For example, here is what I would like to have set up:
    PEQ 200 - database 1
    PEQ 250 - database 2
    PEQ 260 - database 3
    PEQ 300 - database 1
    So PEQ 200 and 300 access database 1, PEQ 250 accesses database 2, and PEQ 260 accesses database 3.
    I only want to know if this is possible and if so how would you set it up.  I do not want to get into any discussion on whether this is the best way to go or not.  Any pointers to OSS notes on the subject are more than welcome.
    Thanks;
    Bruce

    > So PEQ 200 and 300 access database 1, PEQ 250 accesses database 2, and PEQ 260 accesses database 3.
    >
    > I only want to know if this is possible and if so how would you set it up.  I do not want to get into any discussion on whether this is the best way to go or not.  Any pointers to OSS notes on the subject are more than welcome.
    Simple answer: No.
    Long answer:
    - Workprocesses don't know anything about "clients". A client is nothing more than an additional field in a table with the client number. So it's not possible to configure them to connect to a certain database using a "client number".
    - A client alone has nothing but application data. It has no dictionary (tables, views) and it has no repository (source code) that can be executed
    - A SAP system (ABAP) has cross client customizing that would need to be shared somehow, technically not possible since also here the workprocess (which is the lowest unit) does not know whether a table is client dependent or not.
    Maybe there is a way to come out of this dilemma - if you tell us, what you (business) requirement is.
    Markus

  • Support multiple clients.

    hi, all
    I have some ideas on it and want to see if it makes sense. May you share your experience/expertize? thx in advance.
    The target is to support multiple clients in one server. It uses TCP socket. The design choices are:
    1. Uses one ServerSocket for one client. starts a new thread for each ServerSocket.
    2. Uses one ServerSocket for all clients. everytime accept() returns, starts a new thread for this client.
    I think #2 is better since it uses one port number and less resources.
    Any ideas?
    thx
    Tim

    You're welcome. I posted an example on a Multithreaded Server that does this, it actually uses two threads per client to provide full duplex support.

  • RMI: multiple clients for one RMI server?

    Hi,
    We're thinking of making a RMI Server.
    However, can multiple clients access the same RMI Server at the same moment?
    So, if one client is connected to the RMI Server, what will happen with the other clients that want to work to do the same thing at the same moment ?

    all over the same port?
    so for example, 100 clients can work simultaneously on this simple server?
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface OkServer extends Remote {
        public String getOk() throws RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.RMISecurityManager;
    import java.rmi.RemoteException;
    import java.rmi.Naming;
    public class OkServerImpl extends UnicastRemoteObject implements OkServer {
        public OkServerImpl() throws RemoteException {
        public String getOk() {
         return "ok";
        public static void main (String args[]) throws Exception {
              System.setSecurityManager(new RMISecurityManager());
              OkServerImpl OkSvr = new OkServerImpl();
              Naming.bind("OkServer", OkSvr);
    }

  • Multicasting using TCP/IP for Multiple clients

    Hello
     i have been watching in Find example Vi's in labview  there is are UDP multicasting receiver and sender Vi's Is there
    any available for TCP/IP for multiple clients. or any other way to broadcast the messages from server to many clients 
    Regards

    madd wrote:
     i have been watching in Find example Vi's in labview  there is are UDP multicasting receiver and sender Vi's Is there
    any available for TCP/IP for multiple clients. or any other way to broadcast the messages from server to many clients 
    OK, you are possibly confusing things. UDP is part of TCP/IP. Could it be you are trying to multicast using TCP?
    This is not possible. TCP is a connection based protocol, meaning any connection is established between exactly two partners, starting out with the three-way handshake, the data transmission and acknowledgments, and the connection tear down. This ensures complete delivery verification of all communications at the expense of the protocol overhead. (similar to a classic phone connection between two people: First you verify the right person picks up, then you talk, then say goodbye)
    UDP is a connectionless protocol, meaning any packets are simply placed on the wire and the protocol itself does not ensure any verification of delivery (similar to e.g. a radio broadcast). Any two-way communication needs to be done by the program, e.g. the receiver could send another UDP packet back to notify the sender that a packet was received.
    Broadcast and multicast packets must be connectionless. There is no way around it. You can use UDP for broadcasts and TCP for for data at the same time in the same program, but you cannot combine the two into a single connection. They don't mix.
    Maybe I misunderstood. If I did, please clarify what you had in mind. More details!
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for