Use Select Value in JSp on same Page

Sir,
In my Jsp page there is one dropdown,sir i want to get that select value in same page so that i can display data on same page below the dropdown based on the <select> value.
Is it possible to do this things.
Plz reply Soon.
Thanks,
Regards,
Ashish

I ideally start by reducing the 2-page functionality - of form page and action page - to just one. It goes like this:
<cfset isValidationPassed = false>
<cfif isDefined("form.someVar")>
<!--- Do validation. Validated form implies isValidationPassed is true --->
</cfif>
<cfif isValidationPassed>
<!--- Do action page stuff --->
<cfelseif NOT isDefined("form.someVar") OR NOT isValidationPassed>
<!--- Display the form. --->
<!--- If form had been submitted, inform user which validation failed, and what to correct. Display the form. --->
<cfoutput><form method="post" action="#CGI.SCRIPT_NAME#"></cfoutput>
</form>
</cfif>
The idea is then to pile on the complexity, layer by layer.

Similar Messages

  • Use select & update(query) at the same time

    I'm sorry to trouble you.
    I am racking my brains to find a solution to the problem.
    I don't search a problem in my source.
    I maked every effort.
    I am tired to death.
    I wanna use (select & update(query)) at the same time.
    The Source compiled but have not access to DB
    plz help me.
    Can you give me a hand?
    sorry my bad English..
    link my source
    http://www.netian.com/~111nice/bangnew.java

    can you clearly explain whats problem and what error your are getting

  • Using spry select on multiple forms in same page

    Greetings-
    My apologies if this has already been answered but after a few searches I've not found my solution....
    I have a web page with 2 different forms (completely different open form and close form tags) that I'm trying to get the Spry Select Widget to work in.
    Both forms' Spry Select widgets interact as expected with the user with one exception; the second form continues to submit to the action page even if the user is trying to submit an invalid value (the docs suggested using the value of -1 so that's what I'm using). The appropriate error gets displayed to the user but the form continues to submit, which I don't want. Is there a limitation that I missed regarding the use of multiple forms in the same web page with the Spry Select Widget?
    FWIW, I'm running the app on ColdFusion and even the cfform/cfselect won't work with the Spry Widget.... I've named and id'd all forms and form elements and still no luck.
    Any ideas?
    Thanks in advance,
    Rich

    Hi Brad,
    The preamble looks reasonable.  I would like to make sure you are clear on the process.
    The data needs to be rendered twice (i.e. a 2 step job).  In the first step you create a trace file with the page count for each document in it...\trace"^define User:PageCountForTrans_@:TransCount. @$page.@LF."."
    In the second step, that trace file is brought back in as a preamble file.
    Please confirm that you are in fact passing the data twice.
    cheers
    Chris

  • Navigate from tree selection to parameterized report on same page

    I have a simple tree showing the departments and roles within our organization.
    I have a simple report showing the skills required for each node in the tree, sometimes general skills that apply to whole department, sometimes specialized skills for the roles within a department.
    I've created a page that has two regions. I managed to get the tree on the left and report on the right by including the two regions in the same display point and changing the column of the report to "2".
    When I click a node in the tree, I want the ID behind the selection to be passed to the simple report. The report will show the skills mapped to the selected node in the tree.
    But since the report is on the same page, I imagine this might be a bit tricky. When the user clicks a node, the whole page would have to be refreshed, preserving the tree expanded to the point where the user clicked, and running the report with the now filled ID.
    In order to do this, I guessed I'd need an application item that preserved state. I created item F1000_OU_ID.
    The SQL for the tree is :
    select "OU_ID" id,
    "PARENT_OU_ID" pid,
    "OU_NM" name,
    'f?p=&APP_ID.:1:&SESSION.::NO::F1000_OU_ID:'||"OU_ID" link,
    null a1,
    null a2
    from "#OWNER#"."TR_OU"
    order by seq_num
    The SQL for the report is:
    SELECT s.skill_type,
    s.skill_nm
    FROM tr_skill s,
    tr_ou_skill os
    WHERE s.skill_id = os.skill_id
    AND os.ou_id = :F1000_OU_ID
    Under the report region, I gave it a conditional display directive to not display until F1000_OU_ID was not null.
    That's as far as I've gotten. The page runs. The regions display where I want them. But when I click nodes in the tree, the page blinks and nothing happens to the report. What am I missing Aces?
    bc

    200 views and 1 reply? Come, come, Aces, you can do better than that!
    Leo, thanks for taking the time to look at it. As I understand it, the "bind" or "host variable" syntax of preceding colon, e.g. ":F1000_OU_ID" is used when referring to application or page items from a SQL Query. The "substitution" syntax of preceding ampersand and following period, e.g. "&F1000_OU_ID." is used when referring to application or page items from things like HTML text.
    To verify this, I used one of the blank pages in my app, page 5. I created two regions, one HTML text, one a report based on a SQL Query.
    For the HTML text, I typed in
    Here is the application item value &F1000_OU_ID..
    For the report's SQL query, I typed in
    SELECT 'OU_ID selected is ['||:F1000_OU_ID||']' text
    FROM dual
    These both work as expected. After I have clicked on a node in Page 1's tree, the F1000_OU_ID is set to a value and that value then appears on page 5 in the two test regions mentioned above.
    So I have no trouble passing stateful values between different pages. My problem, perhaps poorly worded in the original post, is how to "pass" the selected value to the same page, since clicking a link in the tree refreshes the page it is on, in order to pass the value to the report region on the same page.
    If anyone has done this before, please chip in or point me to the thread. Various searches in the forum were just coming up with too many non-relevant results, so I thought I'd ask the experts. Thanks in advance!
    bc

  • LOV SELECTION AND REPORT ON THE SAME PAGE

    Hi Friends ,
    Here is what i am requesting your help ...My requirement is to show one dropdown /lov and a report underneath it ..like if you have selection 1.pa 2.ky 3.ny 4.nj
    in the lov and if user selects nj onchange the report should show up on the same page ??? Is it possible in portal using forms and reports or ?? If so please help ???
    Vis

    Hi,
    You can use javascript to do this. In the onChange event you can call a new url.
    window.open(new_page_url_with_report);
    Thanks,
    Sharmila

  • Select Query and Recordset on same page

    I have been workig with Coldfusion for a while now.  Where I work there is a need for web pages to extract data from data sources.  I have been successful at doing this.  Typically I use a form that selects multiple criteria, which when submitted loads a target/action page that displays records that are filtered based on the SQL statement contained on that action page.  What I do is to conditionally check if criteria is passed using cfif.  And if a field parameter is indeed passed it becomes part of the cfquery.  This works out well - especially for reporting.
    But now I am seeing more and more a need to accomplish the same process - but on a single cfm page.  So the page I seek will have both the form (select) and the recordset results on the same page. 
    In this exercise I will be caching results od a query and having several queries to further refine what I seek (QOQ).  What I am seeking is the best practice to follow, I was thinking that using an iframe on the page would be and adequate solution whereby the query would pass the criteria and its form action would pass the variable(s) to the action page, which would be the source of the iframe.  But I am not certain that this is a best proctice.  Nor have I had great success at getting the pages to work in concert. 
    Any advice that you can lend would be appreciated. 

    I ideally start by reducing the 2-page functionality - of form page and action page - to just one. It goes like this:
    <cfset isValidationPassed = false>
    <cfif isDefined("form.someVar")>
    <!--- Do validation. Validated form implies isValidationPassed is true --->
    </cfif>
    <cfif isValidationPassed>
    <!--- Do action page stuff --->
    <cfelseif NOT isDefined("form.someVar") OR NOT isValidationPassed>
    <!--- Display the form. --->
    <!--- If form had been submitted, inform user which validation failed, and what to correct. Display the form. --->
    <cfoutput><form method="post" action="#CGI.SCRIPT_NAME#"></cfoutput>
    </form>
    </cfif>
    The idea is then to pile on the complexity, layer by layer.

  • Select value then navigate to another page

    All,
    I am doing something which sounded simple but doesnt seem work for me. Ive a select List item and when a value is selected on change eg EMP_ID value i need to pass that selected value to another/navigate to another page and pass that values to that page item eg P2_EMP_ID.
    i tried below DA but its always showing value=undefined  ?
    $('#P1_NAGIVATEPAGE').change(function() {
    alert('val = ' + $("#P1_XXX option:selected").val() );
            var ac = $('#P1_XXX').val();
            alert(ac);
            if (ac == 'CAMPING') {
                window.location = 'f?p=&APP_ID.:2:&SESSION.::&DEBUG.:P2_XXX:&P1_XXX:';   etc,
    how can i solve in apex 4.2?
    thanks.

    Hi,
    You are using &P1_XXX in your code. This is the value of the item from the moment the page loaded. This means it is not changing on the change of the item value. Your code should be something like this:
    window.location = 'f?p=&APP_ID.:2:&SESSION.::&DEBUG.:P2_XXX:'+ac;
    Regards,
    Kees Vlek
    Company: http://www.orcado.nl
    Blog: http://www.orcado.nl/blog/blogger/listings/69-kvlek
    Twitter: http://www.twitter.com/skier66
    +If the question is answered please change it to answered and mark the appropriate post as correct/helpfull.+

  • How to open a panel tabbed window using a button present in the same page

    below is my jspx page where i have two buttons and two panel tabs. I want to open respective panel tabs using respective buttons:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1" binding="#{backing_pages_bb.d1}">
    <af:form id="f1" binding="#{backing_pages_bb.f1}">
    <af:panelStretchLayout binding="#{backing_pages_bb.psl1}" id="psl1">
    <f:facet name="bottom"/>
    <f:facet name="center">
    <af:panelTabbed binding="#{backing_pages_bb.pt1}" id="pt1">
    <af:showDetailItem text="first"
    binding="#{backing_pages_bb.sdi1}" id="sdi1"/>
    <af:showDetailItem text="second"
    binding="#{backing_pages_bb.sdi2}" id="sdi2"
    rendered="true" disclosed="false"/>
    </af:panelTabbed>
    </f:facet>
    <f:facet name="start"/>
    <f:facet name="end"/>
    <f:facet name="top">
    <af:panelGroupLayout binding="#{backing_pages_bb.pgl1}" id="pgl1">
    <af:commandButton text="first"
    binding="#{backing_pages_bb.cb1}" id="cb1"
    action="#{backing_pages_bb.cb1_action}"/>
    <af:commandButton text="second"
    binding="#{backing_pages_bb.cb2}" id="cb2"
    action="#{backing_pages_bb.cb2_action}"/>
    </af:panelGroupLayout>
    </f:facet>
    </af:panelStretchLayout>
    </af:form>
    </af:document>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_pages_bb-->
    </jsp:root>
    below is the backing bean created for the jspx page:
    package view.backing.pages;
    import javax.faces.component.UIComponent;
    import oracle.adf.view.rich.component.rich.RichDocument;
    import oracle.adf.view.rich.component.rich.RichForm;
    import oracle.adf.view.rich.component.rich.layout.RichPanelGroupLayout;
    import oracle.adf.view.rich.component.rich.layout.RichPanelStretchLayout;
    import oracle.adf.view.rich.component.rich.layout.RichPanelTabbed;
    import oracle.adf.view.rich.component.rich.layout.RichShowDetailItem;
    import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
    public class Bb {
    private RichForm f1;
    private RichDocument d1;
    private RichPanelStretchLayout psl1;
    private RichPanelGroupLayout pgl1;
    private RichCommandButton cb1;
    private RichCommandButton cb2;
    private RichPanelTabbed pt1;
    private RichShowDetailItem sdi1;
    private RichShowDetailItem sdi2;
    public void setF1(RichForm f1) {
    this.f1 = f1;
    public RichForm getF1() {
    return f1;
    public void setD1(RichDocument d1) {
    this.d1 = d1;
    public RichDocument getD1() {
    return d1;
    public void setPsl1(RichPanelStretchLayout psl1) {
    this.psl1 = psl1;
    public RichPanelStretchLayout getPsl1() {
    return psl1;
    public void setPgl1(RichPanelGroupLayout pgl1) {
    this.pgl1 = pgl1;
    public RichPanelGroupLayout getPgl1() {
    return pgl1;
    public void setCb1(RichCommandButton cb1) {
    this.cb1 = cb1;
    public RichCommandButton getCb1() {
    return cb1;
    public void setCb2(RichCommandButton cb2) {
    this.cb2 = cb2;
    public RichCommandButton getCb2() {
    return cb2;
    public void setPt1(RichPanelTabbed pt1) {
    this.pt1 = pt1;
    public RichPanelTabbed getPt1() {
    return pt1;
    public void setSdi1(RichShowDetailItem sdi1) {
    this.sdi1 = sdi1;
    public RichShowDetailItem getSdi1() {
    return sdi1;
    public void setSdi2(RichShowDetailItem sdi2) {
    this.sdi2 = sdi2;
    public RichShowDetailItem getSdi2() {
    return sdi2;
    public String cb1_action() {
    // Add event code here...
    return null;
    public String cb2_action() {
    // Add event code here...
    return null;
    Wat method has to be coded inside cb1_action and cb2_action so that respective panels are opened.
    thank u for ur help in advance.

    Hi,
    If the data need to be passed is large, consider using Shared Memeory Objects: Check this doc for reference: How to pass data from ABAP to Web Dynpro ABAP
    Hope this helps u,
    Regards,
    Kiran

  • How can I use two tabular forms on the same page.

    I have create one tabular form in page and try to create second tabular form so
    it gives below error.
    1 error has occurred Updatable SQL Query already exists on page XXXXX.
    You can only add one updatable SQL query per page. Select a different page.

    I can get this to work but the page is submitted, either when I use a button with URL link or from a link on a display only text field.
    Is this how it is supposed to work? I thought it was supposed to work just on the browser so it is fast.
    IGNORE THIS!
    =============================
    I resolved it easily by modifying the URL from f?p=blah blah to #LINK_NAME
    Message was edited by:
    user530800

  • Dynamic select list display details on same page

    i have a select dropdown list that is showing products from a php msql database. When one of the products is selected from the list in need the details of that product displayed underneath the select list.
    here is what i have so far
    mysql_select_db($database_beau, $beau);
    $query_Recordset1 = "SELECT * FROM beaProdSizes, beauCat WHERE beaProdSizes.CatID = beauCat.catID";
    $Recordset1 = mysql_query($query_Recordset1, $beau) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <select id="selectName" name="name">
                          <option value="Select Design">Select Design</option>
                          <?php
    do {
    ?>
                          <option value="<?php echo $row_Recordset1['name']; ?>"><?php echo $row_Recordset1['name']; ?></option>
                          <?php
    } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
      $rows = mysql_num_rows($Recordset1);
      if($rows > 0) {
          mysql_data_seek($Recordset1, 0);
                $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    ?>
                          </select>
    thanks in advance

    ok i want to make it using the php that you gave me, i have tried it but it doesnt seem to be working
    this is what i have:
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $var1_Recordset1 = "-1";
    if (isset($_GET['CatID'])) {
      $var1_Recordset1 = $_GET['CatID'];
    mysql_select_db($database_beau, $beau);
    $query_Recordset1 = "SELECT * FROM beaProdSizes, beauCat WHERE beaProdSizes.CatID = beauCat.catID";
    if (isset($_GET['catID']) && is_numeric($_GET['catID'])) {
        $query_Recordset1 .= ' AND beauCat.catID = ' . $_GET['catID'];
    $Recordset1 = mysql_query($query_Recordset1, $beau) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <div class="header" id="beauTitleBOX"><?php echo $row_Recordset1['catname']; ?></div>
            <div id="beauSelectBOX">
              <form id="FormName" action="" method="get" name="FormName">
                <select id="selectName" name="name">
                  <option value="Select Design">Select Design</option>
                  <?php
    do {
    ?>
                  <option value="<?php echo $row_Recordset1['catID']; ?>"><?php echo $row_Recordset1['name']; ?></option>
                  <?php
    } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
      $rows = mysql_num_rows($Recordset1);
      if($rows > 0) {
          mysql_data_seek($Recordset1, 0);
                $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    ?>
                </select>
                <input type="submit" name="button" id="button" value="select" />
              </form>
            </div>
            <div class="header" id="beauPrice"><?php echo $row_Recordset1['price']; ?></div>
            <div class="text" id="beauOtherContent"><?php echo $row_Recordset1['desc']; ?></div>

  • Changing dropdown list selected value in JSP

    I would like a dropdown list to load with all values in a database table, which is no problem. But, I would then like it to display a selected text value from that list, depending on the value returned by a SQL query. As an example, say I was looking-up someone's personal data and there was a dropdown list that listed all the possible hair colors. If this person had been entered as having blonde hair, I want the dropdown list to display blonde at page load, but give the user the option to select another color if a change is needed.
    Thanks in advance for ur help.

    <option value="<c:out value="${currentchoice}"/>"
        <c:if test="${currentchoice=='db_value'}">     
            SELECTED 
        </c:if>
    >

  • How to use Spry and Jquery on the same page.

    I'm using both spry (dataset) and jquery (datepicker) on my page. When I load the jquery script my dataset doesn't work.
    I've done some research and found that I need to insert an observer that tells jquery when the spry dataset is finished loading. Found this information at: http://forums.adobe.com/message/2899897. I've tried implementing this into my script but just doesn't seem to work. Below is the script from my site, how would I insert an observer into this script?
    <script type="text/javascript">
    <!--
    var ds1 = new Spry.Data.HTMLDataSet("/test/fsasearch_results_dynamic.php", "search_results");
    var ds2 = new Spry.Data.HTMLDataSet("/test/countstable_dynamic.php", "table");
    $(function() { $( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd', beforeShowDay: nonWorkingDates, numberOfMonths: 2, minDate: +5, maxDate: +30});
        function nonWorkingDates(date){
            var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
            var closedDates = [[7, 29, 2009], [8, 25, 2010]];
            var closedDays = [[Saturday], [Sunday]];
            for (var i = 0; i < closedDays.length; i++) {
                if (day == closedDays[i][0]) {
                    return [false];
            for (i = 0; i < closedDates.length; i++) {
                if (date.getMonth() == closedDates[i][0] - 1 &&
                date.getDate() == closedDates[i][1] &&
                date.getFullYear() == closedDates[i][2]) {
                    return [false];
            return [true];
    //-->
    </script>

    Please post any SPRY related question in the SPRY forum.

  • Losing values when redirected to same page.

    Hi all,
    I have a page A where i am displaying the name and number(these are of type message styled text). when i click on a some button..it takes me to page B where i have a go button which takes me back to page A when clicked. When i come from page B to page A..the values that are being displayed previously are getting disappeared. Can anybody please help me where could have gone wrong.
    And also how can i know that the page A got rendered through the click the Go button on page B? coz on page A's CO, I have do some validation if its rendered through page B's Go button click.
    Thanks,
    Sreeram
    Message was edited by:
    sreeram29

    Hi all,
    I got it fixed..I did nt retain the AM..That was the mistake.
    Thanks.

  • Multiple portlets using javascripts not working on the same page!!!

    Does anyone know a work around for this problem????
    I have two seperate dynamic pages. Each page has a drop down menu which is built from javascript and dhtml. Individually they both work fine. However they stop working when placed on a page together. Even when in seperate regions. I need to keep both of them as seperate portlets so i cannot solve the conflicts in the javascript as i would if they were coded together.
    Any Ideas????
    Anyone?????

    Daniel,
    It could be a script conflict - "any duplication in variable declaration, function name, or event-handler access in two scripts can cause at least one, if not both scripts to become inoperative." Check this site to see if this applies to you:
    http://www.javascriptkit.com/javatutors/multiplejava2.shtml
    Good luck!

  • Inserting a db row from a form with a value passed in from another page

    We have a report (P1) on a table (T1). P1 has a link column (C), and C is the PK on T1. Clicking on a link (i.e., a row) in report P1, takes us to form (P2). P2 is used to allow the user to insert a new row into T1, with the constraint that one of the columns (X) in T1 must have the same value as X had in the linked row on P1. Also, X is a NOT NULL attribute.
    What we are doing is:
    First, passing C to P2 by setting the link name=P2_X_C and the link value=#C#
    Second, in P2, we are setting form element P2_C via a SQL statement:
    SELECT X
    FROM T1
    WHERE C = :P2_X_C
    P2 displays nicely. We set P2_C to display only, and allow the user to enter values for the other columns. The value displayed for X is not NULL and correctly matches the value from P1. However, when we hit the CREATE button on P2, we get error: ORA-01400: cannot insert NULL into "T1"."X". Unable to process row of table T1.
    APEX seems to have an "issue" with having a value in a form "set" and transmitted to the DB on INSERT.
    Any help would be greatly appreciated.

    Hi,
    1 For "Display Only" items that you are not populating directly from a database column, if you want to save the value, you have to ensure that Save Session State is set to Yes and these items are not actually submitted with the page. The same sort of thing would apply to Disabled or Read-Only items as browsers do not submit these items - though these are more tricky to deal.
    2 Passing the PK value is the most common way of identifying which record contains the values you need. Passing other values is also typical - eg, for applying filters for calendars or searches or for setting flags.
    3 For database columns, which should be based on the underlying table's data, you can use the Default Value settings - though be aware that these values do not exist in session state until the page is submitted. That's ok if you don't need to use the value anywhere else on your page
    Andy

Maybe you are looking for