Affichage des articles dont le libellé est Active questions tagged java-ee - Stack Overflow. Afficher tous les articles
Affichage des articles dont le libellé est Active questions tagged java-ee - Stack Overflow. Afficher tous les articles

mercredi 5 août 2015

How to return many HTML files together in Java servlet response?

I have a few html files each of them containing the components of my future web page. I want them to be shown if user was looking for them. But how can I show many html files together in servlet response? As I know, the code below can redirect user to only one html file.

RequestDispatcher rd = request.getRequestDispatcher("/index.html");
rd.forward(request, response);
response.sendRedirect("/index.html");

I tried to use IO streams:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    List<String> content = new ArrayList<String>();
    BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("/header.html")));
    while ((str = in.readLine()) != null) {
        content.add(str);
    }
    PrintWriter out = response.getWriter();
    for (String item: content) {
        out.println(item);
    }
}

But it gives me only java.io.FileNotFoundException:header.html. Browser says: "HTTP Status 500 - Internal Server Error". How can I solve this? Should use another way?

How to create class instance at run time using string value? [duplicate]

This question already has an answer here:

I have a class name which is in external files. I want to create an instance for that class, and all the classes having common constructor which as string type.

Example:

'while (i < getData.size()) {

            module = getData.get(i).getTestModule();
            String format = "complete.package.name."
                    + module + ".Test." + module + "Test";
            Class<?> className = Class.forName(format);

}'

can somebody tell me how to create a constructor which can hold the string as it's input argument.

I used List as "getData" to get data and store in list. and looping each value, and need to invoke actual methods in class file.

Please help me to achieve this task.

Thanks, Sasi

How to run/debug java web service project in eclipse

I have a Java Web Service project which was just handed over to me by a colleague who just resigned (no one is assisting me in my new company). Im new to Java (J2EE) and my background is .Net + frontend + azure so I am pretty much very confused with setting up and running the java project. Also, Since my background is .Net Im referencing everything with how things work in Visual Studio from running a project, setting up a project to setting up and debugging a WCF project which I realized now is very different from eclipse + java.

I would really appreciate if someone could explain to me how I can run this project which is supposedly a java web service (as I was told)?

First I have a project that is like this: enter image description here

Im assuming that the project boxed as blue is the webservice (and the rest are just libraries)? Is this correct? if so how do I run and debug the project using eclipse

Second when I click on debug as -> debug on server this is all I see: enter image description here

Another colleague told me to install JBOSS (I haven't installed a server in eclipse) because that is what they used. Is there good documentation (step-by-step guide) on how to install JBOSS to run in eclipse. Im assuming that JBOSS + eclipse is like IIS express + Visual studio. Are there also other alternatives to JBOSS + eclipse like perhaps tomcat + ecplise that I can configure.

I really really find it hard to setup the java web service project in eclipse I have little to no prior experience with java j2ee programming especially with web services so any clarifications with my questions would be much appreciated. To sum up:

  1. How would I really know that the project is a java webservice?
  2. If so, how do I run the project and host the project using debugging in eclipse with tomcat or jboss?

I would appreciate if anyone can point me to the right direction of figuring out the source code

At what point is a transaction commited?

I've read about entities lifecycle, and the locking strategies, and I watched some videos about this but I'm still not sure I understand.I understand there is also a locking mechanism in the underlying RDBMS (I'm using mysql).

I would like to know at what point a transaction is committed / entity is detached and how does it affect other transactions from a locking point of view. At what point does an user have to wait till a transaction finishes ? I've made two different scenarios below. For the sake of understanding I'm asserting the table in the scenarios contains a lot of rows and the for loops takes 10 minute to complete.

Scenario 1:

@Stateless
public class AService implements AServiceInterface {
    @PersistenceContext(unitName = "my-pu")
    private EntityManager em;
    @Override
    public List<Aclass> getAll() {
        Query query = em.createQuery(SELECT_ALL_ROWS);
        return query.getResultList();
    }
    public void update(Aclass a) {
        em.merge(a);     
    }
}

and a calling class:

public aRadomClass{
    @EJB
    AServiceInterface service;

    public void method(){
       List<Aclass> listAclass = service.getAll();
       for(Aclass a : listAclass){
           a.setProperty(methodThatTakesTime());
           service.update(a); 
       }
    }
}

Without specifying a locking strategy : If another user wants to makes an update to one row in the table and the for loop already began but is not finished. Does he have to wait till the for loop is completed ?

Scenario 2:

@Stateless
public class AService implements AServiceInterface {
    @PersistenceContext(unitName = "my-pu")
    private EntityManager em;

    @Override
    public List<Aclass> getAllAndUpdate() {
        Query query = em.createQuery(SELECT_ALL_ROWS);
        List<Aclass> listAclass = query.getResultList();
        for(Aclass a : listAclass ){
           a.setProperty(methodThatTakesTime());
           em.merge(a);
        }    
    }
}

Same question.

enter image description herewhen i create simple maven project in eclipse it gives me this error:web.xml is missing and and i tried my best but it is not solved please help

error: web.xml is missing and is set to true pom.xml /yd line 6 Maven Java EE Configuration Problem

Content of a dockerfile to run glassfish server and deploy specific application from a git repository

I am trying to deploy my java ee application using a glassfish 4.1 server and I would like to deploy it as a Docker container.

As a consequence, I'd like writing a correct docker to download/start a glassfish server and then deploy my application on it, using the corresponding GIT repository.

Currently I am able to build a Docker container starting a glassfish server with the following Dockerfile:

FROM        java:8-jdk

ENV         JAVA_HOME         /usr/lib/jvm/java-8-openjdk-amd64
ENV         GLASSFISH_HOME    /usr/local/glassfish4
ENV         PATH              $PATH:$JAVA_HOME/bin:$GLASSFISH_HOME/bin

RUN         apt-get update && \
            apt-get install -y curl unzip zip inotify-tools && \
            rm -rf /var/lib/apt/lists/*

RUN         curl -L -o /tmp/glassfish-4.1.zip http://ift.tt/1H3E7bq && \
            unzip /tmp/glassfish-4.1.zip -d /usr/local && \
            rm -f /tmp/glassfish-4.1.zip

EXPOSE      8080 4848 8181

WORKDIR     /usr/local/glassfish4

# verbose causes the process to remain in the foreground so that docker can track it
CMD         asadmin start-domain --verbose

Then, I build the Docker container (named 'myglassfish')

docker build -t myglassfish .

Finally, I launch the glassfish on my port 8080 using the following command line:

docker run -d -ti -p 4848:4848 -p 8080:8080 myglassfish

The glassfish server is correctly started because I can see the following information by taping 'localhost:8080' on my browser :

'Your server is now running...' (I cannot display the screenshot)

Now, I would like deploying my web application on that server, ideally using the GIT repository of my project (prefered solution) or a war file export of the application.

How should I modify the previous Dockerfile to load and deploy my application in the Glassfish server before starting it (I specify that I am a noob in linus and command line instructions so please be explicit in your answers)?

Thanks by advance!

Dynamically update model in java odata service

I'm currently working on java based odata service. as of now in the model layer the fields which are present in the table are hard coded with respective getters and setters.

Everything works fine as of now (typical odata service). the issue is the under lying table schema changes frequently . Is there any way to dynamically bind those fields in the model. instead of everytime changing the underlying model?

Any references or examples to it is appreciated

Do I need to include Java EE maven dependencies in POM.xml if I develop my application against Glassfish?

I am developing a Java EE application and I intend to run it on an Java EE Application Server (I have chosen Glassfish).

I know Glassfish is a reference implementation (RI) of the Java EE platform and it implements/contains individual reference implementations of the Java EE specifications. Correct me if i'm wrong but this leads me to understand that the binaries of Glassfish will contain all the relevant RIs jars inside it.

I am using Maven as my build/project management system and I will build/package my application up in a WAR file (because my application is a Java EE web application). Then I will deploy this WAR onto my Application Server - Glassfish and then it runs.

My question is, do I need to specify the Java EE dependencies in my Maven pom.xml file?

I'm using Eclipse as my IDE and at the moment I need to include those dependencies otherwise Eclipse will not recognise the Java EE sources - it will complain with compile time errors.

But if I do include in my pom.xml then does that not mean I'm duplicating the external dependencies (Java EE RI jars) in my application (in the WAR file) whereas an Application Server like Glassfish already provides it? because Maven downloads those jars and put into your code base - right?

for.eg (just using JMS as an example):

<dependency>
    <groupId>javax.jms</groupId>
    <artifactId>javax.jms-api</artifactId>
    <version>2.0.1</version>
</dependency>

do I need above? I know I definitely do if I were developing against Tomcat because it is a Servlet container and doesn't have the other full Java EE specifications.

  • this is the part where I'm a bit confused about and I hope someone will shed a light on this.

Finding source of a Gradle task

I am working with a giant codebase that is built and run using Gradle, a tool with which I personally am not particularly familiar. Nonetheless, there is a java main in the project that needs to be run fairly often in regular development, but whose classpath is miles long and whose arguments are esoteric and difficult to remember. I would like to roll the execution of this particular main into a Gradle task, which is the way that most of the other mains we need are run. However, I have no idea how to do this, and I can't seem to find the source for any of the other tasks we have. I had thought that after running

gradle tasks | grep -A<some-reasonable-number-of-lines> 'Application'

and then git greping for the task names that popped up, I would be able to find the source for our other tasks and simply emulate that. But the tasks named by gradle tasks don't actually seem to exist anywhere aside from the output of that command. In a project with more build.gradles than I can count, I am lost as to how to go about finding the source for a particular task. Advice?

Glassfish Connection could not be allocated because: Identifier name '...' is too long

So Im trying to run a Java EE project that was developed a couple years ago and Im getting this error:

Connection could not be allocated because: Identifier name 'c:\glassfish-3.0\glassfish\domains\domain1/lib/databases/ejbtimer' is too long

Trying to run it on JDK7 and GlassFish 3

Tried searching for anything similar but to no avail

Any suggestions as to what is the cause/how to solve it?

Java: Which File reading Writing IO class to use and when?

As we all know with Java comes the very complicated list of IO classes plus there is another thing called NIO.

  1. I was wondering if there is some tutorial/advice that could explain the situations and best IO to use for the problem( considering Web development in mind ).

  2. I always get confused which one to use when, another query is How should I remember the implementation of all these classes. It get confusing all the time

PS : I know this question may sound stupid to some developers, but It's asked because I am curious and I really think it's complicated compared to collections,multithreading etc.

Using javascript to Auto-populate Gender and Date of birth field from the ID Number field

i am working on a java project(java EE). I want to get values for the Gender and Date of Birth from the ID Number using javascript. I am a South African. Example610731 0 094 0 82). 610731 = my date of birth

0 = Individuals sex: Any number between 0-4 shows that I am a female, whereas any number between 5-9 indicates a male

094 = I was the 94th person registered at Home Affairs as a female born on 31st July 1961. If more than 999 individuals are registered on a particular birth date then the sex flag would be incremented by 1. eg: if I were the 89th male born & registered on a particular date, these middle numbers would read 5089, however, if I was the 1671st male born and registered on a particular date, the middle numbers would read 6671.

0 = I am a SA citizen (if I was a non-SA citizen this would be a 1) * Refer to notes below

82 = this is a check sum that passes the Home Affairs algorithm the make the ID number valid.

please help

Cannot understand reason for compiler warning

I'm using Java reflection in my code and I could see couple of warning notification as below:

Source code:

Class<?> c = Class.forName("complete.package.name.RegressionBuild");
RegressionBuild regression = (RegressionBuild) c.newInstance();
String methodName="debitCardDetails";
Method runtimeMethod = RegressionBuild.class.getDeclaredMethod(methodName, null);

Error:

The argument of type null should explicitly be cast to Class[] for the invocation of the varargs method getDeclaredMethod(String, Class...) from type Class. It could alternatively be cast to Class for a varargs invocation

Can somebody tell me the reason for this warning and how can i resolve it?

Also the following line throws these warning messages:

Source code:

String exeMethod = (String) runtimeMethod.invoke(regression, null);

Error:

The value of the local variable exeMethod is not used

The argument of type null should explicitly be cast to Object[] for the invocation of the varargs method invoke(Object, Object...) from type Method. It could alternatively be cast to Object for a varargs invocation

However, It returns proper method, also printed null value in output console.

Can somebody assist me to solve this issue.

Tooltwist Stack trace after log in to designer: "com.dinaa.xpc.XpcConfigException: Unknown user type: 'phinza'"

I am getting this error after I log in and access the ToolTwist designer after deployment:

Stack trace:
com.dinaa.xpc.XpcConfigException: Unknown user type: 'phinza'
at com.dinaa.xpc.backend.XpcSecurityImpl.login(XpcSecurityImpl.java:296)
at com.dinaa.xpc.XpcLogin.login(XpcLogin.java:51)
at com.dinaa.xpc.XpcLogin.login(XpcLogin.java:80)
at tooltwist.basic.LoginServlet.doPost(LoginServlet.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.myrp.util.XSSFilter.doFilter(XSSFilter.java:22)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1721)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1679)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

What are the possible errors that could lead to these stack traces and how could I fix it?

mardi 4 août 2015

Maven: javax.enterprise.context.ContextNotActiveException while running tests with openejb

I've created some unit- and integration tests for mine Java-ee project with the help of OpenEjb and Junit with an embedded container. The tests are running fine in Eclipse, beans(CDI/EJB) are injected and working fine. But when I start the tests with maven and surefire, I get the following error:

WARNING: Handling the following exception
Throwable occurred: javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @RequestScoped does not exist within current thread
at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:330)
at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:88)
at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.get(NormalScopedBeanInterceptorHandler.java:70)
at org.apache.webbeans.conversation.ConversationImpl$$OwbNormalScopeProxy0.isTransient(org/apache/webbeans/conversation/ConversationImpl.java)
at org.apache.wicket.cdi.ConversationPropagator.onUrlMapped(ConversationPropagator.java:322)
at org.apache.wicket.request.cycle.RequestCycleListenerCollection$9.notify(RequestCycleListenerCollection.java:208)

What could be wrong? It looks like a classpath issue or something, but explicit adding openwebbeans-spi and openwebbeans-impl didn't work.

I use the following lines in the testclass:

@ClassRule
public static final EJBContainerRule CONTAINER_RULE = new EJBContainerRule();

@Rule
public final InjectRule rule = new InjectRule(this, CONTAINER_RULE);

And I've the following openejb-junit.properties:

openejb.validation.output.level=VERBOSE
openejb.deployments.classpath.include=.*org.mine.*
openejb.descriptors.output=true
openejb.ejbcontainer.close=single-jvm
java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory

Thanks for any help.

Greetings, Huls.

How to handle pinging remote servers in Websockets?

I have a web interface through which I can perform/apply actions on backend systems like Hadoop. I am trying to code a functionality which allows me to track the status of the server. Basically to see if the server/service is up or down. I need to do this every 2 minutes. So should I go with a Websocket or a SSE(Server Sent Event) for this..I have written this code to perform this. However the moment I code for checking the status every 2 minutes. It becomes a blocking call and I am unable to perform any other functionality of the Web UI

Following is the Code

import java.io.*;
import java.net.*;
import java.util.concurrent.TimeUnit;

import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

@ServerEndpoint("/echo") 
public class Websocket {

@OnOpen
public void onOpen(Session session){
System.out.println(session.getId() + " has opened a connection"); 
    try {
        session.getBasicRemote().sendText("Connection Established");
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}
@OnMessage
public void onMessage(String message, Session session){
System.out.println("Message from " + session.getId() + ": " + message);
    try {
        Integer a;
        a=message.length();
        if (a==4)
        {

            onping(session);
        }
            else
        {
        session.getBasicRemote().sendText(message);
        }

       } catch (IOException ex) {
          ex.printStackTrace();
       }
      }
public void onping(Session session) throws IOException

 {    if (session.isOpen())
 {
 session.getBasicRemote().sendText("In PING");
 String ip = "200.168.100.46";
     InetAddress inet = InetAddress.getByName(ip);
 if(inet.isReachable(50075))
 {
     session.getBasicRemote().sendText("Alive");

 }

   }
 else 
  {
  System.out.println("Error");
  }

   }
@OnClose
public void onClose(Session session){
System.out.println("Session " +session.getId()+" has ended");
}
}

And the Client Side Code is

 <!DOCTYPE html>
 <html>
 <head>
    <title>Websocket</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
 </head>
 <body>

    <div>
        <input type="text" id="messageinput"/>
    </div>
    <div>
        <button type="button" onclick="openSocket();" >Open</button>
        <button type="button" onclick="closeSocket();" >Close</button>
        <button type="button" onclick="pingSocket();" >Ping</button>
    </div>
    <!-- Server responses get written here -->
    <div id="messages"></div>

    <!-- Script to utilise the WebSocket -->
    <script type="text/javascript">

        var webSocket;
        var messages = document.getElementById("messages");


        function openSocket(){
            // Ensures only one connection is open at a time
            if(webSocket !== undefined && webSocket.readyState !== WebSocket.CLOSED){
               writeResponse("WebSocket is already opened.");
                return;
            }
            // Create a new instance of the websocket
            webSocket = new WebSocket("ws://localhost:8080/Websocket/echo");

            /**
             * Binds functions to the listeners for the websocket.
             */
            webSocket.onopen = function(event){
                // For reasons I can't determine, onopen gets called twice
                // and the first time event.data is undefined.
                // Leave a comment if you know the answer.
                if(event.data === undefined)
                    return;

                writeResponse(event.data);
            };

            webSocket.onmessage = function(event){
                writeResponse(event.data);
            };

            webSocket.onclose = function(event){
                writeResponse("Connection closed");
            };
        }

        /**
         * Sends the value of the text input to the server
         */
        function send(){
            var text = document.getElementById("messageinput").value;
            webSocket.send(text);
        }
       function pingSocket(){
            var text = document.getElementById("messageinput").value;
            webSocket.send("PING");
        }
        function closeSocket(){
            var text = document.getElementById("messageinput").value;
            webSocket.send(text);
            webSocket.close();
        }

        function writeResponse(text){
            messages.innerHTML += "<br/>" + text;
        }

    </script>

</body>
</html>

So can you let me know what am i doing wrong?

Thanks

Deployed the Java based application in OpenShift but still the default openshift webpage is showing up

I am trying to upload my Java Based application on the open shift cloud. The step which i had followed are:

1) Sign Up for the Open Shift account.
2) Logged in to my Account.
3) Created an new application with the following cartridges
a) Tomcat 7 (JBoss EWS 2.0)
b) MySQL 5.5
c) phpMyAdmin 4.0
4) Installed the ruby version and git bash for windows.
6) Both are installed correctly when i saw their version number.
7) Installed OpenShift Client Tool rhc through ruby gem. The command is gem install --source http://rubygems.org
8) Setup openshift account to work from Bash using rhc setup command.
For the 1st time it asked me my openshift username and password. Then it generated a tokens and saved it in my .ssh folder.
9) Using putty generator i created the private key.
10) I created the WAR file for my application with the changed connection url as jdbc:http://mysql${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/affablebean and updated the username and password as per open shift MySQL credentials.
11) Renamed the war file as ROOT.war.
12) I am using FileZilla FTP for deploying WAR file. I placed ROOT.war file in app-root/dependencies/jbossews/webapps/ folder.
13) Then i am restarted the application server using command:

ctl_all restart

14). Now i am accessing the application by my url.I am getting the same "Welcome to your JBossEWS (Apache/Tomcat) application on OpenShift".

Why this is happening? Is there any way to track whether the WAR file is deployed or not?. Or tomcat server file?

Please help me.Had i followed the above mentioned step correctly or not?

What is MQ and how is it used in an OpenStack deployment and Java EE applications?

I have a job interview in a couple days and they are looking for experience with MQ in an OpenStack and Java EE environments.

I have lots of Java and Java EE experience, and I've done some basic OpenStack tutorials, but I don't really understand what "MQ" is and what it's used for.

Can someone give me a good answer: What is MQ and how is it used in an OpenStack deployment and Java EE applications?

available tools to measure JSF applications performance

What are the available tools that could be used to measure the performance of a web applications developed by JSF framework > . Free and open source tools are preferred.

Default Blank Item in f:selectItem dropdown list

I am creating a dropdown menu. I am using the attributes such as hideNoSelectionOption, noSelectionOption, itemLabel="", and itemValue="#{null}" to have a default value that is a blank value and is the first item shown when the page loads. Instead, when the page loads, the default item shown is the last item in the list. One fix I had was putting a blank item last in the list, but I don't like that fix as I want the blank item to be first in the list, and the default item shown when the page loads. Any Suggestions?

                 <tr class="contentRow">
                    <td><span> <h:selectOneMenu
                    styleClass="selectOneMenuLeft" id="menuProgramType" value="#{searchBean.selectedSearchType}"
                    onchange="javascript:displayDivs();" hideNoSelectionOption="true">
                    <f:selectItem noSelectionOption="true" itemLabel=""/>
                    <f:selectItem itemLabel="Item1"  />
                    <f:selectItem itemLabel="Item2" />
                    <f:selectItem itemLabel="Item3"  />
                    <f:selectItem itemLabel="Item4" />
                    </h:selectOneMenu></span></td>

                    <td><span> <h:selectOneMenu
                    styleClass="selectOneMenuLeft" id="menuSystemOfOriginType" value="#{searchBean.selectedSearchType}"
                    onchange="javascript:displayDivs();" hideNoSelectionOption="true" >
                    <f:selectItem itemLabel="" itemValue="#{null}"  noSelectionOption="true" />
                    <f:selectItem itemLabel="FirstItem"  />
                    <f:selectItem itemLabel="SecondItem" />
                    <f:selectItem itemLabel="LastItem"  />
                    </h:selectOneMenu></span></td>
                </tr>