Modify the footer with java-script

Hi,
Im' trying to modify the content of the footer in the master-page using java-script. So I put in the initialize event of the footer code to add "!" after a text field (with plenty of space left) but it doesn't do anything. The code is example.rawValue = example.rawValue + "!";
This code works fine in the rest of the document, but it doesn't seem to work in the master-page.
Could somebody tell me what I'm doing wrong?
Thanks in advance!
Gert

The access to the masterpage objects is not in the same scope as where the script is running so you must path to it starting from the root:
so.... form1.pageSet.Page1.example.rawValue = form1.pageSet.Page1.example.rawValue + "!";
where form1 is the root node of your form (look in the hierarchy view), pageSet indicates the objects in the Master Pages, Page1 is the 1st Page name in the Master Pages and exampel is the path to th erest of the object.
Make sense?

Similar Messages

  • Problem with Java Script after upgrade from BW 3.5 to BI7

    Dear Colleagues,
    We're facing the issue with Java Script after upgrade of BW 3.5 to BI7.
    Just after update we checked the basic functionality and it occured that some of web templates that use Java Script don't work. They generate seelction screen, but after selection the screen becomes blank without any error messages.
    We're currently stucked since web templates weren't converted to BI7 version so they should work exactly as before the upgrade.
    We compared the Java code with other environment that was not upgraded - it's perfectly the same.
    The only explanation that comes to my mind is that some Java Script settings on the server level were changed during the upgrade but I have no idea where I can check that.
    Thanks in advance for any suggestions,
    Andrzej Bobula

    Hi Deepu,
    Thanks, it was great to read your reply and then few minutes later talk to you live on SDN Day!
    Unfortunately, http cache clean-up did not help. But there is another funny thing I found - for exactly the same 3.5 webtemplate html code returned from WebAS 3.5 was different then from 7.0.
    Unfortunately, this editor does not allow to paste complete code, even in CODE brackets, but here are main differences:
    <b>3.5</b>
       if (navigator.appName == "Microsoft Internet Explorer")
    <frame src="/sap/bw/BEx?SAP-LANGUAGE=E&PAGENO=1&REQUEST_NO=1&CMD=GET_TEMPLATE"
    name="Content">
    and
    <b>7.0</b>
       if (navigator.appName.indexOf("Microsoft Internet Explorer")!=-1)
    <frame src="/sap/bw/BEx?SAP-LANGUAGE=E&PAGENO=8&REQUEST_NO=0&CMD=GET_TEMPLATE"
    name="Content" 0nLoad="javascript:loadTitle()">
    (I intentionaly put 0 i/o o in 0nLoad, otherwise Forum's editor does not accept the text.
    How about SAP's claim that technical upgrade from 3.x to 7.0 changes nothing?
    Regards,
    Vitaliy

  • Mozilla is lying when it says Java Script is unnecessary for the avcrage user.Java script is not working in Firefox 7.01

    I want to roll back to an earlier version Firefox that works with Java Script how can I do this. Where I can download an earlier version? You know what the problems are. I am NOT going to list them. Own up to your errors. You made an incorrect conscious decision to break with Java compatibility.

    Mozilla is not lying about average users, but it shows contempt for experienced users, or those that want to be able to get the more out of their browser, or use it for work or school.
    Java and JavaScript are not the same thing. I trust you are referring to JavaScript problems and a lot of collateral damage associated with the mess.
    # Prohibition on Webpages being able to resize or move windows with JavaScript
    # Prohibition on Users being able to move or resize windows with JavaScript
    # Ignoring the fact that there were already user controls in Tools > Options > Content > Javascript > Advanced
    # Making JavaScript inoperable from Location bar as a command, or in a keyword shortcut that involves moving resizing windows
    # Destroying use of AwesomeBar search, Bookmark searching for bookmarks containing JavaScript, making internal searches very unreliable
    Firefox 8 comes out November the 8th and it nor later versions show any reversal of this mess.
    Firefox 3.6.* should remain safe to use for some time, as corporate users will not put up with nonsense when they support thousands of users.
    For those that really need an older version of Firefox [ftp://ftp.mozilla.org/pub/firefox/releases releases] (all releases, including 4.0.1 and 5.0) or with the latest of [http://www.mozilla.com/en-US/firefox/all-older.html Firefox 3]. Mac OSX 10.4 users can't upgrade to 4.0.1
    When you reinstall a different version, at the end of the install, don't let the install start Firefox for you, rather exit, and then start Firefox in the normal manner to avoid inadvertently creating and using a new profile without your bookmarks, etc.
    What would be better would be to use multiple versions / profiles at the same time, which is certainly beyond average users, particularly when Mozilla has historically and purposely made such things difficult. But if interested see [http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox Using multiple profiles - Firefox - MozillaZine Knowledge Base]

  • Web site with Java Scripts ( on iphone4)

    try to open a web site with Java scripts , but it just show empty on the scripts section , anyone can help ? (on iphone 4 with iOS 4.1)

    Hi, welcome to Apple Discussions.
    Web pages that make use of Javascript should work just fine. Those that have embedded Java applications won't. Java & Javascript are two different animals despite the similarity in the names. Like Flash, Java is not supported on iOS.
    tt2

  • Problems with Java Scripting API

    Hello Everyone!
    Guys, I need help with Java scripting API. A problem is that I cannot understand how can I operate Java Object's fields and methods from the script language. I have chosen embedded javascript to work with. And I can get the fields and methods of in-box java classes (such as ArrayList for example), but I cannot work with methods and fields from my own classes!
    Here is an example:
    public class ScriptingExample {  
        class MyClass {  
            int myfield = 5;  
            int getInt() {return 7;}  
        public void runExample() {  
            ScriptEngineManager mgr = new ScriptEngineManager();  
            List<ScriptEngineFactory> factories = mgr.getEngineFactories();  
            ScriptEngineManager factory = new ScriptEngineManager();  
            ScriptEngine engine = factory.getEngineByName("JavaScript");  
            MyClass mc = new MyClass();  
            try{  
                engine.put("mc", mc);  
                engine.eval("print(mc.myfield); print(mc.getInt())"); // or engine.eval("print(mc.myfield)");
            } catch (Exception e) {e.printStackTrace();}  
    }  If I run the code with the commented part it prints "undefined" instead of "5".
    If I run the code as it is it prints error instead of "7":
    undefinedjavax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function getInt. (<Unknown source>#1) in <Unknown source> at line number 1
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at javax.script.AbstractScriptEngine.eval(Unknown Source)
    at solutiondatabase.ScriptingExample.runExample(ScriptingExample.java:26)
    at solutiondatabase.Main.main(Main.java:49)
    How can I fix it?

    Guys,
    please let me raise this topic because several new questions emerged.
    (1) How can I get all the variables created inside my engine?
    There are two kinds of variables: first kind is Java obejcts put inside the engine and second kind is the variables created in my script, such as 'var a = 4;'. How can I list all the variables of that two kinds?
    (2) Is there is a way to make 'import static' to the engine? I dont want to write MyClass.MyEnum.MyEnumItem every time. Also, I cannot put the whole enum into the engine with engine.put("MyEnum", MyEnum); I can put only enum items separately: engine.put("MyEnum", MyEnum.EnumItemA);. Thats why I ask about static import.
    (3) How can I cast engine variables back to java variables inside my java code?
    Here is my example:
    package mypackage;
    import java.util.ArrayList;
    import java.util.List;
    import javax.script.ScriptEngine;
    import javax.script.ScriptEngineFactory;
    import javax.script.ScriptEngineManager;
    public class Main
         public static void main(String[] args) throws Exception 
              ScriptEngineManager mgr = new ScriptEngineManager();
              List<ScriptEngineFactory> factories = mgr.getEngineFactories();
              ScriptEngineManager factory = new ScriptEngineManager();
              ScriptEngine engine = factory.getEngineByName("JavaScript");
              ArrayList<Double> myList = new ArrayList<Double>();
              myList.add(5.0);                    
              engine.put("MyList", myList);     
              engine.eval("MyVar = MyList.get(0);");
              System.out.println((Double)engine.get("MyVar"));
    }The result is:
    Exception in thread "main" java.lang.ClassCastException: sun.org.mozilla.javascript.internal.NativeJavaObject cannot be cast to java.lang.Double
    +     at mypackage.Main.main(Main.java:28)+
    Is it possible to retrieve my Double java object from the engine?
    Edited by: Dmitry_MSK on Aug 6, 2010 1:56 AM

  • I want to read and assign value of ADF Table rows  with Java Script

    Hi,
    I want to read and assign value of ADF Table rows with Java Script, but I cant true index of current row , so I assign wrong value to anathor column of ADF Table.
    My Code;
    ADF Table items
    <af:column sortProperty="Adet" sortable="false"
    headerText="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.labels.Adet}"
    binding="#{backing_ucret.column2}" id="column2">
    <af:inputText value="#{row.Adet}"
    required="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.attrDefs.Adet.mandatory}"
    columns="10"
    binding="#{backing_ucret.inputText2}"
    id="inputText2" onchange="getTutar('#{bindings.voHarcamaOdeme1Iterator.rangeStart + bindings.voHarcamaOdeme1Iterator.currentRowIndexInRange + 1}','#{bindings.voHarcamaOdeme1Iterator.estimatedRowCount}','#{row.index}')">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.formats.Adet}"/>
    </af:inputText>
    </af:column>
    MY JAVA SCRIPT CODE
    <f:verbatim>
    <script language="javascript" type="text/javascript">
    function getTutar(rowkey,totalrow,currentRow){
    alert('rowkey--totalRow--currentRow-->'+rowkey+'--'+totalrow+'--'+currentRow);
    if (currentRow==0) {
    rowkey=totalrow-1;
    }else{
    var rw=totalrow-currentRow-1;
    rowkey=rw;
    alert(document.getElementById('form1:table1:'+rowkey+':inputText8').value);
    alert(document.getElementById('form1:table1:'+currentRow+':inputText8').value);
    var birim_ucret=document.getElementById('form1:table1:'+rowkey+':inputText8').value;
    var adet=document.getElementById('form1:table1:'+rowkey+':inputText2').value;
    document.getElementById('form1:table1:'+rowkey+':inputText3').value=birim_ucret*adet;
    document.getElementById('form1:inputText6').value=0;
    var t;
    var toplam=0;
    alert('before Sum');
    for (var i=0;i!=totalrow-1;i++){
    t = document.getElementById('form1:table1:'+i+':inputText3');
    toplam+=t.value*1;
    document.getElementById('form1:inputText6').value=toplam;
    </script>
    </f:verbatim>

    You can achieve the use case you describe with partial page rendering (PPR), a feature of the ADF Faces framework. Here are a few posts that achieve an interactive behavior using PPR. Off the top of my head I do not know of an exact example, but this should be a good starting point:
    http://thepeninsulasedge.com/blog/2006/09/12/adf-faces-aftableselectmany/
    http://thepeninsulasedge.com/blog/2006/08/31/adf-faces-working-with-aftableselectone-and-the-dialog-framework/
    --RiC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Getting the error access denied trying to modify the workbook with identifier in Disocverer Admin

    Hi All,
    I have exported a workbook created by business user as an .eex file logging in as discoverer admin from a Production enviornment (transactional databse) and trying to import it to a different environment called reporting environment ( non transactional databse) and getting a warning 'WFS GTP REPORT SINAPORE.eex:Access denied trying to modify the workbook with identifier 'WFS_GTP_REPORT_SINGAPORE'.
    It says Files Partially Imported so clicked on Finish to complete the import.
    The report has been imported under the user account but the sharing to the different responsibilities/Users has not been imported. I need to import the report with the sharing of the responsibilities/users as well.
    I do not have an option login into discoverer administratore using the user account, i can only login using the administator account ( i know loging in as the business user it self will allow you to import the sharing). But our DBA's oppse this is a security threat for the users as you are logging in as the user in production environment.
    Please help with this issue.

    I have the same problem, and I figured out that my windows is installed in french, and every users groups are created in french also, groups like Everyone don't exists and i can't change by console.
    Regards, Roberto Borges please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Issue with Java script associated with WAD template

    Hi Experts,
    I made some changes in the Java Script in Tcode SE80. I actually downloaded it, made changes, saved it and then clicked on Upload and replace in SE80. When I opened the Web cockpit, the changes were relecting as anticipated.
    But the changes are still showing up even after reverting the changes in java scripts and uploading it again.Please let me know what needs to be done to revert the changes such that it will  ot show up in the Web Cockpit.
    I think the "Upload and replace option" worked only once in my case. Kindly suggest. Thanks
    Regards,
    Kavitha Jagannath

    I would like to know how to do this process.  I would like my students to complete the module and then enter there name in the certificate line.  Then have them enter their email address so that the certificate can be emailed to them and they can print it off.  I would like to have the certificate be a PDF file so they cannot alter the name of the person who took the course.

  • Replace the wait with java embedding thread.sleep() function

    Hi,
    How to replace the wait with java embedding thread.sleep() function. Can anyone help.
    Thanks.

    drag and drop the java embedding component
    include the following code in it.
    try{ 
    Thread.sleep(60000);
    }catch(Exception e)
    --Prasanna                                                                                                                                                                                                                                                                                                                           

  • Combine JSP with Java Script!

    Hi,
    I am writing a .jsp file. I am able to put value of jsp into my java script code like..
    var i = <%= k %>
    but, now my requirement is reverse. I need to put the value of java script variable i into jsp variable k.
    Someone told me that it is possible using eval function.
    Now, using eval function , I can do the following ...
    function xyz() //java script function
    eval(<% int k = 5; %>);
    but, I need to put the value of java script variable i into k.
    I tried eval(<% int k = %> + i);
    but it is not working that way.
    Can anyone tell me how can I achieve this? Please reply as soon as possible.
    Thanks

    Just came across this, and even though it's old, I thought Id add something to it since I know a lot got problems combining javascript and jsp; and that most usually don't provide enough info to get someone started.
    To be able to "use" Java variables inside a javascript, you need to pass them in the function call:
    <%
        String aVariableToPass = "tadaaaaa";
    %>
    <form onSubmit="myFunction(this,'<%=aVariableToPass %>')" method="post" name="myForm" action="">
       <table>
         <tr>
              <td>
                   <input type="submit" value=HitMe" name="submit"/>
              </td>
         </tr>
       </table>
    </form>The function:
    function myFunction(form, theVariablePassedIn)
             var accessToTheVariable = theVariablePassedIn;
    }Now use accessToTheVariable inside the javascript, or theVariablePassedIn directly if you please.
    Cincerely. P

  • Crawling the Web with Java

    Hi everyone.
    I've been trying to learn how to make a web crawler in java following this detailed albeit old tutorial: http://www.devarticles.com/c/a/Java/Crawling-the-Web-with-Java/
    The SearchCrawler class they feature can be found in two parts:
    First part: http://www.devarticles.com/c/a/Java/Crawling-the-Web-with-Java/3/
    Second part: http://www.devarticles.com/c/a/Java/Crawling-the-Web-with-Java/4/
    I don't want to copy and paste the code because it is really long and an eyesore if viewing here.
    I get a lot of errors when compiling of which I do not understand. The majority of the errors (62 of them to be precise) are "class, interface or enum expected" errors, with the remaining few being "illegal start of type" and "<identifier> expected" errors.
    Can someone here perhaps take a look at it and compile it and see if they also get the same errors? I realise it is an old tutorial but there are hardly any detailed resources I can find for java web crawlers.
    Thanks.

    Odd I can't seem to log into my account. Never mind.
    I have used java before, the problem here I suppose is I'm not good enough to spot what's the problem. The code seems fine bracket wise and it has really left me stumped.
    If someone code put it in their editor and attempt to compile and see if I'm not the only one that's having a problem.. that would be much appreciated.
    For your convenience... the code from the example I linked:
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.util.regex.*;
    import javax.swing.*;
    import javax.swing.table.*;
    // The Search Web Crawler
    public class SearchCrawler extends JFrame
      // Max URLs drop-down values.
      private static final String[] MAX_URLS =
        {"50", "100", "500", "1000"};
      // Cache of robot disallow lists.
      private HashMap disallowListCache = new HashMap();
      // Search GUI controls.
      private JTextField startTextField;
      private JComboBox maxComboBox;
      private JCheckBox limitCheckBox;
      private JTextField logTextField;
      private JTextField searchTextField;
      private JCheckBox caseCheckBox;
      private JButton searchButton;
      // Search stats GUI controls.
      private JLabel crawlingLabel2;
      private JLabel crawledLabel2;
      private JLabel toCrawlLabel2;
      private JProgressBar progressBar;
      private JLabel matchesLabel2;
      // Table listing search matches.
      private JTable table;
      // Flag for whether or not crawling is underway.
      private boolean crawling;
      // Matches log file print writer.
      private PrintWriter logFileWriter;
      // Constructor for Search Web Crawler.
      public SearchCrawler()
        // Set application title.
        setTitle("Search Crawler");
        // Set window size.
        setSize(600, 600);
         // Handle window closing events.
        addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           actionExit();
        // Set up File menu.
        JMenuBar menuBar = new JMenuBar();
        JMenu fileMenu = new JMenu("File"); 
        fileMenu.setMnemonic(KeyEvent.VK_F);
        JMenuItem fileExitMenuItem = new JMenuItem("Exit",
          KeyEvent.VK_X);
        fileExitMenuItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) { 
            actionExit();
        fileMenu.add(fileExitMenuItem);
        menuBar.add(fileMenu);
        setJMenuBar(menuBar);
        // Set up search panel.
        JPanel searchPanel = new JPanel();
        GridBagConstraints constraints;
        GridBagLayout layout = new GridBagLayout();
        searchPanel.setLayout(layout);
        JLabel startLabel = new JLabel("Start URL:");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.EAST; 
        constraints.insets = new Insets(5, 5, 0, 0);
        layout.setConstraints(startLabel, constraints);
        searchPanel.add(startLabel);
        startTextField = new JTextField();
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 0, 5);
        layout.setConstraints(startTextField, constraints);
        searchPanel.add(startTextField);
        JLabel maxLabel = new JLabel("Max URLs to Crawl:");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.EAST;
        constraints.insets = new Insets(5, 5, 0, 0);
        layout.setConstraints(maxLabel, constraints);
        searchPanel.add(maxLabel);
        maxComboBox = new JComboBox(MAX_URLS);
        maxComboBox.setEditable(true);
        constraints = new GridBagConstraints();
        constraints.insets = new Insets(5, 5, 0, 0);
        layout.setConstraints(maxComboBox, constraints);
        searchPanel.add(maxComboBox);
        limitCheckBox =
          new JCheckBox("Limit crawling to Start URL site");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.WEST;
        constraints.insets = new Insets(0, 10, 0, 0);
        layout.setConstraints(limitCheckBox, constraints);
        searchPanel.add(limitCheckBox);
        JLabel blankLabel = new JLabel();
        constraints = new GridBagConstraints();
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        layout.setConstraints(blankLabel, constraints);
        searchPanel.add(blankLabel);
        JLabel logLabel = new JLabel("Matches Log File:");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.EAST;
        constraints.insets = new Insets(5, 5, 0, 0);
        layout.setConstraints(logLabel, constraints);
        searchPanel.add(logLabel);
        String file =
          System.getProperty("user.dir") +
          System.getProperty("file.separator") +
          "crawler.log";
        logTextField = new JTextField(file);
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 0, 5);
        layout.setConstraints(logTextField, constraints);
        searchPanel.add(logTextField);
        JLabel searchLabel = new JLabel("Search String:");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.EAST; 
        constraints.insets = new Insets(5, 5, 0, 0);
        layout.setConstraints(searchLabel, constraints);
        searchPanel.add(searchLabel);
        searchTextField = new JTextField();
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.insets = new Insets(5, 5, 0, 0);
        constraints.gridwidth= 2;
        constraints.weightx = 1.0d;
        layout.setConstraints(searchTextField, constraints);
        searchPanel.add(searchTextField);
        caseCheckBox = new JCheckBox("Case Sensitive");
        constraints = new GridBagConstraints();
        constraints.insets = new Insets(5, 5, 0, 5);
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        layout.setConstraints(caseCheckBox, constraints);
        searchPanel.add(caseCheckBox);
        searchButton = new JButton("Search");
        searchButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            actionSearch();
        constraints = new GridBagConstraints();
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 5, 5);
        layout.setConstraints(searchButton, constraints);
        searchPanel.add(searchButton);
        JSeparator separator = new JSeparator();
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 5, 5);
        layout.setConstraints(separator, constraints);
        searchPanel.add(separator);
        JLabel crawlingLabel1 = new JLabel("Crawling:");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.EAST;
        constraints.insets = new Insets(5, 5, 0, 0);
        layout.setConstraints(crawlingLabel1, constraints);
        searchPanel.add(crawlingLabel1);
        crawlingLabel2 = new JLabel();
        crawlingLabel2.setFont(
          crawlingLabel2.getFont().deriveFont(Font.PLAIN));
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 0, 5);
        layout.setConstraints(crawlingLabel2, constraints);
        searchPanel.add(crawlingLabel2);
        JLabel crawledLabel1 = new JLabel("Crawled URLs:");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.EAST;
        constraints.insets = new Insets(5, 5, 0, 0);
        layout.setConstraints(crawledLabel1, constraints);
        searchPanel.add(crawledLabel1);
        crawledLabel2 = new JLabel();
        crawledLabel2.setFont(
          crawledLabel2.getFont().deriveFont(Font.PLAIN));
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 0, 5);
        layout.setConstraints(crawledLabel2, constraints);
        searchPanel.add(crawledLabel2);
        JLabel toCrawlLabel1 = new JLabel("URLs to Crawl:");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.EAST;
        constraints.insets = new Insets(5, 5, 0, 0);
        layout.setConstraints(toCrawlLabel1, constraints);
        searchPanel.add(toCrawlLabel1);
        toCrawlLabel2 = new JLabel();
        toCrawlLabel2.setFont(
          toCrawlLabel2.getFont().deriveFont(Font.PLAIN));
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 0, 5);
        layout.setConstraints(toCrawlLabel2, constraints);
        searchPanel.add(toCrawlLabel2);
        JLabel progressLabel = new JLabel("Crawling Progress:");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.EAST;
        constraints.insets = new Insets(5, 5, 0, 0);
        layout.setConstraints(progressLabel, constraints);
        searchPanel.add(progressLabel);
        progressBar = new JProgressBar();
        progressBar.setMinimum(0);
        progressBar.setStringPainted(true);
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 0, 5);
        layout.setConstraints(progressBar, constraints);
        searchPanel.add(progressBar);
        JLabel matchesLabel1 = new JLabel("Search Matches:");
        constraints = new GridBagConstraints();
        constraints.anchor = GridBagConstraints.EAST;
        constraints.insets = new Insets(5, 5, 10, 0);
        layout.setConstraints(matchesLabel1, constraints);
        searchPanel.add(matchesLabel1);
        matchesLabel2 = new JLabel();
        matchesLabel2.setFont(
          matchesLabel2.getFont().deriveFont(Font.PLAIN));
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 10, 5);
        layout.setConstraints(matchesLabel2, constraints);
        searchPanel.add(matchesLabel2);
        // Set up matches table.
        table =
          new JTable(new DefaultTableModel(new Object[][]{},
            new String[]{"URL"}) {
          public boolean isCellEditable(int row, int column)
            return false;
        // Set up Matches panel.
        JPanel matchesPanel = new JPanel();
        matchesPanel.setBorder(
          BorderFactory.createTitledBorder("Matches"));
        matchesPanel.setLayout(new BorderLayout());
        matchesPanel.add(new JScrollPane(table),
          BorderLayout.CENTER);
        // Add panels to display.
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(searchPanel, BorderLayout.NORTH);
        getContentPane().add(matchesPanel,BorderLayout.CENTER);
      // Exit this program.
      private void actionExit() {
        System.exit(0);
      // Handle Search/Stop button being clicked.
      private void actionSearch() {
        // If stop button clicked, turn crawling flag off.
        if (crawling) {
          crawling = false;
          return;
      ArrayList errorList = new ArrayList();
      // Validate that start URL has been entered.
      String startUrl = startTextField.getText().trim();
      if (startUrl.length() < 1) {
        errorList.add("Missing Start URL.");
      // Verify start URL.
      else if (verifyUrl(startUrl) == null) {
        errorList.add("Invalid Start URL.");
      // Validate that Max URLs is either empty or is a number.
      int maxUrls = 0;
      String max = ((String) maxComboBox.getSelectedItem()).trim();
      if (max.length() > 0) {
        try {
          maxUrls = Integer.parseInt(max);
        } catch (NumberFormatException e) {
        if (maxUrls < 1) {
          errorList.add("Invalid Max URLs value.");
      // Validate that matches log file has been entered.
      String logFile = logTextField.getText().trim();
      if (logFile.length() < 1) {
        errorList.add("Missing Matches Log File.");
      // Validate that search string has been entered.
      String searchString = searchTextField.getText().trim();
      if (searchString.length() < 1) {
        errorList.add("Missing Search String.");
      // Show errors, if any, and return.
      if (errorList.size() > 0) {
        StringBuffer message = new StringBuffer();
        // Concatenate errors into single message.
        for (int i = 0; i < errorList.size(); i++) {
          message.append(errorList.get(i));
          if (i + 1 < errorList.size()) {
            message.append("\n");
        showError(message.toString());
        return;
      // Remove "www" from start URL if present.
      startUrl = removeWwwFromUrl(startUrl);
      // Start the Search Crawler.
      search(logFile, startUrl, maxUrls, searchString);
    private void search(final String logFile, final String startUrl,
      final int maxUrls, final String searchString)
      // Start the search in a new thread.
      Thread thread = new Thread(new Runnable() {
        public void run() {
          // Show hour glass cursor while crawling is under way.
          setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
          // Disable search controls.
          startTextField.setEnabled(false);
          maxComboBox.setEnabled(false);
          limitCheckBox.setEnabled(false);
          logTextField.setEnabled(false);
          searchTextField.setEnabled(false);
          caseCheckBox.setEnabled(false);
          // Switch Search button to "Stop."
          searchButton.setText("Stop");
          // Reset stats.
          table.setModel(new DefaultTableModel(new Object[][]{},
            new String[]{"URL"}) {
            public boolean isCellEditable(int row, int column)
              return false;
           updateStats(startUrl, 0, 0, maxUrls);
          // Open matches log file.
          try {
            logFileWriter = new PrintWriter(new FileWriter(logFile));
          } catch (Exception e) {
            showError("Unable to open matches log file.");
            return;
          // Turn crawling flag on.
          crawling = true;
          // Perform the actual crawling.
          crawl(startUrl, maxUrls, limitCheckBox.isSelected(),
            searchString, caseCheckBox.isSelected());
          // Turn crawling flag off.
          crawling = false;
          // Close matches log file.
          try {
            logFileWriter.close();
          } catch (Exception e) {
            showError("Unable to close matches log file.");
          // Mark search as done.
          crawlingLabel2.setText("Done");
          // Enable search controls.
          startTextField.setEnabled(true);
          maxComboBox.setEnabled(true);
          limitCheckBox.setEnabled(true);
          logTextField.setEnabled(true);
          searchTextField.setEnabled(true);
          caseCheckBox.setEnabled(true);
          // Switch search button back to "Search."
          searchButton.setText("Search");
          // Return to default cursor.
          setCursor(Cursor.getDefaultCursor());
          // Show message if search string not found.
          if (table.getRowCount() == 0) {
            JOptionPane.showMessageDialog(SearchCrawler.this,
              "Your Search String was not found. Please try another.",
              "Search String Not Found",
              JOptionPane.WARNING_MESSAGE);
      thread.start();
    // Show dialog box with error message.
    private void showError(String message) {
      JOptionPane.showMessageDialog(this, message, "Error",
        JOptionPane.ERROR_MESSAGE);
    // Update crawling stats.
    private void updateStats(
      String crawling, int crawled, int toCrawl, int maxUrls)
      crawlingLabel2.setText(crawling);
      crawledLabel2.setText("" + crawled);
      toCrawlLabel2.setText("" + toCrawl);
      // Update progress bar.
      if (maxUrls == -1) {
        progressBar.setMaximum(crawled + toCrawl);
      } else {
        progressBar.setMaximum(maxUrls);
      progressBar.setValue(crawled);
      matchesLabel2.setText("" + table.getRowCount());
    // Add match to matches table and log file.
    private void addMatch(String url) {
      // Add URL to matches table.
      DefaultTableModel model =
        (DefaultTableModel) table.getModel();
      model.addRow(new Object[]{url});
      // Add URL to matches log file.
      try {
        logFileWriter.println(url);
      } catch (Exception e) {
        showError("Unable to log match.");
    // Verify URL format.
    private URL verifyUrl(String url) {
      // Only allow HTTP URLs.
      if (!url.toLowerCase().startsWith("http://"))
        return null;
      // Verify format of URL.
      URL verifiedUrl = null;
      try {
        verifiedUrl = new URL(url);
      } catch (Exception e) {
        return null;
      return verifiedUrl;
    // Check if robot is allowed to access the given URL. private boolean isRobotAllowed(URL urlToCheck) {
      String host = urlToCheck.getHost().toLowerCase();
      // Retrieve host's disallow list from cache.
      ArrayList disallowList =
        (ArrayList) disallowListCache.get(host);
      // If list is not in the cache, download and cache it.
      if (disallowList == null) {
        disallowList = new ArrayList();
        try {
          URL robotsFileUrl =
            new URL("http://" + host + "/robots.txt");
          // Open connection to robot file URL for reading.
          BufferedReader reader =
            new BufferedReader(new InputStreamReader(
              robotsFileUrl.openStream()));
          // Read robot file, creating list of disallowed paths.
          String line;
          while ((line = reader.readLine()) != null) {
            if (line.indexOf("Disallow:") == 0) {
              String disallowPath =
                line.substring("Disallow:".length());
              // Check disallow path for comments and remove if present.
              int commentIndex = disallowPath.indexOf("#");
              if (commentIndex != -1) {
                disallowPath =
                  disallowPath.substring(0, commentIndex);
              // Remove leading or trailing spaces from disallow path.
              disallowPath = disallowPath.trim();
              // Add disallow path to list.
              disallowList.add(disallowPath);
          // Add new disallow list to cache.
          disallowListCache.put(host, disallowList);
        catch (Exception e) {
          /* Assume robot is allowed since an exception
             is thrown if the robot file doesn't exist. */
          return true;
      /* Loop through disallow list to see if
         crawling is allowed for the given URL. */
      String file = urlToCheck.getFile();
      for (int i = 0; i < disallowList.size(); i++) {
        String disallow = (String) disallowList.get(i);
        if (file.startsWith(disallow)) {
          return false;
      return true;
    // Download page at given URL.
    private String downloadPage(URL pageUrl) {
      try {
        // Open connection to URL for reading.
        BufferedReader reader =
          new BufferedReader(new InputStreamReader(
            pageUrl.openStream()));
        // Read page into buffer.
        String line;
        StringBuffer pageBuffer = new StringBuffer();
        while ((line = reader.readLine()) != null) {
          pageBuffer.append(line);
        return pageBuffer.toString();
      } catch (Exception e) {
      return null;
    // Remove leading "www" from a URL's host if present.
    private String removeWwwFromUrl(String url) {
      int index = url.indexOf("://www.");
      if (index != -1) {
        return url.substring(0, index + 3) +
          url.substring(index + 7);
      return (url);
    // Parse through page contents and retrieve links.
    private ArrayList retrieveLinks(
      URL pageUrl, String pageContents, HashSet crawledList,
      boolean limitHost)
      // Compile link matching pattern.
      Pattern p =
        Pattern.compile("<a\\s+href\\s*=\\s*\"?(.*?)[\"|>]",
          Pattern.CASE_INSENSITIVE);
      Matcher m = p.matcher(pageContents);
      // Create list of link matches.
      ArrayList linkList = new ArrayList();
      while (m.find()) {
        String link = m.group(1).trim();
        // Skip empty links.
        if (link.length() < 1) {
          continue;
        // Skip links that are just page anchors.
        if (link.charAt(0) == '#') {
          continue;
        // Skip mailto links.
        if (link.indexOf("mailto:") != -1) {
          continue;
        // Skip JavaScript links.
        if (link.toLowerCase().indexOf("javascript") != -1) {
          continue;
        // Prefix absolute and relative URLs if necessary.
        if (link.indexOf("://") == -1) {
          // Handle absolute URLs.
          if (link.charAt(0) == '/') {
            link = "http://" + pageUrl.getHost() + link;
          // Handle relative URLs.
          } else {
            String file = pageUrl.getFile();
            if (file.indexOf('/') == -1) {
              link = "http://" + pageUrl.getHost() + "/" + link;
            } else {
              String path =
                file.substring(0, file.lastIndexOf('/') + 1);
              link = "http://" + pageUrl.getHost() + path + link;
        // Remove anchors from link.
        int index = link.indexOf('#');
        if (index != -1) {
          link = link.substring(0, index);
        // Remove leading "www" from URL's host if present.
        link = removeWwwFromUrl(link);
        // Verify link and skip if invalid.
        URL verifiedLink = verifyUrl(link);
        if (verifiedLink == null) {
          continue;
        /* If specified, limit links to those
          having the same host as the start URL. */
        if (limitHost &&
            !pageUrl.getHost().toLowerCase().equals(
              verifiedLink.getHost().toLowerCase())) 
          continue;
        // Skip link if it has already been crawled.
        if (crawledList.contains(link)) {
          continue;
        // Add link to list.
        linkList.add(link);
      return (linkList);
    /* Determine whether or not search string is
       matched in the given page contents. */
    private boolean searchStringMatches(
      String pageContents, String searchString,
      boolean caseSensitive)
      String searchContents = pageContents;
      /* If case-sensitive search, lowercase
         page contents for comparison. */
      if (!caseSensitive) {
        searchContents = pageContents.toLowerCase();
      // Split search string into individual terms.
      Pattern p = Pattern.compile("[\\s]+");
      String[] terms = p.split(searchString);
      // Check to see if each term matches.
      for (int i = 0; i < terms.length; i++) {
        if (caseSensitive) {
          if (searchContents.indexOf(terms) == -1) {
    return false;
    } else {
    if (searchContents.indexOf(terms[i].toLowerCase()) == -1) {
    return false;
    return true;
    // Perform the actual crawling, searching for the search string.
    public void crawl(
    String startUrl, int maxUrls, boolean limitHost,
    String searchString, boolean caseSensitive)
    // Set up crawl lists.
    HashSet crawledList = new HashSet();
    LinkedHashSet toCrawlList = new LinkedHashSet();
    // Add start URL to the to crawl list.
    toCrawlList.add(startUrl);
    /* Perform actual crawling by looping
    through the To Crawl list. */
    while (crawling && toCrawlList.size() > 0)
    /* Check to see if the max URL count has
    been reached, if it was specified.*/
    if (maxUrls != -1) {
    if (crawledList.size() == maxUrls) {
    break;
    // Get URL at bottom of the list.
    String url = (String) toCrawlList.iterator().next();
    // Remove URL from the To Crawl list.
    toCrawlList.remove(url);
    // Convert string url to URL object.
    URL verifiedUrl = verifyUrl(url);
    // Skip URL if robots are not allowed to access it.
    if (!isRobotAllowed(verifiedUrl)) {
    continue;
    // Update crawling stats.
    updateStats(url, crawledList.size(), toCrawlList.size(),
    maxUrls);
    // Add page to the crawled list.
    crawledList.add(url);
    // Download the page at the given URL.
    String pageContents = downloadPage(verifiedUrl);
    /* If the page was downloaded successfully, retrieve all its
    links and then see if it contains the search string. */
    if (pageContents != null && pageContents.length() > 0)
    // Retrieve list of valid links from page.
    ArrayList links =
    retrieveLinks(verifiedUrl, pageContents, crawledList,
    limitHost);
    // Add links to the To Crawl list.
    toCrawlList.addAll(links);
    /* Check if search string is present in
    page, and if so, record a match. */
    if (searchStringMatches(pageContents, searchString,
    caseSensitive))
    addMatch(url);
    // Update crawling stats.
    updateStats(url, crawledList.size(), toCrawlList.size(),
    maxUrls);
    // Run the Search Crawler.
    public static void main(String[] args) {
    SearchCrawler crawler = new SearchCrawler();
    crawler.show();
    }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Coding to send mail but body with java script

    Hi,
    here my requirement is send mail in action but body with java script just tell me how i include java script in coding of mail sending.
    regards,
    ss

    self

  • Sreaming at the top of my lungs for HELP with Java Script problem!

    Hello,
    I have this strange problem that no one seems to know why or how to fix it.Whenever I encounter a web site that has java scripting for anything pop ups or redirects to url's anything that says java script when I mouse over the link my browsers do nothing.That is for explorer 6.0 beta netscape 4.7 and netscape version 6.I have tried in another forum some suggestions but nothing changed even though I am told nothing is wrong with the java scripting.I used to be able to click java script's with all of these browsers but no longer.That was a few months ago.Now to try something new I tried to see if a new browser would work.I now have the latest version of Opera.It did work but using Opera on some sites limits what I can do so it doesn't solve my problem.Then I tried the Sun JavaHot browser it also worked but limits what I can do on some site's.I have Windows 98 & updated most of my dll's etc & my java is version 2 1.3.1.My java script is enabled in Explorer & netscape's & the security is at a minimum level.Please help me figure out why these other browsers work but the other's do not.I want to edit a web site of mine but I can't because of this problem.I am very frustrated by this and need as detailed help as I can get.Anything of a suggestion would be very much appreciated.But I am also not an expert on the working's of a computer so bear with me.
    Brian

    Hi,
    Well I am thinking that if anyone could know something about Java script it would be java developers.But anyways I had the previous version of explorer 5.0 & the java didn't work in it either.Now how weird is this,I opened netscape 4.7 today & the java scripts are suddenly working.This has me scratching my head wondering if my computer is possesed by some force beyond my capability to know...????Weird as it seems though the explorer still will not respond to a java script.
    Brian

  • Set the value of an adf number slider with java script

    Hi,
    i develop a adf 11 webapplication with JDeveloper 11.
    in one page i use the number slider component and i wish to set the value with a clientlistern in javascript.
    is this possible??
    thanks,
    hannes

    Hi,
    did you try
    slider = AdfPage.PAGE.findComponent("<sliderId>");
    slider.setProperty("value",<your value>);
    Frank

  • Help with Java script

    So , I edited the ITunes.java as described in the Admin guide.Copied the .class to my cgi folder in the server.I copied the itunesu file from the shell folder of the sample code.I have modified it accordingly.But when I run it in browser(Firefox) as ..../cgi-bin/itunesu it just gives me a blank page.Nothing shows up.I ran the ITunes.java file locally and it generates an HTML output, which I copied and created a new html.After I run this HTML file, it opens my itunes, but again it says page not found and url contains https://www.xxx.edu/cgi-bin/itunesu?destination=xxx.edu where xxx is my institution name.Not sure if I am supposed to display my institution name in forum.
    The admin guide says on page 15 step 4.Copy the itunes.class file and other itunes file to your web server's cgi-bin directory.
    I am not quiet sure what does other itunes file mean??
    This is how my .java file looks.
    import java.io.*;
    import java.net.*;
    import java.security.*;
    import java.util.*;
    * The <CODE>ITunesU</CODE> class permits the secure transmission
    * of user credentials and identity between an institution's
    * authentication and authorization system and iTunes U.
    * The code in this class can be tested by
    * running it with the following commands:
    * <PRE>
    * javac ITunesU.java
    * java ITunesU</PRE>
    * Changes to values defined in this class' main() method must
    * be made before it will succesfully communicate with iTunes U.
    public class ITunesU extends Object {
    * Generate the HMAC-SHA256 signature of a message string, as defined in
    * RFC 2104.
    * @param message The string to sign.
    * @param key The bytes of the key to sign it with.
    * @return A hexadecimal representation of the signature.
    public String hmacSHA256(String message, byte[] key) {
    // Start by getting an object to generate SHA-256 hashes with.
    MessageDigest sha256 = null;
    try {
    sha256 = MessageDigest.getInstance("SHA-256");
    } catch (NoSuchAlgorithmException e) {
    throw new java.lang.AssertionError(
    this.getClass().getName()
    + ".hmacSHA256(): SHA-256 algorithm not found!");
    // Hash the key if necessary to make it fit in a block (see RFC 2104).
    if (key.length > 64) {
    sha256.update(key);
    key = sha256.digest();
    sha256.reset();
    // Pad the key bytes to a block (see RFC 2104).
    byte block[] = new byte[64];
    for (int i = 0; i < key.length; ++i) block = key;
    for (int i = key.length; i < block.length; ++i) block = 0;
    // Calculate the inner hash, defined in RFC 2104 as
    // SHA-256(KEY ^ IPAD + MESSAGE)), where IPAD is 64 bytes of 0x36.
    for (int i = 0; i < 64; ++i) block ^= 0x36;
    sha256.update(block);
    try {
    sha256.update(message.getBytes("UTF-8"));
    } catch (UnsupportedEncodingException e) {
    throw new java.lang.AssertionError(
    "ITunesU.hmacSH256(): UTF-8 encoding not supported!");
    byte[] hash = sha256.digest();
    sha256.reset();
    // Calculate the outer hash, defined in RFC 2104 as
    // SHA-256(KEY ^ OPAD + INNER_HASH), where OPAD is 64 bytes of 0x5c.
    for (int i = 0; i < 64; ++i) block ^= (0x36 ^ 0x5c);
    sha256.update(block);
    sha256.update(hash);
    hash = sha256.digest();
    // The outer hash is the message signature...
    // convert its bytes to hexadecimals.
    char[] hexadecimals = new char[hash.length * 2];
    for (int i = 0; i < hash.length; ++i) {
    for (int j = 0; j < 2; ++j) {
    int value = (hash >> (4 - 4 * j)) & 0xf;
    char base = (value < 10) ? ('0') : ('a' - 10);
    hexadecimals[i * 2 + j] = (char)(base + value);
    // Return a hexadecimal string representation of the message signature.
    return new String(hexadecimals);
    * Combine user credentials into an appropriately formatted string.
    * @param credentials An array of credential strings. Credential
    * strings may contain any character but ';'
    * (semicolon), '\\' (backslash), and control
    * characters (with ASCII codes 0-31 and 127).
    * @return <CODE>null</CODE> if and only if any of the credential strings
    * are invalid.
    public String getCredentialsString(String[] credentials) {
    // Create a buffer with which to generate the credentials string.
    StringBuffer buffer = new StringBuffer();
    // Verify and add each credential to the buffer.
    if (credentials != null) {
    for (int i = 0; i < credentials.length; ++i) {
    if (i > 0) buffer.append(';');
    for (int j = 0, n = credentials.length(); j < n; ++j) {
    char c = credentials.charAt(j);
    if (c != ';' && c != '\\' && c >= ' ' && c != 127) {
    buffer.append(c);
    } else {
    return null;
    // Return the credentials string.
    return buffer.toString();
    * Combine user identity information into an appropriately formatted string.
    * @param displayName The user's name (optional).
    * @param emailAddress The user's email address (optional).
    * @param username The user's username (optional).
    * @param userIdentifier A unique identifier for the user (optional).
    * @return A non-<CODE>null</CODE> user identity string.
    public String getIdentityString(String displayName, String emailAddress,
    String username, String userIdentifier) {
    // Create a buffer with which to generate the identity string.
    StringBuffer buffer = new StringBuffer();
    // Define the values and delimiters of each of the string's elements.
    String[] values = { displayName, emailAddress,
    username, userIdentifier };
    char[][] delimiters = { { '"', '"' }, { '<'(', ')' }, { '[', ']' } };
    // Add each element to the buffer, escaping
    // and delimiting them appropriately.
    for (int i = 0; i < values.length; ++i) {
    if (values != null) {
    if (buffer.length() > 0) buffer.append(' ');
    buffer.append(delimiters[0]);
    for (int j = 0, n = values.length(); j < n; ++j) {
    char c = values.charAt(j);
    if (c == delimiters[1] || c == '\\') buffer.append('\\');
    buffer.append(c);
    buffer.append(delimiters[1]);
    // Return the generated string.
    return buffer.toString();
    * Generate an iTunes U digital signature for a user's credentials
    * and identity. Signatures are usually sent to iTunes U along
    * with the credentials, identity, and a time stamp to warrant
    * to iTunes U that the credential and identity values are
    * officially sanctioned. For such uses, it will usually makes
    * more sense to use an authorization token obtained from the
    * {@link #getAuthorizationToken(java.lang.String, java.lang.String, java.util.Date, byte[])}
    * method than to use a signature directly: Authorization
    * tokens include the signature but also the credentials, identity,
    * and time stamp, and have those conveniently packaged in
    * a format that is easy to send to iTunes U over HTTPS.
    * @param credentials The user's credentials string, as
    * obtained from getCredentialsString().
    * @param identity The user's identity string, as
    * obtained from getIdentityString().
    * @param time Signature time stamp.
    * @param key The bytes of your institution's iTunes U shared secret key.
    * @return A hexadecimal representation of the signature.
    public String getSignature(String credentials, String identity,
    Date time, byte[] key) {
    // Create a buffer in which to format the data to sign.
    StringBuffer buffer = new StringBuffer();
    // Generate the data to sign.
    try {
    // Start with the appropriately encoded credentials.
    buffer.append("credentials=");
    buffer.append(URLEncoder.encode(credentials, "UTF-8"));
    // Add the appropriately encoded identity information.
    buffer.append("&identity=");
    buffer.append(URLEncoder.encode(identity, "UTF-8"));
    // Add the appropriately formatted time stamp. Note that
    // the time stamp is expressed in seconds, not milliseconds.
    buffer.append("&time=");
    buffer.append(time.getTime() / 1000);
    } catch (UnsupportedEncodingException e) {
    // UTF-8 encoding support is required.
    throw new java.lang.AssertionError(
    "ITunesU.getSignature(): UTF-8 encoding not supported!");
    // Generate and return the signature.
    String signature = this.hmacSHA256(buffer.toString(), key);
    return signature;
    * Generate and sign an authorization token that you can use to securely
    * communicate to iTunes U a user's credentials and identity. The token
    * includes all the data you need to communicate to iTunes U as well as
    * a creation time stamp and a digital signature for the data and time.
    * @param credentials The user's credentials string, as
    * obtained from getCredentialsString().
    * @param identity The user's identity string, as
    * obtained from getIdentityString().
    * @param time Token time stamp. The token will only be valid from
    * its time stamp time and for a short time thereafter
    * (usually 90 seconds).
    * @param key The bytes of your institution's iTunes U shared secret key.
    * @return The authorization token. The returned token will
    * be URL-encoded and can be sent to iTunes U with
    * a form
    * submission. iTunes U will typically respond with
    * HTML that should be sent to the user's browser.
    public String getAuthorizationToken(String credentials, String identity,
    Date time, byte[] key) {
    // Create a buffer with which to generate the authorization token.
    StringBuffer buffer = new StringBuffer();
    // Generate the authorization token.
    try {
    // Start with the appropriately encoded credentials.
    buffer.append("credentials=");
    buffer.append(URLEncoder.encode(credentials, "UTF-8"));
    // Add the appropriately encoded identity information.
    buffer.append("&identity=");
    buffer.append(URLEncoder.encode(identity, "UTF-8"));
    // Add the appropriately formatted time stamp. Note that
    // the time stamp is expressed in seconds, not milliseconds.
    buffer.append("&time=");
    buffer.append(time.getTime() / 1000);
    // Generate and add the token signature.
    String data = buffer.toString();
    buffer.append("&signature=");
    buffer.append(this.hmacSHA256(data, key));
    } catch (UnsupportedEncodingException e) {
    // UTF-8 encoding support is required.
    throw new java.lang.AssertionError(
    "ITunesU.getAuthorizationToken(): "
    + "UTF-8 encoding not supported!");
    // Return the signed authorization token.
    return buffer.toString();
    * Send a request for an action to iTunes U with an authorization token.
    * @param url URL defining how to communicate with iTunes U and
    * identifying which iTunes U action to invoke and which iTunes
    * U page or item to apply the action to. Such URLs have a
    * format like <CODE>[PREFIX]/[ACTION]/[DESTINATION]</CODE>,
    * where <CODE>[PREFIX]</CODE> is a value like
    * "https://deimos.apple.com/WebObjects/Core.woa" which defines
    * how to communicate with iTunes U, <CODE>[ACTION]</CODE>
    * is a value like "Browse" which identifies which iTunes U
    * action to invoke, and <CODE>[DESTINATION]</CODE> is a value
    * like "example.edu" which identifies which iTunes U page
    * or item to apply the action to. The destination string
    * "example.edu" refers to the root page of the iTunes U site
    * identified by the domain "example.edu". Destination strings
    * for other items within that site contain the site domain
    * followed by numbers separated by periods. For example:
    * "example.edu.123.456.0789". You can find these
    * strings in the items' URLs, which you can obtain from
    * iTunes. See the iTunes U documentation for details.
    * @param token Authorization token generated by getAuthorizationToken().
    * @return The iTunes U response, which may be HTML or
    * text depending on the type of action invoked.
    public String invokeAction(String url, String token) {
    // Send a request to iTunes U and record the response.
    StringBuffer response = null;
    try {
    // Verify that the communication will be over SSL.
    if (!url.startsWith("https")) {
    throw new MalformedURLException(
    "ITunesU.invokeAction(): URL \""
    + url + "\" does not use HTTPS.");
    // Create a connection to the requested iTunes U URL.
    HttpURLConnection connection =
    (HttpURLConnection)new URL(url).openConnection();
    connection.setUseCaches(false);
    connection.setDoOutput(true);
    connection.setRequestMethod("POST");
    connection.setRequestProperty(
    "Content-Type",
    "application/x-www-form-urlencoded; charset=UTF-8");
    // Send the authorization token to iTunes U.
    connection.connect();
    OutputStream output = connection.getOutputStream();
    output.write(token.getBytes("UTF-8"));
    output.flush();
    output.close();
    // Read iTunes U's response.
    response = new StringBuffer();
    InputStream input = connection.getInputStream();
    Reader reader = new InputStreamReader(input, "UTF-8");
    reader = new BufferedReader(reader);
    char[] buffer = new char[16 * 1024];
    for (int n = 0; n >= 0;) {
    n = reader.read(buffer, 0, buffer.length);
    if (n > 0) response.append(buffer, 0, n);
    // Clean up.
    input.close();
    connection.disconnect();
    } catch (UnsupportedEncodingException e) {
    // ITunes U requires UTF-8 and ASCII encoding support.
    throw new java.lang.AssertionError(
    "ITunesU.invokeAction(): UTF-8 encoding not supported!");
    } catch (IOException e) {
    // Report communication problems.
    throw new java.lang.AssertionError(
    "ITunesU.invokeAction(): I/O Exception " + e);
    // Return the response received from iTunes U.
    return response.toString();
    * iTunes U credential and identity transmission sample. When your
    * itunes U site is initially created, Apple will send your institution's
    * technical contact a welcome email with a link to an iTunes U page
    * containing the following information, which you will need to customize
    * this method's code for your site:
    <DD><DL><DT>
    * Information:<DD><CODE>
    * Site URL</CODE> - The URL to your site in iTunes U. The last
    * component of that URL, after the last slash,
    * is a domain name that uniquely identifies your
    * site within iTunes U.<DD><CODE>
    * shared secret</CODE> - A secret key known only to you and Apple that
    * allows you to control who has access to your
    * site and what access they have to it.<DD><CODE>
    * debug suffix</CODE> - A suffix you can append to your site URL
    * to obtain debugging information about the
    * transmission of credentials and identity
    * information from your institution's
    * authentication and authorization services
    * to iTunes U.<DD><CODE>
    * administrator credential</CODE> - The credential string to assign
    * to users who should have the
    * permission to administer your
    * iTunes U site.</DL></DD>
    <DD>
    * Once you have substitute the information above in this method's code
    * as indicated in the code's comments, this method will connect
    * to iTunes U and obtain from it the HTML that needs to be returned to a
    * user's web browser to have a particular page or item in your iTunes U
    * site displayed to that user in iTunes. You can modify this method to
    * instead output the URL that would need to be opened to have that page
    * or item displayed in iTunes.</DD>
    public static void main(String argv[]) {
    // Define your site's information. Replace these
    // values with ones appropriate for your site.
    String siteURL =
    "https://deimos.apple.com/WebObjects/Core.woa/Browse/xxx.edu" ;
    String debugSuffix = "/abc123";
    String sharedSecret = "some key";
    String administratorCredential =
    "Administrator@urn:mace:itunesu.com:sites:xxx.edu";
    // Define the user information. Replace the credentials with the
    // credentials you want to grant to the current user, and the
    // optional identity information with the identity of that user.
    // For initial testing and site setup, use the singe administrator
    // credential defined when your iTunes U site was created. Once
    // you have access to your iTunes U site, you will be able to define
    // additional credentials and the iTunes U access they provide.
    String[] credentialsArray = { administratorCredential };
    String displayName = "my name";
    String emailAddress = "my [email protected]";
    String username = "mylogin";
    String userIdentifier = "1243";
    // Define the iTunes U page to browse. Use the domain name that
    // uniquely identifies your site in iTunes U to browse to that site's
    // root page; use a destination string extracted from an iTunes U URL
    // to browse to another iTunes U page; or use a destination string
    // supplied as the "destination" parameter if this program is being
    // invoked as a part of the login web service for your iTunes U site.
    String siteDomain = siteURL.substring(siteURL.lastIndexOf('/') + 1);
    String destination = siteDomain;
    // Append your site's debug suffix to the destination if you want
    // to receive an HTML page providing information about the
    // transmission of credentials and identity between this program
    // and iTunes U. Uncomment the following line for testing only.
    //destination = destination + debugSuffix;
    // Use an ITunesU instance to format the credentials and identity
    // strings and to generate an authorization token for them.
    ITunesU iTunesU = new ITunesU();
    String identity = iTunesU.getIdentityString(displayName, emailAddress,
    username, userIdentifier);
    String credentials = iTunesU.getCredentialsString(credentialsArray);
    Date now = new Date();
    byte[] key = null;
    try {
    key = sharedSecret.getBytes("US-ASCII");
    } catch (UnsupportedEncodingException e) {
    throw new java.lang.AssertionError(
    "ITunesU.hmacSH256(): US-ASCII encoding not supported!");
    String token = iTunesU.getAuthorizationToken(credentials, identity,
    now, key);
    // Use the authorization token to connect to iTunes U and obtain
    // from it the HTML that needs to be returned to a user's web
    // browser to have a particular page or item in your iTunes U
    // site displayed to that user in iTunes. Replace "/Browse/" in
    // the code below with "/API/GetBrowseURL/" if you instead want
    // to return the URL that would need to be opened to have that
    // page or item displayed in iTunes.
    String prefix = siteURL.substring(0, siteURL.indexOf(".woa/") + 4);
    String url = prefix + "/Browse/" + destination;
    String results = iTunesU.invokeAction(url, token);
    System.out.println(results);
    The itunes file from Shell folder has been modified as follows
    DISPLAY_NAME= "myname"
    EMAIL_ADDRESS="[email protected]"
    USERNAME="mylogin"
    USER_IDENTIFIER="1243"
    all the other things in that file have been untouched.
    I also generated the debug which looks like this
    iTunes U Access Debugging
    Received
    Destination xxx.edu
    Identity "my name" <[email protected]> (mylogin) [1243]
    Credentials Administrator@urn:mace:itunesu.com:sites:xxx.edu
    Time 1196706873
    Signature 533870b8jshdidk333lfsf6a3143a55c132ec548a4d545bd79322402e8e2596e4
    Analysis
    The destination string is valid and the corresponding destination item was found.
    The identity string is valid and provides the following information:
    Display Name my name
    Email Address [email protected]
    Username mylogin
    User Identifier 1243
    The credential string is valid and contains the following recognized credential:
    1. Administrator@urn:mace:itunesu.com:sites:xxx.edu
    The time string is valid and corresponds to 2007-12-03 18:34:33Z.
    The signature string is valid.
    Access
    Because the received signature and time were valid, the received identity and credentials were accepted by iTunes U.
    In addition, the following 2 credentials were automatically added by iTunes U:
    1. All@urn:mace:itunesu.com:sites:xxx.edu
    2. Authenticated@urn:mace:itunesu.com:sites:xxx.edu
    With these credentials, you have browsing, downloading, uploading, and editing access to the requested destination.
    I am pretty new to this, and working on this for the first time.If someone could guide me through this would be pretty helpful.

    This is only going to work under IE !
    Go to your page template :
    Modify the definition, make sur you have this :
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>#TITLE#</title>
    #HEAD#
    <Script language = javascript>
    Browser = navigator.appName
    Net = Browser.indexOf("Netscape")
    Micro = Browser.indexOf("Microsoft")
    Netscape = false
    IE = false
    if(Net >= 0) {Netscape = true}
    if(Micro >= 0) {IE = true}
    function XYpos() {
    if (IE == true) {
    xPos = event.screenX
    yPos = event.screenY
    alert(xPos + " left " + yPos + " down")
    else if (Netscape == true) {alert("Script won't work: " + "\n" + "You're using Netscape")}
    </script>
    Modify the body definition, make sure you have this :
    <body #ONLOAD# onMouseDown = XYpos()>
    I didnt try it but it make sens to me... tell me if it works!
    Flex
    Homepage : http://www.insum.ca
    InSum Solutions' blog : http://insum-apex.blogspot.com

Maybe you are looking for