How to write good PHP code in dreamweaver?

Here's the thing.  I'm using Dreamweaver CS4 to develop a website.  In the past my php files would look like this:
<?php
    echo '<h1>Welcome ' . $name . '</h1>';
?>
This caused problems in the design view because all I would see would be the php icon to let me know I have some script in this location and that is it.
Then I started to realize that I should write my code like this:
<h1>Welcome <?php echo $name; ?></h1>
This second way of writing php code is a lot easier to work with in Dreamweaver since in the design view I can see the formatted h1 tag with the word 'Welcome' beside it (followed by the php icon).  I can still apply all the standard CSS rules inside Dreamweaver and the design view updates nicely.
So now here is my issue.What is the best way to handle if statements?  Say I want to toggle between <h1>Welcome $user</h1> and <h2>Good bye</h2> BUT I would like to still be able to format the CSS and see the results on the screen in design view.  Is it possible?
If I do the following, then I'm back to square one.  I can't see my CSS rules applied in the design view since all I have is the PHP icon to show where the script is located:
<?php
   if( $welcome ) {
      echo '<h1>Welcome ' . $name . '</h1>';
   else {
      echo '<h2>Good bye</h2>';
?>

There is another way. But it's considered advanced PHP in this community. It's called a a ternary operator. So
<?php
   if( $welcome ) {
      echo '<h1>Welcome ' . $name . '</h1>';
   else {
      echo '<h2>Good bye</h2>';
?>
     woud look like:
     <?php echo($welcome?'<h1>Welcome '. $name . '</h1>' : '<h2>Good bye</h2>'); ?>
Here's a link to a good explanation: http://www.addedbytes.com/code/ternary-conditionals/

Similar Messages

  • How to write the dynamic code for RadioGroupByKey and Check Boxes?

    Hi,
    Experts,
    I have created a WD ABAP application in that i have used RadioGroupByKey and CheckBox Ui elements but i want how to write the dynamic code to that i want to display male and female to RadioGroupByKey and 10  lables to check boxs.
    Please pass me some idea on it and send any documents on it .
    Thanks in advance ,
    Shabeer ahmed.

    Refer this for check box:
    Do check :
    bind_checked property is bind to a node with cardinality of 1:1
    CHECK_BOX_NODE <---node name
    -CHECK_BOX_VALUE <--attribute name of type wdy_boolean
    put this code under your WDDOMODIFYVIEW:
    DATA:
    lr_container TYPE REF TO cl_wd_uielement_container,
    lr_checkbox TYPE REF TO cl_wd_checkbox.
    get a pointer to the RootUIElementContainer
    lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    lr_checkbox = cl_wd_checkbox=>new_checkbox(
    text = 'WD_Processor'
    bind_checked = 'CHECK_BOX_NODE.CHECK_BOX_VALUE'
    view = view ).
    cl_wd_matrix_data=>new_matrix_data( element = lr_checkbox ).
    lr_container->add_child( lr_checkbox ).
    Refer this for Radiobutton :
    dynamic radio button in web dynpro abao
    Edited by: Saurav Mago on Jul 17, 2009 10:43 PM

  • How to write the ABAP code for Datasource Enhancment

    Hi Team,
                  Can you please help me how to write the code for the enhancement i have made to the standard datasource
    i have added the fields ZZPayer and ZZPayer_access.
    I just wanted to know how to write the ABAP code to populate the data for these fields.
    Regards,
    Pradeep P.

    Hi
    From a performance point of view would like to suggest a few changes :
    WHEN '<DS name>'.
      select zzfields from <table> into itab
      for all entries in c_t_data where <condition>.
      If sy_subrc = 0.
    loop at c_t_data assiging f_c_t_data.
    read itab into wa_itab where key = f_c_t_data-key.
    f_c_t_data-zzfield = wa-itab-zzfield.
    endloop.
    refresh itab.
    regards,
    aparna
    endif.

  • Tips on how to write efficient  java code for java mapping

    hi
    I do not have much knowledge in Java
    Can anybody tell me some tips on how to write efficient and optimised java code to be used in java mapping
    Thanks,
    Loveena

    hi D'za,
    JAVA in xi
    A very important place where you will use JAVA in XI is while doing your Mapping. There will be cases when JAVA MAPPING is the best solution to go for. There are 2 types of Parsers available for JAVA Mapping. DOM Parser and SAX parser. Just got through the following links to understand more on Java Mapping and the APIs available.http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
    JAVA mapping -
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    sample code for java mapping
    Re: Example code DOM PARSER API -
    http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html DOM --- /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs tutorial sax and dom
    For a tutorial on the methods of SAX and DOM http://java.sun.com/webservices/docs/1.1/tutorial/doc/
    SAX AND dom PARSER ( BY thorsten) -
    example /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs java mapping example ( testing and debugging) /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
    regards
    biplab
    Use a Good Subject Line, One Question Per Posting - Award Points

  • How to write this java code in jsp using jstl  tags?

    Can anybody help me on this?
    I dont know how to check the containsKey using jstl tags?
    <%
         LinkedHashMap yearMap     =     (LinkedHashMap)request.getAttribute("yearMap");
         TreeSet nocSet               =     (TreeSet)request.getAttribute("nocSet");
         Iterator     yearMapIt     =     yearMap.keySet().iterator();
         while(yearMapIt.hasNext())
              int yearValue               =     (Integer)yearMapIt.next();
    %>
    <tr>
              <td><%=yearValue%></td>
    <%
              LinkedHashMap monthMap     =     (LinkedHashMap)yearMap.get(yearValue);
              Iterator     nocSetIt     =     nocSet.iterator();
              while(nocSetIt.hasNext())
                   String nCase=(String)nocSetIt.next();
                   if(monthMap.containsKey(nCase))
                        String count     =     (String)monthMap.get(nCase);
    %>
                        <td> <%= count %> </td>
    <%            }
                   else
    %>          
                        <td> 0 </td>     
    <%          
    %>
    </tr>
    <% } %>Edited by: avn_venki on Feb 18, 2008 11:54 PM

    <c:forEach var="yearMap" items="${requestScope.yearMap}">
         <th> <c:out value="${yearMap.key}"/> </th>
    <bean:define id="monthMap" value="${yearMap.value}"/>
    <c:forEach var="nocSet" items="${nocSet}">
    then how to write containsKey using tags??

  • How to write this sql code ?

    for example below shows:
    create table temp
    order_type varchar2(30),
    order_num number);
    insert into temp values('apple',000001);
    insert into temp values('banana',000002);
    insert into temp values('chair',000003);
    select *
    from temp
    where instr(order_type,decode(x,1,'a',2,'b',2,'c',order_type)) >0
    if i let x equals 2 and i want to get b and c from above querying .
    why above query could not get 'c' and only get 'b' if i give 2 to x ?
    how to write above select clause ?
    who can help me ?
    thanks!

    Decode will return the first match;
    SQL> select decode(2,1,'a',2,'b',2,'c')
    from dual
    D
    b
    1 row selected.This may help;
    old: select *
    from temp
    where regexp_like(order_type, case to_number(&x)
                                     when 1 then 'a'
                                     when 2 then 'b|c'
                                  end)
    new: select *
    from temp
    where regexp_like(order_type, case to_number(2)
                                     when 1 then 'a'
                                     when 2 then 'b|c'
                                  end)
    ORDER_TYPE                      ORDER_NUM
    banana                                  2
    chair                                   3
    2 rows selected.

  • How do I redesign Source Code on Dreamweaver?

    Hello everyone,
    I currently am doing a voulenteer website (they said they will let me intern for them if I do this, I am not getting paid since I volunteered). Little did I know that the client had a website that was done by another company and would like me to redesign it.
    I thought no problem, I can manage, but now its stressing me out.
    The company sent me a "Source Code File" on the website and I just do not know where to begin.
    The Zip file cotains:
    Five folders: Content, CSS, Images, Pages, Script
    There are also three items: Custom.css, Index.html, Main.css
    I do not want to let them down, all my experience is wordpress and I have 3 weeks to work on redesigning the website. Supposedly, I cannot use wordpress because they want to charge the client an extra 1k if I do wordpress because they have to link the content. 
    I would really appreciate an experts advice on how to begin redesigning and how long might it take. I understand only basic coding so the file is not too scary its just the CSS and the other tabs when I open the index in dreamweaver which have me worried.
    Sorry if I am making no sense, I am just really stressing on this one website.  When I said web design I wanted to start from scratch...I look forward to hearing from you all.
    Thanks!

    So for the website should I make buttons myself or just use html for them?
    The entirely depends on you. Fact is, the easiest 'button" to make is:
    <a href="#">click here</a>
    In other words, it's a simple link.
    But you can style navigation and use backgrounds and divs to create button-like navigation:
    Here's the navigation I did for one website (html):
    <div id="navigation">
    <nav>
    <ul id="menu">
            <li><a href="../index.html">Home</a></li>
            <li><a href="../about.html">About</a>
           <li><a href="../connect.html">Connect</a></li>
          </ul>
    </nav>
    </div>
    And the CSS for the above, which creates a drop-down menu structure using CSS3 elements. The navigation is very button-line and works great:
    @charset "UTF-8";
    /* CSS Document */
    /* Main */
    #menu
            width: 100%;
            margin: 0;
            padding: 10px 0 0 0;
            list-style: none;
            background: #f6d78d;
            background: #fbf6f6; /* Old browsers */
    /* IE9 SVG, needs conditional override of 'filter' to 'none' */
                        background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d 3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc 2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiB ncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogI CAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZiZjZmNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3R vcCBvZmZzZXQ9IjUwJSIgc3RvcC1jb2xvcj0iI2Y2ZDc4ZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZ mZzZXQ9IjUxJSIgc3RvcC1jb2xvcj0iI2Y0Y2M2ZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ 9IjEwMCUiIHN0b3AtY29sb3I9IiNmYmY2ZjYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+C iAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJ hdGVkKSIgLz4KPC9zdmc+);
                        background: -moz-linear-gradient(top, #fbf6f6 0%, #f6d78d 50%, #f4cc6e 51%, #fbf6f6 100%); /* FF3.6+ */
                        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fbf6f6), color-stop(50%,#f6d78d), color-stop(51%,#f4cc6e), color-stop(100%,#fbf6f6)); /* Chrome,Safari4+ */
                        background: -webkit-linear-gradient(top, #fbf6f6 0%,#f6d78d 50%,#f4cc6e 51%,#fbf6f6 100%); /* Chrome10+,Safari5.1+ */
                        background: -o-linear-gradient(top, #fbf6f6 0%,#f6d78d 50%,#f4cc6e 51%,#fbf6f6 100%); /* Opera 11.10+ */
                        background: -ms-linear-gradient(top, #fbf6f6 0%,#f6d78d 50%,#f4cc6e 51%,#fbf6f6 100%); /* IE10+ */
                        background: linear-gradient(top, #fbf6f6 0%,#f6d78d 50%,#f4cc6e 51%,#fbf6f6 100%); /* W3C */
                        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fbf6f6', endColorstr='#fbf6f6',GradientType=0 ); /* IE6-8 */
            -moz-border-radius: 50px;
            border-radius: 50px;
            -moz-box-shadow: 0 2px 1px #9c9c9c;
            -webkit-box-shadow: 0 2px 1px #9c9c9c;
            box-shadow: 0 2px 1px #9c9c9c;
    #menu li
            float: left;
            padding: 0 0 10px 0;
            position: relative;
    #menu a
              float: left;
              height: 25px;
              padding: 0 15px;
              color: #000;
              text-transform: uppercase;
              font: bold 14px/25px Arial, Helvetica;
              text-decoration: none;          /*text-shadow: 0 1px 0 #000;*/
    #menu li:hover > a
              color: #3c2764;
    *html #menu li a:hover /* IE6 */
              color: #3c2764;
    #menu li:hover > ul
            display: block;
    /* Sub-menu */
    #menu ul
        list-style: none;
        margin: 0;
        padding: 0;
        display: none;
        position: absolute;
        top: 35px;
        left: 0;
        z-index: 99999;
        background: #f6d78d;
        background: -moz-linear-gradient(#f6d78d, #fbf6f6);
        background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #fbf6f6),color-stop(1, #f6d78d));
        background: -webkit-linear-gradient(#f6d78d, #fbf6f6);
        background: -o-linear-gradient(#f6d78d, #fbf6f6);
        background: -ms-linear-gradient(#f6d78d, #fbf6f6);
        background: linear-gradient(#f6d78d, #fbf6f6);
        -moz-border-radius: 5px;
        border-radius: 5px;
    #menu ul li
        float: none;
        margin: 0;
        padding: 0;
        display: block;
        -moz-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
        -webkit-box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
        box-shadow: 0 1px 0 #111111, 0 2px 0 #777777;
    #menu ul li:last-child
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
        box-shadow: none;
    #menu ul a
        padding: 10px;
            height: auto;
        line-height: 1;
        display: block;
        white-space: nowrap;
        float: none;
            text-transform: none;
    *html #menu ul a /* IE6 */
            height: 10px;
            width: 150px;
    *:first-child+html #menu ul a /* IE7 */
            height: 10px;
            width: 150px;
    #menu ul a:hover
        background: #F2C14F;
            background: -moz-linear-gradient(#EFD08D,  #F2C14F);
            background: -webkit-gradient(linear, left top, left bottom, from(#EFD08D), to(#F2C14F));
            background: -webkit-linear-gradient(#EFD08D,  #F2C14F);
            background: -o-linear-gradient(#EFD08D,  #F2C14F);
            background: -ms-linear-gradient(#EFD08D,  #F2C14F);
            background: linear-gradient(#EFD08D,  #F2C14F);
    #menu ul li:first-child a
        -moz-border-radius: 5px 5px 0 0;
        border-radius: 5px 5px 0 0;
    #menu ul li:first-child a:after
        content: '';
        position: absolute;
        left: 30px;
        top: -8px;
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-bottom: 8px solid #444;
    #menu ul li:first-child a:hover:after
        border-bottom-color: #F2C14F;
    #menu ul li:last-child a
        -moz-border-radius: 0 0 5px 5px;
        border-radius: 0 0 5px 5px;
    /* Clear floated elements */
    #menu:after
            visibility: hidden;
            display: block;
            font-size: 0;
            content: " ";
            clear: both;
            height: 0;
    * html #menu             { zoom: 1; } /* IE6 */
    *:first-child+html #menu { zoom: 1; } /* IE7 */

  • How to write ascii extended codes?

    I�m making an application that read from a serial port and write to a file. But I having problems with the extended ascii codes. I have all the data in a ByteBuffer and when I wrote to a file I lose all the accebtuated vowels.
    an example
    byte[] b = new byte[numBytes];
    ByteBuffer buf = ByteBuffer.allocateDirect(numBytes);
    numBytes = inputStream.read(b,0,numBytes);
    // Obtain a channel
    WritableByteChannel channel = new FileOutputStream("d:\\temp\\telam.txt").getChannel();
    int index = 0;
    // Fill ByteBuffer
    while (index < numBytes && buf.hasRemaining()) {
    buf.put(b[index++]);
    buf.flip();
    int numWritten = channel.write(buf);
    if (buf.hasRemaining()) {
         buf.compact();
    } else {
         buf.clear();
    channel.close();
    I need help.
    Thanks, and sorry for my english.
    Diego

    Your best friend is System.out.println
    Where your program is having problem with encoding?
    - Print the hex values of the b[] byte array you have read from the inputStream (quick and dirty way:
    for (int i = 0; i < numBytes; ++i) {
        System.out.print (String.toHexString((b[i] & 0xFF) | 0x100).substr(1,3) + " ");
    }- Read the file you got with some text editor that has a "hex editing mode", like Ultraedit - if you are using Unix, try the venerable od command~
    - Compare the values

  • How to write the SQL codes  of the login system for a database system

    If I have a table stored with a Column staff_ID and Password. How can I make use of this 2 columns information to setup the login system?

    Hi,
    Create Table Modules          -----e.g. payroll, inventory etc.
    (ModID    NUMBER(10),
    ModName  VARCHAR2(50)); 
    Create Table Modules_Forms    ------e.g. Sales Transaction Form
    (FormID   NUMBER(10),
    ModID    NUMBER(10),
    FmxName  VARCHAR2(32));           
    Create Table Modules_Reports  ------e.g. Sales Report
    (RepID    NUMBER(10),
    ModID    NUMBER(10),
    RepName  VARCHAR2(32));           
    Create Table Usr              ------------From the Employee Information Module
    (UserID   VARCHAR2(20),       ------------you can find the designation of
    Password VARCHAR2(10)        ------------the user who wants to connect
    Emp_Code Varchar2(25));      ------------that is why, I am Addng Emp_Code.
    Create Table User_Modules     ------------Control the Module Access.
    (UserID   VARCHAR2(20);
    ModID    NUMBER(10),
    Access   VARCHAR2(1));
    Create Table User_Forms       ------------Control the Forms Access
    (UserID   VARCHAR2(20),
    FormID   NUMBER(10),
    Read     VARCHAR2(1),
    Write    VARCHAR2(1),
    Execute  VARCHAR2(1),
    Delete   VARCHAR2(1));
    Create Table User_Reports     ------------Control the Report Access
    (UserID   VARCHAR2(20),
    RepID    NUMBER(10),
    Access   VARCHAR2(1));
    1 ) After Creating these Tables, Control the Application Access of the users
        From the application (Oracle Forms).
    2 ) I think you should create a Menu from oracle forms.
    3 ) For Controlling the Database Level Access, you can create a ROLE
    4 ) Forms Forum Site:-
        http://www.forums.oracle.com/forums/forum.jsp?forum=82Regards
    Muhammad Waseem Haroon
    [email protected]

  • How to write the CORRECT code to use Application View in WLI8.1

    Hi, guys,
    I try to use the WLI 8.1 released version now. and I deploy a Weblogic MQSeries
    dapter 8.1 on WLI 8.1. And have create a Application view which detail is like
    this:
    ID demo_testadapter_conn110
    Name conn110
    Description connect to MQServer 110 machine
    State Deployed
    Adapter Instance mqdemo_testadapter_conn110__Default
    And I create send/get message services in the defined Application view, and
    they are work because I test the services in WLAI design console.
    Then I try to write client code to use the deployed application view referenced
    by aiuser(adapter).pdf document. And my code is like this :
    Hashtable props = new Hashtable();
    // set the properties
    props.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    props.put(Context.PROVIDER_URL, "t3://localhost:7001");
    props.put(Context.SECURITY_PRINCIPAL, "mqadmin");
    props.put(Context.SECURITY_CREDENTIALS, "weblogic");
    InitialContext initialContext = new InitialContext(props);
    com.bea.wlai.client.ApplicationView appView = new ApplicationView(initialContext,"testadapter_conn110");
    //com.bea.wlai.client.ApplicationView appView = new ApplicationView(initialContext,"mqdemo_testadapter_conn110__Default");
    ConnectionRequestInfoMap map = new ConnectionRequestInfoMap();
    //add ConnectionSpec properties
    //map.put("prop_name","prop_value");
    //put the connectionspec to a EIS
    //appView.setConnectionSpec(map);
    // Create a request document using the definition stored for this
    // Application View at deployment time.
    IDocumentDefinition requestDocumentDef = appView.getRequestDocumentDefinition("sendmsg");
    SOMSchema requestSchema = requestDocumentDef.getDocumentSchema();
    DefaultDocumentOptions options = new DefaultDocumentOptions();
    options.setForceMinOccurs(1);
    options.setRootName("ROOTNAME");
    options.setTargetDocument(DocumentFactory.createDocument());
    IDocument requestDocument = requestSchema.createDefaultDocument(options);
    // Fill in the request with some data. What you fill in depends on
    // the definition of the request document (i.e. its schema)
    requestDocument.setStringInFirst("//ROOT/data/Format","value");
    requestDocument.setStringInFirst("//ROOT/data/Content","this is a test");
    // Invoke the service and retrieve the response document
    IDocument responseDocument = appView.invokeService("sendmsg", requestDocument);
    // Dump the response document out as XML
    //System.out.println("GetSomeData: " + responseDocument.toXML());
    But when I run this code, a jndi exception occured:
    <2003-8-4 ÏÂÎç14ʱ43·Ö20Ãë CST> <Error> <HTTP> <BEA-101017> <[ServletContext(id=8732241,name=rootapp
    ,context-path=/rootapp)] Root cause of ServletException.
    javax.naming.NameNotFoundException: Unable to resolve 'AI_GLOBAL_testadapter_conn110_ApplicationView
    ' Resolved ; remaining name 'AI_GLOBAL_testadapter_conn110_ApplicationView'
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:186)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
    and you can see I set the application view name like "testadapter_conn110" in
    my code, I use "conn110" and also applicaiton ID to try, also occur this excption.
    In the JDK document, the constructor of com.bea.wlai.client.ApplicationView
    showed I should use the 'Name' of the Application View to create a object, but
    it also throw a jndi exception.
    What's the problem ? Hope you guys can help me!!
    Regards,
    shannon

    Shannon,
    Obviously the stack-trace says that u r having some jndi lookup problems...
    just curious check if the JNDI tree of the hosting server (You can check it using
    the admin console) to see if u have your application view is binded.. maybe the
    app view is not binded properly..
    +arvind
    "Shannon Lee" <[email protected]> wrote:
    >
    Hi, guys,
    I try to use the WLI 8.1 released version now. and I deploy a Weblogic
    MQSeries
    dapter 8.1 on WLI 8.1. And have create a Application view which detail
    is like
    this:
    ID demo_testadapter_conn110
    Name conn110
    Description connect to MQServer 110 machine
    State Deployed
    Adapter Instance mqdemo_testadapter_conn110__Default
    And I create send/get message services in the defined Application view,
    and
    they are work because I test the services in WLAI design console.
    Then I try to write client code to use the deployed application view
    referenced
    by aiuser(adapter).pdf document. And my code is like this :
    Hashtable props = new Hashtable();
    // set the properties
    props.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    props.put(Context.PROVIDER_URL, "t3://localhost:7001");
    props.put(Context.SECURITY_PRINCIPAL, "mqadmin");
    props.put(Context.SECURITY_CREDENTIALS, "weblogic");
    InitialContext initialContext = new InitialContext(props);
    com.bea.wlai.client.ApplicationView appView = new ApplicationView(initialContext,"testadapter_conn110");
    //com.bea.wlai.client.ApplicationView appView = new ApplicationView(initialContext,"mqdemo_testadapter_conn110__Default");
    ConnectionRequestInfoMap map = new ConnectionRequestInfoMap();
    //add ConnectionSpec properties
    //map.put("prop_name","prop_value");
    //put the connectionspec to a EIS
    //appView.setConnectionSpec(map);
    // Create a request document using the definition stored for this
    // Application View at deployment time.
    IDocumentDefinition requestDocumentDef = appView.getRequestDocumentDefinition("sendmsg");
    SOMSchema requestSchema = requestDocumentDef.getDocumentSchema();
    DefaultDocumentOptions options = new DefaultDocumentOptions();
    options.setForceMinOccurs(1);
    options.setRootName("ROOTNAME");
    options.setTargetDocument(DocumentFactory.createDocument());
    IDocument requestDocument = requestSchema.createDefaultDocument(options);
    // Fill in the request with some data. What you fill in depends
    on
    // the definition of the request document (i.e. its schema)
    requestDocument.setStringInFirst("//ROOT/data/Format","value");
    requestDocument.setStringInFirst("//ROOT/data/Content","this is a
    test");
    // Invoke the service and retrieve the response document
    IDocument responseDocument = appView.invokeService("sendmsg", requestDocument);
    // Dump the response document out as XML
    //System.out.println("GetSomeData: " + responseDocument.toXML());
    But when I run this code, a jndi exception occured:
    <2003-8-4 ÏÂÎç14ʱ43·Ö20Ãë CST> <Error> <HTTP> <BEA-101017> <[ServletContext(id=8732241,name=rootapp
    ,context-path=/rootapp)] Root cause of ServletException.
    javax.naming.NameNotFoundException: Unable to resolve 'AI_GLOBAL_testadapter_conn110_ApplicationView
    ' Resolved ; remaining name 'AI_GLOBAL_testadapter_conn110_ApplicationView'
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:186)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
    and you can see I set the application view name like "testadapter_conn110"
    in
    my code, I use "conn110" and also applicaiton ID to try, also occur this
    excption.
    In the JDK document, the constructor of com.bea.wlai.client.ApplicationView
    showed I should use the 'Name' of the Application View to create a object,
    but
    it also throw a jndi exception.
    What's the problem ? Hope you guys can help me!!
    Regards,
    shannon

  • How to write BW extractor code in HANA

    Dear All,
    We are writing calculation view in HANA from analyzing logic of BW extractor.
    Can it is possible to write BW code in HANA in ABAP perspective to minimize the effort.
    Regards,
    Amol

    Lars,
    Actually we are spending more time to generating logic from BW ABAP extractor to creation of HANA views.
    Actually I am asking for Help...

  • How to write customer exit code to get current user as default in variable

    Hi guys,
           I design a query which has a variable called var_employee , I also set some default values for this variable in query designer. But I would like to set the current user account who logon on (who execute the query) in the dropdownlist as default user when the variable selection screen appear. of course after that he can choose other avaiable value.
          I look up some related threads, all says that this need some customer exit code, and they mention to use CMOD to create the customer exit , but I don't know the detail process, as I am pretty new on this.
         The attribute of the var_employee  variable is :  employee(defined info object by myself) characterstic value, customer exit.
         Can somebody show me the process to create the customer exit, and the apap code in detail if possbile. then I can try.
          Thanks a lot in advance.
    Best Regards,
    Ben

    Hi,
    Please have a look at:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
    Krzys

  • How to write background color code?

    I took one input field,when i clicked radio button ,the background color will be displayed.

    Hi,
    please check out the link below it might help you
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba1ae35c111d1829f0000e829fbfe/content.htm
    *********please reward points if the information is helpful to you**********

  • How to write this sql query in php code ?

    for example:
    insert into temp
    select *
    from testtable;
    after this, i will query data from sql below:
    select *
    from temp;
    how to write this php code ?
    who can help me ?
    thanks!

    Have a look at the manual to find out how to issue queries.
    http://us3.php.net/oci8

  • Firefox 3 displays the php code when pages launched from dreamweaver 8

    The problem seems to relate to files opening as —
    file:///C:/localweb/ .... when sent from Dreamweaver 8.0 to Firefox
    The first html/php page loads correctly from dreamweaver as
    processed HTML, a second page linked from either an HTML or php
    page also loads correctly, but selecting any link from that or
    subsequent pages displays the full php code instead of processed
    html layout - so this appears to be a third level or greater
    problem.
    If I manually substitute -
    http://localhost/ — the problem
    does not arise.
    This is a problem with version 3 of firefox, all previous
    versions I used worked fine with both — file:///C:/localweb/
    and
    http://localhost/
    Both prefixes also appear with pure HTML sites, but they load
    and function correctly.
    Not every php site I have loads with file:///C:/localweb/, so
    I am wondering if this relates to something in the php code or
    Dreamweaver - I have conn.php set to:
    mysql_connect("localhost", "root", "") or die(mysql_error());
    I use winxp and have xampp installed - everything worked fine
    until I installed Firefox 3

    > but selecting any link from that or subsequent pages
    You are being confused by a) not understanding root relative
    vs document
    relative links, and b) not understanding how DW previews
    files.
    If I have a document with a link to an image that looks like
    this -
    <img src="/images/foo.gif"...
    That's what's called a root relative link.
    If I preview that document in DW, then the browser gets the
    document, sees
    the leading "/" and reads that as the root of the hard drive,
    since the
    browser has no idea where the root of the site is. Thus, the
    image is
    broken in the preview.
    If I have temp files enabled, then DW will secretly convert
    the file being
    previewed into a temporary file, and hand that to the
    browser. This temp
    file has had all root relative links converted to document
    relative links
    (as you will see by looking at the code in the browser), and
    has had all
    include files actually embedded in the page, and has had all
    external CSS
    and js markup embedded in the page. In other words, DW has
    made the
    document into a stand-alone page.
    If you do not have temp files enabled, all of these links
    would be broken on
    preview.
    Now - if you are using root relative links, AND you have temp
    files enabled,
    AND you click away from the previewed document, then all of
    your links will
    be broken, since DW has not made that linked file into a temp
    file. This is
    what you are seeing.
    So - if you want to click away on preview, then you must use
    document
    relative links for the site -
    <img src="../images/foo.gif"... (for example)
    These will still work on preview since the browser knows how
    to determine
    the current file's location and how to follow that path.
    Make sense?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "gbiras" <[email protected]> wrote in
    message
    news:[email protected]...
    > The problem seems to relate to files opening as ?
    file:///C:/localweb/
    > ....
    > when sent from Dreamweaver 8.0 to Firefox
    >
    > The first html/php page loads correctly from dreamweaver
    as processed
    > HTML, a
    > second page linked from either an HTML or php page also
    loads correctly,
    > but
    > selecting any link from that or subsequent pages
    displays the full php
    > code
    > instead of processed html layout - so this appears to be
    a third level or
    > greater problem.
    >
    > If I manually substitute -
    http://localhost/ ? the problem does
    not arise.
    >
    > This is a problem with version 3 of firefox, all
    previous versions I used
    > worked fine with both ? file:///C:/localweb/ and
    http://localhost/
    >
    > Both prefixes also appear with pure HTML sites, but they
    load and function
    > correctly.
    >
    > Not every php site I have loads with
    file:///C:/localweb/, so I am
    > wondering
    > if this relates to something in the php code or
    Dreamweaver - I have
    > conn.php
    > set to:
    >
    > mysql_connect("localhost", "root", "") or
    die(mysql_error());
    >
    > I use winxp and have xampp installed - everything worked
    fine until I
    > installed Firefox 3
    >

Maybe you are looking for

  • Undo changes in an Infotype

    Hi, I have added additional fields to Infotype 0002 using the customer enhancements structure. The Infotype already included some previous changes. After adding the new fields all previous screen attributes and logical checks in the  program were del

  • Reading files from phone memory

    Hi All, I am developing a Universal application using vs 2013 in windows phone 8.1. I am stuck in finding and reading file from phone memory. I have used the Localfolder syntax StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolde

  • Set the clipboard wont work

    This code works by itself, buy when it is in a script that is a drag and drop, the clipboard never gets any data send to it. Why does it work by itself but NOT when it is in a drag and drop script. set container_folder to "Macintosh HD:Users:Shawn:De

  • BTinternet rejecting all our emails

    I am the technical contact for Castweb. We distribute email bulletins of work and casting opportunities for actors to subscribers who have paid for the service. Our email is not spam. Among our actor and agent subscribers are a dozen BTinternet mail

  • Since the last iTunes up date (10.4), whenever I connect a device to the iMac, iTunes doesn't open?

    I've tried my iPod Touch, Shuffle, my iPhone 4, and my other halfs Nano and nothing. It syncs when I open iTunes but it has also stopped opening Last FM and scrobbling also. Do I need to do a reinstall?