Code  for showing a messagi in web dynpro for java

Hi All,
What is the Code  for showing a messagi in web dynpro for java.
Thanks and Regards,
Saurabh

Hello Saurabh,
SuccessMessage - WdComponentAPI.getMessageManager().reportSuccess("Success");
ErrorMessage - WdComponentAPI.getMessageManager().reportException("Error",false);
WarningMessage - WdComponentAPI.getMessageManager().reportWarning("Warning");
Regards
Nizamudeen SM

Similar Messages

  • How to display an error Message in Web Dynpro

    Hello,
    I want to display an error message in Web Dynpro. I'm using this,
    IWDMessageManager message = wdComponentAPI.getMessageManager();
    message.reportSuccess("<some relevant debug message>");
    However, the message is always shown at the bottom of the screen. It is possible to select the location in the screen for showing this object? Or what is the best way for doing this? I've tried to use a Label but I can't set the type (warning, error, info) it's only a message.
    Thanks
    Regards
    SU

    Hi,
    If you include the UI, it will display at the top of the screen..
    Please see below how to create a message in the message editor.
    http://help.sap.com/saphelp_nw04/helpdata/en/72/1d6526263ff24995016a152705eab2/frameset.htm
    and this is how you access the error message in the application ti display it to the end user
    http://help.sap.com/saphelp_nw04/helpdata/en/72/1d6526263ff24995016a152705eab2/frameset.htm
    Regards,
    Ganesh N

  • Messages in Web DYNPRO

    Hi Gurus,
    Can anybody help me to learn different types of messaging in Web Dynpro?
    And some links to learn all about messaging in web dynpro.

    Dear Veera
    There are two ways to define where messages are to be displayed on the screen:
    1. The default position of the message area is on top of the page. If this position
    is fine, the developer does not have do anything.
    2. If a position different from the default message area position is desired,
    the MessageArea container UI element has to be used. A MessageArea UI
    element can be defined as a sub-element of all other container elements.
    Message Handling
    In the Web Dynpro application, you can set the way messages are displayed. On
    the Properties tab of a Web Dynpro application, message handling can be defined
    by setting the radio button to the following values:
    • Show Message Component on Demand
    If at least one message is reported, the message area is displayed in a
    group-box style. The message area contains the last message and information
    about the number of messages reported in total. In addition, a button is
    displayed, allowing the user to display all messages in a list. Messages
    related to UI elements are displayed as links. Selecting such a link navigates
    to the UI element related to the message.
    • Always Display Message Component
    In addition to the behavior described above, the message area is also
    displayed if no message is reported.
    • Display Messages Without Message Component
    All messages reported are displayed in the message area. This area does not
    have a group-box style, but it is transparent. All messages are displayed
    at once; no extra navigation is required to obtain the list of all messages.
    Messages related to UI elements are displayed as links. Selecting such a link
    navigates to the UI element related to the message.
    Methods for Defining Messages:
    In order to report a message, methods of the IF_WD_MESSAGE_MANAGER
    interface have to be used. The Web Dynpro runtime automatically instantiates a
    class implementing this interface. The reference to this class can be obtained from
    the self reference WD_THIS, using the expressions:
    r_api = wd_this->wd_get_api().
    r_mmanager = r_api->get_message_manager().
    Methods
    REPORT_ATTRIBUTE_ERROR_MESSAGE (Parameter PARAMS)
    REPORT_SUCCESS (Parameter PARAMS)
    REPORT_WARNING (Parameter PARAMS)
    REPORT_ERROR_MESSAGE (Parameter PARAMS)
    REPORT_FATAL_ERROR_MESSAGE (Parameter PARAMS)
    REPORT_ATTRIBUTE_EXCEPTION NO (Parameters ELEMENT, ATTRIBUTE_NAME)
    REPORT_FATAL_EXCEPTION
    REPORT_ATTRIBUTE_T100_MESSAGE (Parameters P1, P2, P3, P4)
    REPORT_T100_MESSAGE (Parameters P1, P2, P3, P4)

  • HT201209 I bought a movie with the digital copy and it gives me option to redeem it with iTunes, but when I type in the redeem code it shows a message saying: you must insert your digital copy dvd in the computer in order to redeem this code" . The dvd is

    I bought a movie with the digital copy and it gives me option to redeem it with iTunes, but when I type in the redeem code it shows a message saying: " you must insert your digital copy dvd in this computer in order to redeem this code" . The dvd is in. WTH? This is especially with FOX movies, I never have trouble with Universal Picture movies.

    Thanks for your reply, but you might have misunderstood it a bit. I'm NOT trying to buy a movie. ****, I'm not even in the actual Apple Store, when this happens I'm in the library not the Store part of iTunes.
    To clarify - I have purchased a physical copy of a movie which came with another physical copy which contains the digital copy. The digital copy is on the DVD, all I need is just to transfer this file to my iPod Touch, for example, I'm not trying to download it from the store or repurchase it and it's not any gift code that I've received, the digital copy is on the disc. This is the first time ever that I've purchased something on a disc and I'm not allowed to access it because the disc hasn't been purchased within my country.
    So again - I'm not attempting any purchase or download any purchased digital copy - it's on a DVD I own physically so... why is even the region of my Store relevant, the code I enter is (as I assume) just supposed to check if it's a legal genuine copy (which it is, as I've said - there are 6 discs in the pack: 3 movies on 3 Blu-rays and 3 DVD containing these digital copies of them). If I own it, I think that's proof enough that I have the right to use it. I just don't get it. I fully agree with you and understand your point if there was any purchase going on here, but it's not, it's just - I put a disc into my computer and I can't access it

  • How do I rewrite current code for java 1.3

    I'm using the code below that is written for java 1.4. I have been told that the company can not push JRE 1.4 to the company, and that I need to write my code for java 1.3. I'm using org.w3c.dom for my create xml, etc.
    Is there a java 1.3 option to the 1.4? Any help would be very appreciated.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.List;
    import java.io.*;
    import java.util.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import org.w3c.dom.*;
    public class Sametime extends JFrame implements ActionListener {
        private int indentation = -1;
        JPanel panel = new JPanel();
        JTextArea jta = new JTextArea(
        //Instructions for user
        "For a successful buddy list migration do the following:\n"
        + "1. Save your current Sametime Buddy List to your PC.\n   "
        + "The default location should be: C:/Program Files/Lotus/Sametime Client.\n"
        + "  A. Open the Sametime Client.\n"
        + "  B. Click on People\n"
        + "  C. Click on Save List.\n"
        + "  D. Save as your first.last.dat\n"
        + "     Ex. john.doe.dat\n"
        + "NOTE: If you have AOL contacts in your Sametime buddy list they will not be migrated.\n");
        JButton browse = new JButton("Continue");
        JButton exit = new JButton("Exit");
        public Sametime() {
            super("Sametime Buddy List Migration");
            setSize(610, 245);
            Container c = this.getContentPane();
            c.add(panel);
            browse.addActionListener(this);
            exit.addActionListener(this);
            panel.add(jta);
            panel.add(browse);
            panel.add(exit);
            jta.setEditable(false);
            setLookAndFeel();
            setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        } //end Sametime
        public class DATFilter extends javax.swing.filechooser.FileFilter {
            public boolean accept(File f) {
                //if it is a directory -- we want to show it so return true.
                if (f.isDirectory())
                    return true;
                String extension = getExtension(f);//get the extension of the file
                //check to see if the extension is equal to "dat"
                if ((extension.equals("dat")))
                    return true;
                //default -- fall through. False is return on all
                //occasions except:
                //a) the file is a directory
                //b) the file's extension is what we are looking for.
                return false;
            }//end accept
            public String getDescription() {
                return "dat files";
            }//end getDescription
             * Method to get the extension of the file, in lowercase
            private String getExtension(File f) {
                String s = f.getName();
                int i = s.lastIndexOf('.');
                if (i > 0 &&  i < s.length() - 1)
                    return s.substring(i+1).toLowerCase();
                return "";
            }//end getExtension
        }//end class DATFilter
        public void actionPerformed(ActionEvent e) {
            //Default Location for JFileChooser search
            String error = "The file selected is not a .dat file!\n"
            + "Please select your recently saved .dat file and try again.";
            JFileChooser fc = new JFileChooser("/Program Files/Lotus/Sametime Client");
            fc.setFileFilter(new DATFilter());
            fc.setFileSelectionMode( JFileChooser.FILES_ONLY);
            String user = System.getProperty("user.name");// finds who the current user is
            if (e.getSource() == browse) {
                int returnVal = fc.showSaveDialog(Sametime.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    //if (fc.getSelectedFile().getName().equals(".dat")){
                    if (fc.getSelectedFile().getName().endsWith(".dat")){ // checks to see if selected file is .dat
                    }else{
                        JOptionPane.showMessageDialog(null, error, "Wrong File", JOptionPane.ERROR_MESSAGE);
                        return;
                    }//end else
                    try {
                        String[] contactArray = parseDatFile(fc.getSelectedFile());
                        Document document = createXMLDocument(contactArray);
                        saveToXMLFile(
                        document,
                        new File(
                        "C:/Documents and Settings/" + user +"/My Documents/OLCS/",// looks for directory for list
                        "contacts-list_migration.ctt"));
                    } catch (Exception exc) {
                        File f = new File("C:/Documents and Settings/" + user +"/My Documents/OLCS/");// setting directory for list if not there
                        boolean yes = true;
                        yes = f.mkdir();// creating directory
                        try {
                            String[] contactArray = parseDatFile(fc.getSelectedFile());
                            Document document = createXMLDocument(contactArray);
                            saveToXMLFile(
                            document,
                            new File(
                            "C:/Documents and Settings/" + user +"/My Documents/OLCS/",// used only if the directory didn't exist
                            "contacts-list_migration.ctt"));
                            //exc.printStackTrace();// not sure if this is needed?
                        } catch (Exception exc1) {
                            exc1.printStackTrace();
                        }//end inner catch
                    }// end catch
                }// end if
                if(returnVal==JFileChooser.CANCEL_OPTION){
                    String Warning = "You did not migrate your Sametime buddy list at this time.";
                    JOptionPane.showMessageDialog(null, Warning, "Migration Canceled", JOptionPane.WARNING_MESSAGE);
                    return;
                }else{
                    String thankyou = "Thank You for Migrating your Sametime buddy list to OLCS"
                    + "\nYour new OLCS buddy list has been saved to:"
                    + "\nC:/Documents and Settings/" + user +"/My Documents/OLCS"
                    + "\n as: Contact-List_migration.ctt"
                    + "\n\n To be able to use Contact-List_migration.ctt for Windows Messenger:"
                    + "\n1. Log into Windows Messenger."
                    + "\n2. Click on File"
                    + "\n3. Click on 'Import Contacts from a Saved File...'"
                    + "\n4. Open OLCS in My Documents"
                    + "\n5. Click on 'Contact-list_migration.ctt'"
                    + "\n6. Click Open to import the list."
                    + "\n   A window will pop up confirming that you want to add all of the contacts"
                    + "\n   Click 'yes'"
                    + "\n   Your buddy list is ready to be used.";
                    JOptionPane.showMessageDialog(null, thankyou, "Migration Completed", JOptionPane.INFORMATION_MESSAGE);//Change this when defualt directory is known.
                }//end if else statement
            } //end if
            System.exit( 0 );
            if (e.getSource() == exit) {
                System.exit( 0 );
            } //end if
        } //end actionPerformed
        String[] parseDatFile(File datFile)
        throws Exception    {
            List list = new ArrayList();
            BufferedReader br = new BufferedReader(new FileReader(datFile));
            String line;
            while ((line = br.readLine()) != null) {
                line = line.trim();
                if (line.indexOf("U") != 0)
                    continue;
                int p = line.indexOf("::");
                if (p == -1)
                    continue;
                line = line.substring(p + 2).trim();
                if (line.indexOf("AOL") == 0)
                    continue;
                p = line.indexOf(",");
                if (p != -1)
                    line = line.substring(0, p);
                line = line.trim() + "@mci.com";
                if (list.indexOf(line) == -1)
                    list.add(line);
            }//end while
            br.close();
            String[] contactArray = new String[list.size()];
            list.toArray(contactArray);
            return contactArray;
        }// end String
        // setting up the XML file
        Document createXMLDocument(String[] contactArray) throws Exception {
            DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = dBF.newDocumentBuilder();
            DOMImplementation domImpl = builder.getDOMImplementation();
            Document document = domImpl.createDocument(null, "messenger", null);
            Element root = document.getDocumentElement();
            Element svcElm = document.createElement("service");
            Element clElm = document.createElement("contactlist");
            svcElm.setAttribute("name", "Microsoft RTC Instant Messaging");
            svcElm.appendChild(clElm);
            root.appendChild(svcElm);
            for (int i = 0; i < contactArray.length; i++) {
                Element conElm = document.createElement("contact");
                Text conTxt = document.createTextNode(contactArray);
    conElm.appendChild(conTxt);
    clElm.appendChild(conElm);
    }//end for
    return document;
    }// end Document
    void saveToXMLFile(Document document, File xmlFile) throws Exception {
    OutputStream os =
    new BufferedOutputStream(new FileOutputStream(xmlFile));
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");//puts information on seperate lines
    transformer.setOutputProperty(OutputKeys.METHOD, "xml");
    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");//gives the XML file indentation
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
    DOMSource source = new DOMSource(document);
    StreamResult result = new StreamResult(os);
    transformer.transform(source, result);
    os.close();
    }//end saveToXMLFile
    public static void main(String[] args) {
    Sametime st = new Sametime();
    ImageIcon picIcon = new ImageIcon(st.getClass().getResource("/images/mci.gif"));//Change when default is known!
    st.setIconImage(picIcon.getImage());
    } //end main
    private void setLookAndFeel() {
    try {
    UIManager.setLookAndFeel(
    UIManager.getSystemLookAndFeelClassName());
    SwingUtilities.updateComponentTreeUI(this);
    } catch (Exception e) {
    System.err.println("Could not use Look and Feel: " + e);
    } //end catch
    } //end void setLookAndFeel
    } //end public class Sametime

    Are there features of Java 1.4 that you specifically took advantage and are there any particular lines you are having problems with or did you just freak and post it here?
    Basically compile it under Java 1.3 and see what complains. I've done several projects that compile under 1.2, 1.3, and 1.4.

  • SAP Web Dynpro With Java

    Hi Guys
    A situation at work has forced me to learn web dynpro    with java. I already have some experience with the ABAP    web dynpro   . Now the question is how much "java" do i need to learn to learn sap WebDynpro    based on java. Should I first try and get a fair 'hands on' on core java and then shoot for web dynpro    or should I take the other approach, that is just learn as much java as is required for web dynpro   . Any suggestions?
    thanks
    sameer

    Hi Sameer,
    I believe you need not thoroughly know Core Java to begin for Web Dynpro Java but yes, you should have a fair idea about object, class and exceptions that i believe you would already have after working in ABAP. The UI elements can be just inserted into the component by drag and drop and codes correspondly would be auto generated. Only for customization of some functionalities, you will have to write code in Java using APIs.
    Just go through the following tutorials recommended by SAP to start over Web Dynpro Java on NWDS.
    http://help.sap.com/saphelp_nw70/helpdata/en/16/c0d93f5e0f9015e10000000a155106/frameset.htm
    Regards,
    Tushar Sinha,
    Infosys,
    Hyderabad

  • 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

  • Error messages on Web Dynpro ABAP

    Hi all!!
    I have created a Web Dynpro ABAP which consumes 2 Web Services from XI through Proxy classes.
    When a method of a Proxy class from a WS gives an exception, an error screen is automatically displayed, How could I handle this exception and personalize the error message??
    Thanks and regards,
    Manuel Míguez.

    Hi,
    here's the documentation on <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/05a5421935c511e10000000a1550b0/frameset.htm">error pages</a>
    For information on messages, see
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/d8/2a934259a5cb6ae10000000a155106/frameset.htm">here</a>
    Regards, Heidi

  • Theming Options for Web Dynpro ABAP/Java - Custom CSS

    What options are available for creating a custom CSS for WDA?  My project is going towards SAPUI5, and they want to apply the same look and feeavl to their Web Dynpro applications.
    I know the Theme Designer is an option - but this customer is running on NW 7.3.  Obviously to get the WD CSS to look similar UI5, it will require changing all of the WD selectors.
    Finally, we have a 7.4 Sandbox.  If I build the theme there, is it backwards compatible to their 7.3 landscape?

    UI Theme Designer is the only supported way and it is available for NW 7.3 as well, assuming you are up to date on Support Packages. As long as you create a theme with UI Theme Designer the theme will work in any system that supports the same, there might be small functional and visual differences though depending on the SP levels of the source and target systems. SAP recommendation is to always use the latest version available to create (and consume) themes. You could start by using the Cloud version of UI Theme Designer, export and import into your own system. That said your NW 7.3 system needs to support UI Theme Designer to be able to use custom themes created by it.

  • This browser shows-not supported by web dynpro when open selfcare.ndc.bsnl.co.in

    ''dupe of https://support.mozilla.org/en-US/questions/916084''
    when i open 'selfcare.ndc.bsnl.co.in to check my account usages,on screen appears 'your browser/programme is not supported by Web Dynpro.

    I have downloaded firefox 10 version but my problem is not solved.After browsing selfcare.ndc.bsnl.co.in, a page welcome to customer care portal opens. After login this page with user ID and password another page of sap netweaver portal opens.On this page a message appears,"Your browser/programme is not supported by Web Dynpro".While Safari Browser opens account usage,My services etc. onthis page.

  • Example code for java compiler with a simple GUI

    There is no question here (though discussion of the code is welcome).
    /* Update 1 */
    Now available as a stand alone or webstart app.! The STBC (see the web page*) has its own web page and has been improved to allow the user to browse to a tools.jar if one is not found on the runtime classpath, or in the JRE running the code.
    * See [http://pscode.org/stbc/].
    /* End: Update 1 */
    This simple example of using the JavaCompiler made available in Java 1.6 might be of use to check that your SSCCE is actually what it claims to be!
    If an SSCCE claims to display a runtime problem, it should compile cleanly when pasted into the text area above the Compile button. For a compilation problem, the code should show the same output errors seen in your own editor (at least until the last line of the output in the text area).
    import java.awt.BorderLayout;
    import java.awt.Font;
    import java.awt.EventQueue;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JLabel;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.JButton;
    import javax.swing.SwingWorker;
    import javax.swing.border.EmptyBorder;
    import java.util.ArrayList;
    import java.net.URI;
    import java.io.ByteArrayOutputStream;
    import java.io.OutputStreamWriter;
    import javax.tools.ToolProvider;
    import javax.tools.JavaCompiler;
    import javax.tools.SimpleJavaFileObject;
    /** A simple Java compiler with a GUI.  Java 1.6+.
    @author Andrew Thompson
    @version 2008-06-13
    public class GuiCompiler extends JPanel {
      /** Instance of the compiler used for all compilations. */
      JavaCompiler compiler;
      /** The name of the public class.  For 'HelloWorld.java',
      this would be 'HelloWorld'. */
      JTextField name;
      /** The source code to be compiled. */
      JTextArea sourceCode;
      /** Errors and messages from the compiler. */
      JTextArea output;
      JButton compile;
      static int pad = 5;
      GuiCompiler() {
        super( new BorderLayout(pad,pad) );
        setBorder( new EmptyBorder(7,4,7,4) );
      /** A worker to perform each compilation. Disables
      the GUI input elements during the work. */
      class SourceCompilation extends SwingWorker<String, Object> {
        @Override
        public String doInBackground() {
          return compileCode();
        @Override
        protected void done() {
          try {
            enableComponents(true);
          } catch (Exception ignore) {
      /** Construct the GUI. */
      public void initGui() {
        JPanel input = new JPanel( new BorderLayout(pad,pad) );
        Font outputFont = new Font("Monospaced",Font.PLAIN,12);
        sourceCode = new JTextArea("Paste code here..", 15, 60);
        sourceCode.setFont( outputFont );
        input.add( new JScrollPane( sourceCode ),
          BorderLayout.CENTER );
        sourceCode.select(0,sourceCode.getText().length());
        JPanel namePanel = new JPanel(new BorderLayout(pad,pad));
        name = new JTextField(15);
        name.setToolTipText("Name of the public class");
        namePanel.add( name, BorderLayout.CENTER );
        namePanel.add( new JLabel("Class name"), BorderLayout.WEST );
        input.add( namePanel, BorderLayout.NORTH );
        compile = new JButton( "Compile" );
        compile.addActionListener( new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              (new SourceCompilation()).execute();
        input.add( compile, BorderLayout.SOUTH );
        this.add( input, BorderLayout.CENTER );
        output = new JTextArea("", 5, 40);
        output.setFont( outputFont );
        output.setEditable(false);
        this.add( new JScrollPane( output ), BorderLayout.SOUTH );
      /** Compile the code in the source input area. */
      public String compileCode() {
        output.setText( "Compiling.." );
        enableComponents(false);
        String compResult = null;
        if (compiler==null) {
          compiler = ToolProvider.getSystemJavaCompiler();
        if ( compiler!=null ) {
          String code = sourceCode.getText();
          String sourceName = name.getText().trim();
          if ( sourceName.toLowerCase().endsWith(".java") ) {
            sourceName = sourceName.substring(
              0,sourceName.length()-5 );
          JavaSourceFromString javaString = new JavaSourceFromString(
            sourceName,
            code);
          ArrayList<JavaSourceFromString> al =
            new ArrayList<JavaSourceFromString>();
          al.add( javaString );
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          OutputStreamWriter osw = new OutputStreamWriter( baos );
          JavaCompiler.CompilationTask task = compiler.getTask(
            osw,
            null,
            null,
            null,
            null,
            al);
          boolean success = task.call();
          output.setText( baos.toString().replaceAll("\t", "  ") );
          compResult = "Compiled without errors: " + success;
          output.append( compResult );
          output.setCaretPosition(0);
        } else {
          output.setText( "No compilation possible - sorry!" );
          JOptionPane.showMessageDialog(this,
            "No compiler is available to this runtime!",
            "Compiler not found",
            JOptionPane.ERROR_MESSAGE
          System.exit(-1);
        return compResult;
      /** Set the main GUI input components enabled
      according to the enable flag. */
      public void enableComponents(boolean enable) {
        compile.setEnabled(enable);
        name.setEnabled(enable);
        sourceCode.setEnabled(enable);
      public static void main(String[] args) throws Exception {
        Runnable r = new Runnable() {
          public void run() {
            JFrame f = new JFrame("SSCCE text based compiler");
            f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            GuiCompiler compilerPane = new GuiCompiler();
            compilerPane.initGui();
            f.getContentPane().add(compilerPane);
            f.pack();
            f.setMinimumSize( f.getSize() );
            f.setLocationRelativeTo(null);
            f.setVisible(true);
        EventQueue.invokeLater(r);
    * A file object used to represent source coming from a string.
    * This example is from the JavaDocs for JavaCompiler.
    class JavaSourceFromString extends SimpleJavaFileObject {
      * The source code of this "file".
      final String code;
      * Constructs a new JavaSourceFromString.
      * @param name the name of the compilation unit represented
        by this file object
      * @param code the source code for the compilation unit
        represented by this file object
      JavaSourceFromString(String name, String code) {
        super(URI.create(
          "string:///" +
          name.replace('.','/') +
          Kind.SOURCE.extension),
          Kind.SOURCE);
        this.code = code;
      @Override
      public CharSequence getCharContent(boolean ignoreEncodingErrors) {
        return code;
    }Edit 1:
    Added..
            f.setMinimumSize( f.getSize() );Edited by: AndrewThompson64 on Jun 13, 2008 12:24 PM
    Edited by: AndrewThompson64 on Jun 23, 2008 5:54 AM

    kevjava wrote: Some things that I think would be useful:
    Suggestions reordered to suit my reply..
    kevjava wrote: 2. Line numbering, and/or a line counter so you can see how much scrolling you're going to be imposing on the forum readers.
    Good idea, and since the line count is only a handful of lines of code to implement, I took that option. See the [line count|http://pscode.org/stbc/help.html#linecount] section of the (new) [STBC Help|http://pscode.org/stbc/help.html] page for more details. (Insert plaintiff whining about the arbitrary limits set - here).
    I considered adding line length checking, but the [Text Width Checker|http://pscode.org/twc/] ('sold separately') already has that covered, and I would prefer to keep this tool more specific to compilation, which leads me to..
    kevjava wrote: 1. A button to run the code, to see that it demonstrates the problem that you wish for the forum to solve...
    Interesting idea, but I think that is better suited to a more full blown (but still relatively simple) GUId compiler. I am not fully decided that running a class is unsuited to STBC, but I am more likely to implement a clickable list of compilation errors, than a 'run' button.
    On the other hand I am thinking the clickable error list is also better suited to an altogether more abled compiler, so don't hold your breath to see either in the STBC.
    You might note I have not bothered to update the screenshots to show the line count label. That is because I am still considering error lists and running code, and open to further suggestion (not because I am just slack!). If the screenshots update to include the line count but nothing else, take that as a sign. ;-)
    Thanks for your ideas. The line count alone is worth a few Dukes.

  • Web Dynpro without Java stack?

    Hello
    a simple question : Is is possible to deveop and run Web Dynpro applications on a system with no Java stack? It is a ECC 6.0 system.
    Thanks
    A.

    Hi Aleksandra, 
    Yes it is posible to develop and run Web Dynpro applications without Java Stack.
    For Web Dynpro for ABAP :- Java stack not required, you can do with SAP System T-Code - SE80 if Web Dynpro Component available in your sap system.
    For Web Dynpro for Java :- You must require Java Stack.
    Hope this will helps you.
    Thanks
    Arun Jaiswal

  • Web Dynpro ABAP - Java stack required?

    Hey everyone,
    We are currently planning an upgrade to ECC 6.0 and Netweaver 2004s. A source of debate during this planning has been whether or not to install the Java stack in our upgraded system.
    I'm an ABAP developer, so I'm really looking forward to using Web Dynpro ABAP. Does anyone know if the Java stack is required to effectively use Web Dynpro ABAP? It seems like the two should be independent...but I just want to be sure.
    Thanks in advance!!
    Chad

    No, you do not need the java stack to run WDA applications.  It runs purely on the ABAP stack.  You can develop your WDA app in SE80 and run it.  It will run in a browser from the ABAP stack.  If you have a portal, then you know that this runs on the java stack.  Also, your portal is probably not running on the same box as your backend ERP system.  If you running a portal, I would suggest installing both the java stack as well as the ABAP stack for you portal to run on.  Then you will be able to use WDA to create applications to run in your portal.
    So to sum up,  the portal runs on the java side, if you have both stacks running under your portal you can development WDA and WDJ applications, which both can run on that same engine.  To answer you question, you DON'T need the java stack to develop and run your WDA application, but if you want it to run in a portal, then you need a java stack to run the portal on top of.  This can be a completly separate box and a standalone java stack.   Did I confuse you even more?
    REgards,
    Rich Heilman

  • How to Pass Java Objects between Web Dynpro and Java SAP iViews

    Basically I have an SAP web dynpro iView that I do stuff with and I want to pass an object to another iView which is just a regular Java iView. From what I've read and tried, I can't just stick something in the session object and hope that the Java iView can pull it down the other end. I had a dream that it was possible (seriously).
    Anyway, are there any possible solutions around? Please advice and share you throughts. I will try to dream about it again tonight and see if its really gonna work this time.
    thanks for your help in advance

    There is no easy way you can pass objects other than those supported by express such as String, map, list etc.
    Though not advised, you can create a class with static variables to handle the storage of such java objects during transition between form and workflow. You will need to somehow identify the objects uniquely .

  • New to Programming, need your help with writing code for java in Xcode.

    Hey everyone! Sorry if I sound like a total idiot here with a bunch of developers but I could really use your help. I am in college and having a bit of problems with my intro to programming class. The class is entirely Java based and so, after having to use dos windows on my grandpas crappy laptop I found out about xcode. I downloaded and installed it but I am having problems seeing where exactly it is that I am to write my code for a normal java application. Any help would be greatly appreciated! I wrote it on the bottom of a bunch of code that looked strange to me. For relatively simple java programs I chose the java application template. Is there something here that I missed?

    The Java Application project template looks like it sets up an application and some kind of starting UI using Swing/AWT. I didn't look at it too indepth, but if you are in an introductory course this might be more than you need to complete your assignments. There doesn't seem to be blank Java template, so I don't know what you should use. Perhaps just a blank project you add your .java files to.
    To answer where to write code, you would write it in your .java files under the /src folder. Execution begins in
    public static void main(String args[]) {}
    in YourAppName.java, then creates an object based on your application class, and runs the code from there to display the UI.

Maybe you are looking for

  • Need help on extensibility of response headers

    hi everyone Is it possible toextend the functionality of response headers through servlets help wud be greatly appreciated thanks in advance

  • Can't get adf-faces-demo.war working on WLS 8.1 SP5

    Did a search & found some others facing the same difficulties as I am, also followed some recommendations of using an exploded war instead of archive war, and also adding some JARs from Tomcat 5.5.* onto my classpath, but the demo still refuses to wo

  • Once rich images in Photoshop now appear flat.

    Photos I had previously edited in Photoshop now appear flat in Photoshop, Bridge, Illustrator, Preview, and in the Finder. These same files look good on websites, and also when I drag them into an email. The Color Settings in Photoshop match the file

  • WiFi looses connection when idling

    Hi, I've updated to Mavericks and since then I've following issue. If my network connection idles for a certain amount of time, Mavericks decides to drop the connection. The WiFi smybol gets greyed out and I have to maually reconnect to my network. F

  • LR 1.2: can't import from device with 40D

    Hi, Import photos from device menu is disabled in LR 1.2 when my 40D is connected via USB, even though Canon software works ok to retrieve pictures. I've tried many things, shutting down LR and /r the camera, but nothing makes it work, menu remains g