How To Pupulate A Combobox on Page Load in JSP

Hi All,
How to populate a combobox on a JSP Page load.
Please help.
Regards,
Dinesh

Thanks,
My current coding in jsp is :
To get the ArrayList from my DAOImpl class.
<%
newAppDAOImpl dao = new newAppDAOImpl();
dao.populateCombo(request);
ArrayList filetypes = (ArrayList)request.getAttribute("FILETYPES");
if(filetypes==null)
filetypes=new ArrayList();
pageContext.setAttribute("vecFileType" ,filetypes) ;
%>
For populating the combo:
<html:select property="retailer" onclick="/search">
<html:option value="----Select----"/>
<html:options collection="vecFileType" property="value"
labelProperty="label"/>
</html:select>
The above code is working for me.
Regards,
Dinesh

Similar Messages

  • How to execute a method after page Load?

    My question is very similar to what was discussed in following thread:
    How to execute a method after page Load?
    My requirement is that I want to run a method in backing bean of a page, immediately after the page gets loaded. In that method I want to invoke one of the method action included in the pagedef of this page, conditionally.
    I tried using the approach given in the above thread, i.e to use <f:view afterPhase="#{backing_security.setPermPriv}">, but the problem is that our page is not using 'f:view' , so I explicitly added one f:view with afterPhase property set , but it is not working, page it self is not getting loaded, it is throwing the error:
    Root cause of ServletException.
    java.lang.IllegalStateException: <f:view> was not present on this page; tag [email protected]e8encountered without an <f:view> being processed.
         at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.setProperties(UIXComponentELTag.java:108)
         at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:733)
         at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1354)
         at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:71)
         at oracle.adfinternal.view.faces.taglib.UIXQueryTag.doStartTag(UIXQueryTag.java:41)
         at oracle.adfinternal.view.faces.unified.taglib.UnifiedQueryTag.doStartTag(UnifiedQueryTag.java:51)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:262)
         at oracle.jsp.runtime.tree.OracleJspNode.execute(OracleJspNode.java:89)
         at oracle.jsp.runtimev2.ShortCutServlet._jspService(ShortCutServlet.java:89)
         at oracle.jsp.runtime.OracleJspBase.service(OracleJspBase.java:29)
         at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:665)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:387)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:822)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:746)
    Please help to resolve this issue, or am I doing anything wrong?

    Hi,
    I assume that your view is a page fragment and here - indeed - the f:view tag cannot be used. If you use ADF then one option would be to use a custom RegionController on the binding layer to listen for the render phase to invoke the method. Another option would be to use a hidden field (output text set to display="false" and have this component value referencing a managed bean property. The managed bean property's getter method can now be used to invoke the method you want to run upon view rendering
    Frank

  • How to call java method on page load?

    How to call java method on page load?
    Thanks

    Hey Dan,
    Well, if you want to execute a java method when page is load, you need to put the clientlistener in af:document. Let me to show you an example (I can't find my post :P),
    JSPX page:
    <f:view>
    <af:document>
    <f:verbatim>
    <script>
        function loadPage(event) {
            alert('Hello World!');
    </script>
    </f:verbatim>
    <af:clientListener method="loadPage" type="load"/>
    </af:document>
    </f:view>If you try this code you can see that when the page has been load, you recieve the alert "Hello World!".
    Furthermore, this is the javascript AJAX function that let you to call a servlet:
    function ajaxFunction () {
        var httpRequest;
        if (window.XMLHttpRequest) {
            httpRequest = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            httpRequest.overrideMimeType('text/xml');
        httpRequest.onreadystatechange = function() { alertContents(httpRequest); };
        httpRequest.open('GET', '/appname/servletname', false);
        httpRequest.send('');
    function alertContents(httpRequest) {
        if (httpRequest.readyState == 4) {
            if (!httpRequest.status == 200) {
                alert('Request error. Http code: ' + httpRequest.status);
    }Where 'appname' is your application name and 'servletname' is the name of the servlet that you want to call. Obviously, you can call any URL ;)
    JVN

  • How to access the URL on page load and open it in the new tab of browser

    Hi All,
    I am using Jdeveloper 11.1.1.5 and i have one page "Hello.jspx" and one data control consist of two attributes :-one is "id" and other is "url".
    The datacontrol has been created from the WebService.
    Now my requirement is : -
    whenever i run the page "Hello.jspx" , then on page load the url attribute should get accessed and should be opened in a new window or tab of the browser.As the url contains the information about the document.
    Hello.jspx page doesn't contain any bindings of the url attribute.
    I had thought of using the PhaseListener class and use the onPageLoad method .But how do i get the url from the dataControl and open it in the other tab of the browser on page load.
    Please suggest!!!!
    Thanks.

    Hi,
    I don't think this can be done this way. I would think that you need to execute JavaScript upon Hello.jspx load to open a new window and pass the URL to it
    Frank

  • How to call a action on page load in jsf

    Hi all,
    i am having a JSF page where i want to display the records from the datatable. I have a method in bean which call database and gets the list of records. If i call this method from a link (action on this link) present on this page i can display the records on this page.
    But i want to display these records at the time of page load only. How we can do this? How to call a action at the time of page load?
    Thanks in adv.

    If i am calling the database class and get the list in constructor only i am able to display list in the datatable on page load. This works fine. But the requirment is that if there are no records in the list display a error page with message-No records found! . But how i can navigate from the constructor to error page?
    Like-
    class MyBeam{
    MyBean{
    private List requestVOList = null;
    MyDao dao = new MyDao() //for fetching list from DB
    List records = dao.getList()  //get list from dao class
    if(records==null)
        //Navigate to error page. How to do this navigation here?
    else
        requestVOList  = records;
    //setter/getters for requestVOList 
    }

  • How to refresh canvas on every page load?

    Hi,
    I have a <canvas> added for electronic signature. Electronic Signature using SAPUI5?
    As there is no UI5 control I am adding the canvas from controller to xml view having  <core:HTML id="signature" width="100%" />
    When the page is loaded for the first time it works  fine but on successive load of the page, canvas is not being refreshed with different signature. I am getting data from backend as OData but I cant bind the property so that on model change canvas would refresh.
    How to fix the issue of canvas refresh on every page load?

    Hi Dennis,
    There is a slight error in your code: the last Undo button is missing a closing } for the press function, and the 'enabled' property contains a rogue comma, but other than that, kudo's for your work here!
    Rashmi, it seems like Dennis Seah has created the perfect case on why you should consider writing your own custom control instead of using the standard <canvas> element

  • How to display a combobox(dropdown menu) in a jsp page?

    Hi friends,
    I need to create a jsp page which contains three text fields and a single dropdown menu,,, . and my functionality is while loading the page itself that dropdown menu gets the data from database and holds in it..... i mean the data in theat combo box must gets from Database and based on the particular selection the remaing fields has to be filled ...... so plz helpme to solv this and any help is appriciated....
    regards
    priya......

    Hi,
    Google should definitely help you with this. I am sure that there may be people here who will guide you through each step in this forum. But, you learn only when you do things yourself. Please take some time to go through the links in google. You will definitely find all the things required to solve your problem.
    1) JDBC examples to populate your dropdown.
    2) DHTML+Javascript to handle selection/display of fields.
    You can come here for help only after you have tried to some extent and not able to proceed with something. Trust me, you should be able to do it yourself.
    Karthik.

  • How to use javafx in web page written in jsp or jsf

    Hello
    How can we include our demo of javafx, that come with netbeans IDE , into my web page in JSP or JSF.
    Regards
    Rajnish Chauhan

    You just have to add it like and applet , including this line in your JSP or JSF
    <script src="http://dl.javafx.com/dtfx.js"></script>Then add the applet
    <script>
        javafx(
                  archive: "./resources/jar/Draw.jar",
                  width: 400,
                  height: 200,
                  code: "Draw",
                  name: "Draw"
    </script>./resources/jar/Draw.jar - is the path and the name of the jar

  • How to read XML from web page inside servlet/jsp ?

    i have a url, which on sending request, shows XML in browser.
    Now i need to read this XML in browser and then manipulate it according to my need and display it on another page.
    actually the process is. :
    1) i have to first retrieve an xml from other site. (XML will only be shown in browser)
    2.)then i have to read the Xml and show it in according to my requirements.
    Is there any way to read XML directly from a Web Page ??
    is their logic to accomplish this.
    e.g in Servlet i can do somewhat like this :
    String wholeXml=Somemethod(url);
    Please Advice

    Hi,
    if u wanna extract data from XML. you can use Digester(Apache-jakarta) parser. All u need to create the beans(as per the data in xml), that will be populated by Digester.
    Digester takes xml(string) as parameter and populates the bean specified.
    U can use this bean in ur JSP.
    :::Note:::; use Digester in ur servlet.
    for more read:::
    http://www.onjava.com/pub/a/onjava/2002/10/23/digester.html
    I hope it shall work..
    @mit

  • How to hide business process stage on page load in crm 2013

    Please tell me how to hide process stage on page load in crm 2013.
    for example: Develop, Propose,Quotation... these are business process stages and I have a custom field named "type"
    If type value =1 then hide Propose stage

    Hello,
    That is not possible. What I would suggest is to create several processes for same entity and switch between them using plugin. Sample code for it -
    https://deepakexploring.wordpress.com/tag/updating-process-id-in-crm-2013/
    Dynamics CRM MVP/ Technical Evangelist at
    SlickData LLC
    My blog

  • Is there any way to change page-loading status indicator?

    i dig firefox 4 for the most part. i customized the layout to my liking. what i can't stand and can't figure out how to modify is the little page-loading status indicator. i absolutely hate the gray captive-ball lookin' thing that runs counter-clockwise and then turns around and becomes a green clockwise-turning circle. HATE IT. i see i can get the old-school status indicator (clockwise-turning circle of dots) but even if that's working in the toolbar the hideous new one is churning away on the tab. i know this is simply a matter of aesthetics and not really a problem, but... MY EYES... my god, my eyes... make it stop...

    No.

  • Topic: Page Load - is this doable?

    I searched for this in the forum but couldn't find anything...except others facing the same issue (in other forums)...
    Here is the problem:
    My website will get users directed from a gateway which already authenticated them (two factor etc..). Their authenticated ID will be in the HTTP header I get for each request...so far so good...
    The first thing I want to do is instantiate a user object that stores their userID in the HTTP header. So, (in 'kinda' psuedo code), here is what I want to do:
    if (!user.isauthenticated()) {
    - extract the authenticated ID from the http header.
    - store the ID in the user object.
    - user.setAuthenticated(true)
    - Display - "Welcome User" Page
    But, as a newbie to JSF, I can't figure out how to execute a type of "page load" which calls this type of function on a bean without any user interaction.
    I have thought of:
    - in a user constructor: but not sure how to link it.
    - index.jsp page which display's the userID using a user.getUserID()
    function and times out to another page?
    They both look like hacks to me. I am sure many others must have come across this problem before - whats the trick please?
    thanks!

    I was puzzled in that you asked a SQL Server question in one post and then in another thread asked a Oracle related question... and then I noticed you had cross posted one of your questions at JavaRanch and I was more annoyed....
    and then I found this....
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=10&t=002447
    You sir -> Michael Byrd -> are scum sucking dirtbag.
    To quickly explain. Mr. Byrd posts his messages (which he copies wholesale from other posters) so that he can get better google caching for the website listed in his profile.
    This is such scummy behaviour I don't even know what to say. Other than basically everyone that has ever helped you had totally wasted their time.
    You are scum. Your company is scum. I hope you rot in hell.

  • Puzzling error on programmatic page load

              I sincerely hope someone can help me here. I have no idea what's causing this
              particular error:
              <Oct 1, 2002 5:04:03 PM PDT> <Error> <HTTP> <101017> <[ServletContext(id=5808049,name=onstream,context-path=/onstream)]
              Root cause of ServletException java.lang.NullPointerException
              at jsp_servlet.__index._jspService(__index.java:255)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
              at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5360)
              at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
              Since that error is all fairly internal to WebLogic's servlet service, I have
              no idea where to start looking for a solution.
              Here's what I'm doing. I have a JSP page with access to some session beans.
              I'm not using any servlets, just JSP. The initial page load (index.jsp) is successful
              and populated with dynamic data. I then have a form submit that occurs that posts
              to the same page (index.jsp) which checks for the form variables at the top of
              the page.
              The user logs in, loads index.jsp, clicks on a link that launches the form submit,
              and index.jsp should pop back up with new data populated based on the user's selection.
              Instead, I get the exception shown above on mouse click.
              Any insight would be appreciated! Am I not allowed to request the JSP page in
              this manner? Is it possible that the error is in my JSP code, or is it a security
              violation of some sort? A misconfiguration?
              Thanks!
              

              "Eric Lai" <[email protected]> wrote:
              >
              >That's a fantastic suggestion actually--thanks. I didn't even think
              >to look for
              >that file.
              So the problem turned out to be the classic stupid java error whereby I was checking
              for string equality in an if statement using (String == String) rather than String.equals(String)
              method.
              Thank you, Kevin and Ann, for pointing me in the right direction.
              However, I am still not able to get the server to stop deleting the generated
              .java file. In order to grab __index.java I had to ctrl-c the command window
              immediately after the file had been generated. Kind of silly, but it worked.
              If anyone can tell me how to get it to save the files generated from Jsp2Java
              I'd greatly appreciate it.
              Thanks!
              >
              >However, the file does not exist apparently. The console tells me that
              >it has
              >created the file in the following directory:
              >
              >Generated java file: C:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\onstream_onstream_1754841\jsp_servlet\__index.java
              >
              >However, all that resides in this directory is __index.class. It seems
              >that whatever
              >file is being generated is also being deleted after compilation.
              >
              >Is there a flag I can set that prevents this? I'm sorry if my ignorance
              >is shining
              >brightly.
              >
              >"Kevin L. Burns" <[email protected]> wrote:
              >>Go have a look at __index.java line 255. That is the Java code that
              >>was
              >>created from index.jsp. You should be able to figure out where in
              >>index.jsp you have a NullPointerException happening.
              >
              

  • Need to update a record on page load. How? (ASP/VBScript)

    The standard Update Record behavior requires a form on the page, plus a recordset to identify the value to be updated. In my scenario, the value for the record to be updated is already in the URL as the ID. I just don't know how to write it myself and Dreamweaver won't do this.
    The page I want to do this on is a record detail page, so there is already a record ID already present in the querystring. The record is new until a user views it, and what I need is something that just writes a simple value to one field in the table for the record being viewed. This is it in a nutshell:
    Using the value from the ID in the URL querystring, update the "viewed" field in a specific table with the value of "y".
    This would be the first operation as the page loads and then the page would load and show the data that it already does.
    I'd be happy with raw code is someone is generous enough to provide that, or perhaps some instructional help on reverse engineering the standard update record code generated by Dreamweaver. Or, if you know of any extensions designed to do this - I'd be interested in that too!
    My app I'm working on is in ASP/vbscript.
    Subject line edited by moderator to indicate server model

    Good point! I wasn't thinking about how that would make the app vulnerable to sql injection.
    The function I want to perform is similar to how an email changes from unread to read when you view it. I simple want the records being viewed to take on the status of being read or "viewed". Perhaps I'm going about this in the wrong way, but I've been planning to use a database field as the indicator of whether a record has a viewed status or not. Null value is new, and a value of "y" (yes) meaning the value is viewed/read.
    If you have a better recommendation, I'm all ears.

  • How do I block advertisement pages loading before the page I want?

    I keep getting advertisement pages before the page I want will load and I have to click a "skip this ad" on the top right before I can get the one I want to load. It happens when I start the browser and wont let my home page load until I click the "skip this ad". It just started doing this after updating to Firefox 12.0 and I already have Ad Block Light with the what ever it's called I had to add to it before it would work. But its not working right or maybe not at all.
    When I search for something in Google or Yahoo and click on something, instead of that I get a ad page first. When I click a link to another page I get a ad page first, when I use a bookmark for a page I get a ad page first. How do I stop this?

    Are you getting this ad page on every single website you go to, or just a few?
    If it's everyone, I'd suspect a virus or some sort.
    You can try some of the following programs to scan for malware:
    * [http://www.malwarebytes.org/mbam.php MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/faq/?qid=208283363 TDSSKiller - AntiRootkit Utility]
    * [http://windows.microsoft.com/MSE Microsoft Security Essentials] (A good permanent anti-virus if you don't already have one)
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Also, make sure to update to Firefox 14, and then Reset Firefox if you are still having trouble. [[Reset Firefox – easily fix most problems]]

Maybe you are looking for

  • NI-DAQmx VisualStud​io C++ 6 Single point analog output

    Specs: NI-DAQmx 7, VisualStudio C++ 6.0,  PCI-6722,8channel AO We have a very simple application: set a voltage (actually 6 channels) and keep it until we want it changed again, perform the change very quickly in response to an image capturing algori

  • HT1296 how can i transfer non authorised music from my ipod to computer

    I recently formatted my laptop and had to re-install itunes without having saved or backed up content which i'd added from my laptop. However music files which I had on my ipod (that were not purchased from itunes) are still there and I don't seem to

  • Conversion to 9.0 from 8.0 lost ability to append emails to file

    We had everyone in the office on Acrobat 8.0 and Reader 8.0. I converted to Acrobat 9.0 and Reader 9.0.  I have since converted Reader back to 8.0 due to printing issues. I still use Acrobat 9.0.  The Outlook AdobePDF tab conversion setting is Acroba

  • SQVI: How to change Column heading

    All SAP Gurus, In SQVI system gives the default heading to each column. We want  to change the description of that heading, is it possible? Regards,

  • HashMap or Treemap Help needed

    Hi all. I have posted some code up in java programming but so far the returns i have been given are to comlicated for me to understand. I am only a novice at java, and i have been given an assignment which involves connecting multiple clients to a se