Problem in SELECT TAG using variables

Hi all,
I have a JSP page which updates the record for a user.Now there is a HTML select tag and when the user queries its data this SELECT tag will automaticaly select the user stored item in database automatically. It means the select tag will have a variable to select the options. Now how can i use variables in SELECT TAG. Please help needed.

I'm not exactly sure what you are asking, but here goes.
First, are you able to populate the select box with all the names... this is what it sounds like to me.
Or are you not able to populate it nor select it.
I use JSTL for all my jsps... so for me I would store a collection on the form and then iterate through it. (arrayList being my preference)
look into using <c:forEach> or you could try <logic:iterate> which I've used before but it has been several years.
here is an example block of code.
Sorry this is going to be a bit convoluted because of what I'm doing with it..
but I have an ArrayList that contains string arrays... position 0 being the value I want returned (like 1 through 10) and position 1 being the text representation..
so it comes out like
1 - Option 1
2 - Option 2
You will notice the if statement where I check to see if the localList[0] is equal to the view field. view would be your selected value.
<SELECT name="view" size="7"
     multiple="multiple" class='OmniDlgLabel'>     
               <c:if test="${sessionScope.PHI2Form.localList!=null}">
                    <c:forEach var="localList"
                         items="${sessionScope.PHI2Form.localList}" varStatus="status">
                         <OPTION value='<c:out value="${localList[0]}"/>'
                                   <c:if test="${sessionScope.PHI2Form.view==localList[0]}">SELECTED</c:if>>
                         <c:out value="${localList[0]}"/>-<c:out value="${localList[1]}" /></OPTION>
                    </c:forEach>
               </c:if>          
</SELECT></TD>There is an extra > that I cannot get rid of.. should be there after the
<OPTION value='<c:out value="${localList[0]}"/>'

Similar Messages

  • Dynamic changes of option tags in a Select tag using JavaScript

    I got this problem during my project.
    I used Select tag in HTML code.
    I have to change options related to Select tag, based on events.
    How can we change options dynamically using JavaScript?
    Please post solution to this problem..

    You know Sun Java Studio Enterprise forum isn�t a right place for JavaScript & HTML questions.
    BTW here is you can find a lot of js stuff: docs, samples, tutorials, etc:
    http://www.w3schools.com/js/default.asp

  • Problem with Select tag in iPad Safari

    The <select> tag which provides a drop-down list is giving me problems.
    I when I change the value, sometimes I get all sorts of spurious characters after the field and sometimes I get a truncated value.
    I need to put a span tag in front of it to get a marker for a required field as shown below. When that tag is not there, the problem does not occur. But I can't take it out as I this is a multiple platform app I have to get rendering properly on several platforms.
    Any ideas?
    <style type="text/css">
    .requiredBlock
    background-color:#CCCC00;
    bottom:1px;
    left:-4px;
    position:absolute;
    top:1px;
    width:3px;
    </style>
    <select id="myList" name="My List" size="1"
    ...

    I think this forum software is editing out some of the code I entered.
    There is supposed to be a span tag before the select list. Pretend that "spam" below is really "span".
    <style type="text/css">
    .requiredBlock
    background-color:#CCCC00;
    bottom:1px;
    left:-4px;
    position:absolute;
    top:1px;
    width:3px;
    </style>
    <spam class="requiredBlock" ></spam >
    <select id="myList" name="My List" size="1"
    ...

  • Problem with custom tag using TagExtraInfo

              Hi,
              I have a tag that create a Java variable using TEI. The scope of this
              variable is driving me crazy. The problem is hard to describe, so the
              email is a bit long - stay with me...
              <pre:setvar id="foo" value="test" /> create a Java variable
              named "foo", which has String value "test". I can use "foo" like this in
              the page later: <%= foo %>.
              Now, if I call setvar twice with same id:
              <pre:setvar id="foo" value="test" />
              <pre:setvar id="foo" value="another-test" />
              This is still ok. By checking the compiled Java file, the first call
              declare the var, the second call just use it without creating it again:
                   //first call
                   String foo=null;
                   foo="test";
                   //second call
                   foo="another test";
              Now the problem comes when the frist call is in "if" statement (code is not
              useful, only for demostration):
              <% if (1>0) { %>
                   <pre:setvar id="foo" value="test" />
              <% } %>
              <pre:setvar id="foo" value="another-test" />
              The compiled code looks like:
                   if (1>0) {
                        //first call
                        String foo=null;
                        foo="test";
                   //second call
                   foo="another test";
              Variable foo is out of scope at the second call! (BTW, I can workaround this by
              adding another <pre:setvar id="foo" value="" /> before the "if".)
              Is it a fault in JSP specification? Or a problem when WebLogic implements TEI?
              Any idea?
              Thanks,
              -- Jin
              

    I encountered the same problem in our environment. I did the same thing as
              James. Simply re-initialize all variables in the do end tag.
              Also, with the nested tags you use you may also need to implement cloneable
              in the inner tag if the outer tag keeps references to all the inner tag
              instances.
              For instance if the outer tag kept a vector of references to the inner tag,
              then you would need to use clone() on the inner tag before adding it to the
              vector.
              "James Lynn" <[email protected]> wrote in message
              news:3af05d29$[email protected]..
              > > But
              > > with WL 6.0, the cell tag handler reuse the same instance each time the
              > cell tag
              > > is called and the member field is not reset
              >
              > I had the same problem. As a work around, I reinitialize everything in my
              > doEndTag() method and it works.
              >
              >
              > --
              > James Lynn - Lead Software Architect
              > Oakscape - Java Powered eBusiness Solutions <http://www.oakscape.com/>
              >
              >
              

  • ALSB 3.0 - Problem adding CDATA Tags using XSLT

    Hi all,
    I am having a problem using ALSB to insert CDATA tags into some XML.
    Here's a simple example of the stylesheet I am using:
    &lt;?xml version="1.0"?&gt;
    &lt;xsl:stylesheet xmlns:xsl="[http://www.w3.org/1999/XSL/Transform]" version="1.0"&gt;
    &lt;xsl:template match="/"&gt;
    &lt;a&gt;
    &lt;xsl:value-of disable-output-escaping="no" select="'&lt;![CDATA['"/&gt;
    &lt;b/&gt;
    &lt;xsl:value-of disable-output-escaping="no" select="']]&gt;'"/&gt;
    &lt;/a&gt;
    &lt;/xsl:template&gt;
    &lt;/xsl:stylesheet&gt;
    In XMLSpy, this produces the following output:
    &lt;a&gt;
    &lt;![CDATA[
    &lt;b /&gt;
    ]]&gt;
    &lt;/a&gt;
    Which is correct.
    However, when running the same transformation as an XSLT in ALSB, I get the following output:
    &lt;a&gt;
    &lt;?javax.xml.transform.disable-output-escaping?&gt;
    & lt ;
    &lt;?javax.xml.transform.enable-output-escaping?&gt;
    ![CDATA[
    &lt;b /&gt;
    &lt;?javax.xml.transform.disable-output-escaping?&gt;
    & gt ;
    &lt;?javax.xml.transform.enable-output-escaping?&gt;
    &lt;/a&gt;
    From some digging about online, I've found that the
    "&lt;?javax.xml.transform.enable-output-escaping?&gt;" elements are
    processing instructions.
    Has anyone else had similar issues?
    Or more importantly, has anyone fixed this?
    Cheers,
    Dave
    Edited by: DaveFeeder on 10-Dec-2008 12:36

    I've found a solution to this now.
    I've used the fn-bea:serialize XQuery function to serialized the data, having the same effect as manually trying to insert the CDATA,and if anything, is a neater solution.
    Cheers
    Dave

  • Problem with select statement using Ranges

    Hi Guys,
                   I have used Ranges and used a select statement for selecting those ranges but I am facing a problem.
    RANGES: r_doctyp for EDIDC-DOCTYP.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'DEBMAS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'MATMAS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'PRICAT'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'ORDERS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'INVOIC'.
    append r_doctyp.
    Select DOCNUM                                " IDoc number
           DOCTYP                                " IDoc Type
                 from  EDIDC into table IT_ZEDIDC
                 where CREDAT EQ s_credat-low
                 and   DOCTYP EQ r_doctyp        " IDOC Types
                 and   DIRECT EQ '1'.
    Here my select statement is only taking INVOIC.
    But my statement should take any document type.
    Thanks,
    Prasad.

    Hi...,
    Your following select statement is correct.
    Select DOCNUM                                " IDoc number
                DOCTYP                                " IDoc Type
                from  EDIDC into table IT_ZEDIDC
                where CREDAT IN s_credat
                and   DOCTYP IN r_doctyp        " IDOC Types
                and   DIRECT EQ '1'.
    Why you are not getting result..
    1. structure of the IT_ZEDIDC is having two fields DOCNUM , DOCTYP  with same data lengths. If not it should be...
    2. Order in the database table is must be similer to the order you maintained in the select statement.
    3. As you are hard coding the input ranges make sure about every letter.
    4. take a look at other where condition fields too.
    5. check the table of the ranges in debugging mode.
    6. why can't you declare separate work area and table for ranges...?
      like .... data: r_tab type range of <field>
                 data: wa_tab like line of r_tab.
    7. Use clear work area statement after the append statment.
    --Naveen Inuganti.

  • Problem to pre tag use in jeditorpane

    hi all,
    i am using JEditroPane with HTMLEditorKit. I am using <pre> tag to set the Tab space. But problem is that, when i write continuously, its can't line break also when i print the editor contents, it will not print the exact contents.
    If i remove <pre> tag it prints the contents but formatting( Tab space) has remove.
    Please help me, how can i get rid of this situation..
    Thank you

    Thanks to your reply. Its nice..
    I am trying to line break explicitly. but can't find any way. Is there any way to get the cursor position (Location) that when the cursor exced the location i expliditly line break that positon .. or any other way...
    Please help me..
    Thank you

  • Selecting Graphics using Variables

    I am new to Authorware and am authoring my first project. Is
    there a way to control a set of graphics based on variables. I am
    trying to show a student if they are complete with a section. I am
    currently using a custom variable displaying "Not Started",
    "Started" and "Complete".
    I am thinking that a set of dots or colored check marks would
    be more visually appealing.
    Thanks in advance for your help.

    My personal fav. is graphics that are displayed with the
    'DispalyIcon' function. To do that simply drop a 'Decision Icon'
    above the menu that will display the graphics and set its branching
    'To Calculated Path' leaving the variable field blank. Now attach
    the 3 'Display Icons' with specific labels. ("Not Started",
    "Started" and "Complete") After that when you want them to show up
    simply use the line 'DisplayIcon(IconID@"Complete")'.
    If you want to use the same type of setup for say a quiz
    where the checkmark could be in several places. Simply move the
    graphics in the 'Display Icons' that are attached to the 'Decision
    Icon' off the screen until they are not visible. (Be sure to leave
    something on screen to grab onto if you want to edit them later.)
    Then set up a Motion Icon directly below the call to
    'DisplayIcon(IconID)' for each item you want to display. In the
    motion icon set the option to 'Destination' and set the 'x' and 'y'
    fields to variables called 'display_x' and 'display_y'. Now when
    you call 'DisplayIcon(IconID)' you also set the appropriate
    'display_x' and 'display_y' to move the image the the right spot.
    (Be sure the 'Motion Icon' is set to Time, 0, Concurrent so that
    the image appears to pop into the right place not move to the
    correct spot.)
    For example:
    DispalyIcon(IconId@"Complete")
    display_x := 174
    display_y := 210
    I have also used the WingDing method Amy talked about many
    times. It's very easy and a really good choice for quick
    development, but it just isn't as nice looking as loading your own
    graphics.

  • Problem when selecting PublishingRollupImage using REST API using Javascript ?

    Hii Guys,
    I am developing  a listing page of News using REST, the custom list contains Title, PublishingRollupImage, and other fields which is provided in the $select
    http://xyz/_api/web/lists/getbytitle('News')/Items?$select=Title,Link,PublishingRollupImage
    the column "PublishingRollupImage" is there and i can return the result by using normal JavaScript API with CAML query.
    but REST calling while specifying this column is failing with this error
    The field or property 'PublishingRollupImage' does not exist
    Microsoft.SharePoint.Client.InvalidClientQueryException
    please note that this is not the (hyperlink/image) field,
    its an existing site columns (publishing image)

    Hi,
    According to your post, my understanding is that you want to get Rollup Image data using REST API.
    Per my knowledge, we can’t get it using REST API.
    We can use Client Object Model to achieve it, the following code snippet for your reference:
    var ctx = new SP.ClientContext();
    var items = ctx.get_web().get_lists().getByTitle('Pages').getItems(new SP.CamlQuery());
    ctx.load(items);
    ctx.executeQueryAsync(function() {
    // Get the first items rollup image, just as an example
    var rollupImage = items.getItemAtIndex(0).get_item('PublishingRollupImage');
    console.log(rollupImage);
    If you still want to use the REST API, we can customize a We Service to achieve it.
    http://sharepointlearningcurve.blogspot.in/2013/08/creating-wcf-rest-service-for.html
    Here is a similar thread for you to take a look:
    http://sharepoint.stackexchange.com/questions/46844/how-to-get-publishingrollupimage-for-page-in-page-library-with-rest-and-jquery
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Select query using variable

    Hi all,
    If I have a variable with multiple value (returned from bulk collect), how can I pass it into a select query as a condition?
    Eg.
    set serveroutput on
    declare
    type v_LockSessInfo is table of integer;
    empdata v_LockSessInfo;
    begin
    select unique sid bulk collect into empdata from v$lock;
    [select sid,serial#,username from v$session where sid in (empdata)]
    end;
    I hope to be able to pass in the variable collected, into the next select statement. How can I achieve it?
    Thanks in advance.
    Eugene

    Sorry for any confusion caused, I have almost 0 knowledge on pl/sql, only can survie on normal sql query.
    Further elaboration, the intention of my query is to query out any locking that exists in my DB. It meant to serve as a report to management, so I have to break it down into couple of sections for easier reference (minimising the complication that may arise from others who view the report).
    Couple of steps/procedures I am thinking of:
    1) query out the unique sid that exists in v$lock (blocking and blocked sessions) <<< this set of returned record (SIDs) should be stored in a variable.
    Eg. achived by the select statement "select unique sid from v$lock into [variable]"
    2) query v$sessions for the lock details from step 1's output. Username, sid, serial#, machine etc.
    Eg. To be achieved by "select sid,serial#...... from v$session where sid in [variable]; Same condition applies to 2 and 3.
    3) query v$locked_object to identify which are the blocking/blocked sessions, and who's blocking who from step 1's output.
    4) query the locked object and locked record (based on rowid locked) from step 1's output.
    This is all that I can think of at the moment. Any opinions that can perform the above activity will be appreciated alot. Hope I'm able to clear up any confusion triggered.
    PS: I can't re-query the SID as the SID may change or be lost upon the re-query therefore losing any evident. Thus I was thinking of putting it into a variable for consistent querying for step 2,3 and 4. All 4 steps will be performed within a single script.
    Regards
    Eugene
    Edited by: eteo78 on May 28, 2009 8:40 AM

  • Problem with SELECT tag in Jsp

    Hi!
    How do I keep my selection in the dropdown menu. When I choose somthing the page reloads and the option does npt persist. Help?
    <sql:query var="result"
         sql="SELECT ${param.category}ID id, ${param.category} name
         FROM ${param.category}"/>
    <select name="selCategory" onChange="submit()">
         <option>--------- V�lj ---------</option>
              <c:forEach items="${result.rows}" var="row">
              <c:set var="categoryRows" value="${row.id}"/>
              <option value="<%= pageContext.getAttribute("categoryRows") %>" >
                   <c:out value="${row.name}"/>
              </option>
         </c:forEach>
    </select>

    This code works fine for me:
    <%@ taglib uri="/jstl-c" prefix="c" %>
    <html>
         <body>
         <%
              int array[] = new int[] {1,2};
              session.setAttribute("array", array);
              String arrayNames[] = new String[]{"One", "Two"};
              session.setAttribute("arrayNames", arrayNames);
         %>
              <form action="?">
              <select name="select">
                   <c:forEach items='${ sessionScope.array}' var="row">
                        <c:choose>  
                             <c:when test="${param.select== row}"> >
                                  <option value="<c:out value='${row}'/>" selected><c:out value="${sessionScope.arrayNames[row-1]}"/></option>
                             </c:when>   
                             <c:otherwise>
                                  <option value="<c:out value='${row}'/>"><c:out value="${sessionScope.arrayNames[row-1]}"/></option>
                             </c:otherwise>
                        </c:choose>
                   </c:forEach>
              </select>
              <input type="submit" name="submit" value="submit"></input>
              </form>
         </body>
    </html>
    good luck.
    MatrixPooh
    www.bizdisplay.com

  • InfoSpoke data selection using variables in BW 3.5?

    Hi Gang!
    Can InfoSpokes select data using variables in BW 3.5?
    I would like create a "functional" delta process using an Full mode load and a variable to select "yesterday" from a date field. My ETL and external database partners would prefer to not deal with multiple before and after images from a single document item from a ODS. I was hoping I could use a variable selection against a date-time stamp, but I don't see how.
    AM I be forced to use a BADI?
    Thanks,
    John Hawk
    [email protected]

    One crude option would be to add an ABAP step prior to the infospoke execution, in this step code can be added to modify the corresponding record in table RSBSPOKESELSET (for selection values on date/time characteristics).

  • Focus() call on a select tag seems to be causing problems

    I have a reasonably complicated web site with dynamically created, absolutely positioned, overlapping divs with form elements contained within them.
    Starting with Firefox 4 and in Firefox 5, clicking on a dropdown list (<select>) tag can cause fragments of text from some of the "bottom" (i.e. not visible) divs to appear within the "top" (i.e. visible) div.
    I can make this problem go away by setting the onmousedown handler (not previously set) for the select tag to a dummy event handler which terminates the event. I can force it to happen again either by allowing the event to bubble up or by explicitly calling .focus(). Also, causing any part of the screen to refresh (such as writing to the DOM) will cause the fragments of text to disappear and the problem does not then reoccur with the given <select> tag.
    This issue does not arise in IE 8 / 9, Opera 10 / 11 or Chrome.
    Is this a known issue? If it is the .focus() call which is causing the problem and given that that is native code, is there a workaround other than what I have done?

    Took a look at the SQL Navigator. The "DB Navigator" (the navigation tree on the left with all the DB objects in it) shows the right precision and scale of every column, whereas the "columns" tab that appears when you >double click the view in the DB navigator always shows "number(0,0)". So I consider this a bug of SQL Navigator, but don´t believe it has anything to do with your problem.Yup, you're absolitely right. Not impreseed with SQL navigator!!!
    Just a thought: Could it be that some restrictions concerning the db user (dunno, perhaps even FGAC?) prevents that specific data to be shown? Do you connect in SQL Navigator as the same user as with the other >applications?Nice idea but I'm using the same user account.
    My background is in SQL Server (don't hold it against me :) ) and that has a tool called Profiler than enables one to capture the query being executed against the database engine. Does Oracle have anything similar? It might be useful to test whether the driver does something funky to the query that might manifest itself in what I'm seeing!
    -Jamie

  • Using variables in a jsp:useBean tag

    I was wondeing if it is possible in any way to use variables in a jsp:useBean tag. Here is an example of what I am trying to do.
    <%
    String beanType = request.getParameter( "bean" );
    if( beanType.equals( "Bean1" ) ) {
    beanClass = "com.myCompany.Bean1";
    } else {
    beanClass = "com.myCompany.Bean2";
    %>
    <jsp:useBean name="<%= beanType %>" class="<%= beanClass %>"/>
    I also tried using this approach
    <%
    if( beanType.equals( "Bean1" ) ) {
    %>
    <jsp:useBean id="bean" class="com.myCompany.Bean1"/>
    <%
    } else if( beanType.equals( "Bean2" ) ) {
    %>
    <jsp:useBean id="bean" class="com.myCompany.Bean2"/>
    <%
    %>
    Neither approach seems to work. Is there any way around this problem?
    Thanks,
    Marcus.

    Hi,
    check:
    http://forum.java.sun.com/thread.jsp?forum=45&thread=398998&tstart=75&trange=15

  • Write to java object using netui:select tag

    Hello,
    I am iterating through a hashmap of java objects using a netui-data:repeater.
    <netui-data:repeater dataSource="{pageFlow.MyHashMap}">
    <netui-data:repeaterItem>
    <netui-data:repeater dataSource= "{container.item.HashMapOfEmbeddedObjects}">
    <netui-data:repeaterItem>
    <netui:select dataSource= "{container.item.type}" optionsDataSource= "{container.item.typeChoices}" /> </td>
    <netui:select dataSource= "{container.item.default}"
    optionsDataSource= "{container.item.defaultChoices}" /> </td>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    The java object has a field "HashMapOfEmbeddedObjects" that is itself a hashmap of java objects. I want to be able to make a selection and have it be written to the
    "type" and "default" fields of the embedded objects, but dataSource="{container.item.default}" does not save the value of the selection.
    Is there anyway to use the netui:select tag to write to the field on a java object? Any help is greatly appreciated.

    I have done it in the past. The java object need not be actionForm. The following write-up I found in edocs will help you achieve this.
    Page Flow-Scoped Form Beans
    Page Flow-scoped Form Bean instances have the same life-cycle as the Controller file instance. They are created and destroyed when the Controller file instance is created and destroyed. This makes Page Flow-scoped Form Beans useful for storing data that has been accumulated across many different JSP pages.
    To create a Page Flow-scoped Form Bean instance, construct a public member variable of the Form Bean in the Controller file.
    public class myController extends PageFlowController
    public MyFormBean pageFlowScopedBean = new MyFormBean();
    Once you have created a Page Flow-scoped instance of a Form Bean, you can pass the instance to action methods by using the @action form="form_bean" annotation.
    public class myController extends PageFlowController
    public MyFormBean pageFlowScopedBean = new MyFormBean();
    * @jpf:action form="pageFlowScopedBean"
    * @jpf:forward name="success" path="displayData.jsp"
    protected Forward submit( MyFormBean form )
    return new Forward( "success" );
    Each time the submit() method is invoked, it is passed the same instance of the Form Bean, namely, pageFlowScopedBean, the instance that was created when the Controller file instance was created.
    For more info go to http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/netui/guide/conReqScopedVsPageScopedBean.html
    Good luck.
    --SJ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for