URLs  cache and applet context showDocument question

Hello:
I wrote an applet and realized that when I try to read from a URL using this code:
URL Url=new URL(ReadAddress);
BufferedReader Input = new BufferedReader(new InputStreamReader(Url.openStream()));I was getting cached information from the web browser. So the problem was solved using this:
URL Url=new URL(ReadAddress);
URLConn=Url.openConnection();
URLConn.setUseCaches(false);
URLConn.setDoInput(true);
BufferedReader Input = new BufferedReader(new InputStreamReader(URLConn.getInputStream()));However, I wonder what about this?
URL Url=new URL(ReadAddress);
getAppletContext().showDocument(Url);Since in this case I can't tell to the applet context to use a specific URLConnection, I don't know if showDocument(Url) will show always the most updated document or could show also a cached one... I could try before calling showDocument:
Url.openConnection().setUseCaches(false);However, I know this would create a new connection, and I don't know if that's the one that showDocument() will use or if it will internally use anotherone...
Any idea?

I don't know if I can help you with this.
I am able to run the following applet successfully in my Netscape 7.1 browser on Windows 2000 professional. I am including it for you to try. Although I have a feeling it is probably similar enough to what you have already tried, my interest in this topic has to do with the fact that I am having the same error as you when I run an applet in Camino v0.7 on Mac OS X 10.2 and also an older version of Mozilla 1.0.2 also on the Mac. Like you, I don't see any error messages. The browser simply does not redirect to the new page. The thought here is that if you are not able to redirect a user using an applet that will redirect a user on my own Netscape/Windows environment, maybe then the problem will turn out to be one of configuration (? or not) and hopefully I can solve it somehow on Camino. In any case, I'll be watching this thread hoping for a solution for you.
public class RedirectApplet extends java.applet.Applet
     public void init()
     public void start()
          redirect();
     }// end start
     private void redirect()
          try{
          java.net.URL url
          = new java.net.URL(getCodeBase() + "/WebPage.html");
          this.getAppletContext().showDocument(url, "_self");
          catch(Exception e)
               System.out.println("Error with redirection - " + e.getMessage());
     }// end method
}// end applet class

Similar Messages

  • URL.GetRef() and Applets

    Hello all,
    I've done some extensive searches on the web to try and come up with a solution for this and come up blank.
    I have an applet (that renders a diagram) which contains links, some of these links point to other diagrams (in applets embedded in other HTML files) and some point to links within the same diagram.
    I want to use HTML fragments (what Java calls References) to identify targets within a page.
    This works great the first time the applet loads - it can call GetDocumentBase().GetRef() to get at the initial target.
    The problem is how to know that the reference changed if I link to another target in the same file.
    This is because the browser knows not to reload the Java applet if the page being loaded is the same as the existing one - and so seemingly doesn't fire any events I can listen to. (If there are any please let me know!)
    Furthermore, if I test the GetDocumentBase().GetRef() after following a link to itself - the URL shows the updated HTML fragment - but Java doesn't know about it.
    Any suggestions are most welcome.

    I guess I should mention that an option that did occur to me is that if the applet executes a link which resolves to itself - it doesn't actually have to let the browser do it - moreover just goto the target internally.
    This works well for internal links - but doesn't work well if you have an external control (like a tree) directly trying to execute target links in the same diagram.

  • GetAudioClip() and applet size-related questions

    Hello everyone,
    I have coded a small animation and wanted to use audio file (.au) to add sound to my applet. But for some reasons it does not want to read my .au file. I tried different .au files, but with no result.
    I am using eclipse and while it (eclipse) compiles it creates 2 directory: src and bin and saves file.java and file.class in them respectively. I placed my .au file(s) in both of them......nothing happened. Though I added a .jpg file to these directories for the background to test how it works and it works fine with it. And not forget to mention that these .au files play fine without using java.
    Well, here is a bit of that code:
    public void init()
                   setBackground (Color.red);     
                   au = getAudioClip( getCodeBase(), "ecky.au"); //this does not play, though it plays in media player
                   im = getImage (getCodeBase(), "stars.jpg"); //this works, though both are in the same folder
    public void run ()
                   Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
                   while(y_pos != 200)
                        au.play(); //it should play here
                        y_pos ++;
                        repaint();
                        try
                             Thread.sleep (10);
                        catch (InterruptedException ex)
                             Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
    public void paint (Graphics g)
                   g.drawImage (im, 0, 0, this);
    }And one more thing, do you know where can I change the applet size? I mean as you know, eclipse take care of setting applet size. So where can I find this html code and resize the applet? Thank you in advance and appreciating your help....

    I wanted this .au file to play as long as the y_pos does not reach the point 200So, play() it before the while loop, and stop it afterwards (or whenever y reaches 200).
    To begin with you should just write some code to make the sound play - and if there is a problem with the size of the file, resolve that first.
    By the way, can anyone tell me where eclipse saves the html code for the applet? I don't think there is any html code. Eclipse uses an applet viewer. Try putting the html <aplet> information as a comment near the start of your file.

  • I have a question about Lightroom 5... I used it last night, I go to get on it today and its will not open. I have an error msg "Lightroom encountered an error when reading from its preview cache and needs to quit" Lightroom will attempt to fix the proble

    I have a question about Lightroom 5... I used it last night, I go to get on it today and its will not open. I have an error msg "Lightroom encountered an error when reading from its preview cache and needs to quit" Lightroom will attempt to fix the problem when reopened

    https://forums.adobe.com/message/6219922#6219922
    See if the issue in the thread above helps you to solve your problem.

  • I am getting a 404 error when trying to access any search link using google, I can get to a website if I enter the url directly.  I have cleared my history, emptied the cache and reset safari.

    I keep getting a 404 error when trying to access any search link using google, I can get to a website by directly using the URL.  I have cleared history, empited the cache and reset safari.  Any suggestions.

    Right. If you are using delegated privs and sudo, make sure that sudo is configured to pass on the PERL5LIB and ORACLE_HOME environment variables at least.

  • URL cache problem in UCM and sitestudio

    Hi ,
    We have created Metadata Field : xPageName, and have configure an entry in config.cfg as SSUrlFieldName=PageName, Scenario is we have assigned abc.html to xPageName for a content item on suppose /oracle/cms1/ URL, by mistake we assigned abc.html to xPageName to another content item on suppose /oracle/cms2/ URL. Problem is abc.html is registered with two content item and on two URL's, and now we have changed it for /oracle/cms2/ URL to xyz.html, but when we hit /oracle/cms2/abc.html it is also served with blank page. Please suggest how we can get away with this ASAP.
    Thanks,

    That is definitely a limitation that each custom page name must be unique.
    If think what you are saying is that you have resolved this issue but the URL is still taking you to the wrong page...
    THis stuff is cached IIRC in some js files in the weblayout
    Have you tried, clearing browser cache, recreating the navigation in SS Designer, or restarting UCM and webserver?

  • I cannot reply to Apple Support Communities questions? I have already cleared caches and cookies and still no luck?

    I cannot reply to Apple Support Communities questions? I have already cleared caches and cookies and still no luck?

    Click on one of those files, then go to Get Info in Finder: select what application should open such files.

  • Questions on cache and general RSRT settings for plancube

    Hi,
    we would like to:
    1) set request status 1 in RSRT for our planqueries, in order to automatically refresh the query after executing a planfunction (problem we have now is that the results of a planfunction are not automatically updated in the query. Only when doing something else like executing other function, saving, check locks, ... the results are visible).
    2) activate delta cache for our planqueries
    we have read OSS note 1136163 on RSRT settings. It says:
    Aggregation level "A" is implemented internally by the automatically created query "P/!!1P" (plan buffer query). This query acts like an InfoProvider. It reads the data of the database or provides the data from InfoProvider "P", it adds the data of the delta buffer "Dp" (or the delta buffer Dpi if P is a MultiProvider with several PartProviders Pi that can be planned) and transfers the data manager as data of the InfoProvider "A" of type "ALVL". The query "P/!!1P" can use aggregates and the cache; this is exactly like each normal query in "P". If "P" is a MultiProvider, it is useful to set PARTITIONMODE to "1".
                  For the query "P/!!1P" that is created automatically for an aggregation level or for all aggregation levels using the InfoProvider P, we recommend the following setting:
                  Read mode "H", request status "1", cache mode "1" or higher, delta cache "true" and SP grouping "1".
                  Furthermore, the selection to use the structure element (KIDSEL) should be "true".
                  The input-ready queries in "A" should not, and cannot, use a cache. The request status is irrelevant since queries in "A" are automatically set to current data. The delta buffer does not currently support hierarchy processing. Therefore, aggregation level "A" cannot completely support read mode "H". For input-ready queries at A:
                  Read mode "X", request status "0", cache mode "0".
                 The delta cache and SP grouping are not visible
    Problems we have:
    1) for query P/!!1P (PCA_AGQF/!!1PCA_AGQF in our example) does not allow changing the request status (greyed out). It now has value 0 instead of 1. It also does not allow to activate the delta cache flag. How to change this? In RSDIPROP we have set partitionmode to 1 for the multiprovider and activated the delta cache flag...
    2) can we use the cache / delta cache principle for our planqueries? If so, how to ensure these settings remain activated in RSRT?
    regards
    Dries
    regards
    dries

    Hi,
    To change the cache settings for your cube.
    Open the cube in RSA1 and click in 'Chance'.
    - click in the 'Environment' menu;
    - expand 'InfoProvider Properties'
      - select the option 'Change'.
    You will be able to set the cache mode for this provider.
    I don't think it will be possible use cache for a multiprovider, it is
    not possible.
    Regards,
    Amit

  • HTTP Headers - enabling caching and compression with the portal?

    Has anyone configured their web server (IIS or Apache) or use a commercial product to flawlessly cache and compress all content generated by the portal?
    Compression and caching is critical for making our portal based applictions work for overseas users. It should be doable, just taking advantage of standard HTTP protocols, but implementing this a complex system like the portal is tricky, we seem to be generating different values in the HTTP Headers for the same types of files (such as CSS).
    We are running Apache so can't take advantage of the built in compression capabilities of the .net portal. We are running the java vervion. 6.1 mp1, sql server 2000 (portal, search, collab, publisher, studio, analytics, custom .net and java portlets on remote server).
    Basically our strategy is to compress all outgoing static and dynamic text content (html, CSS, javascript), and to cache all static files (CSS, javascript, images) for 6 months to a year depending on file type.
    Here are some links on the subjects of caching and compression that I have compiled:
    Caching & Compression info and tools
    http://www.webreference.com/internet/software/servers/http/compression/
    http://www.ibm.com/developerworks/web/library/wa-httpcomp/
    http://www.mnot.net/cache_docs/
    http://www.codeproject.com/aspnet/HttpCompressionQnD.asp?df=100&forumid=322472&exp=0&select=1722189#xx1722189xx
    http://en.wikipedia.org/wiki/Http_compression
    http://perl.apache.org/docs/tutorials/client/compression/compression.html
    https://secure.xcache.com/Page.aspx?c=60&p=590
    http://www.codinghorror.com/blog/archives/000807.html
    http://www.howtoforge.com/apache2_mod_deflate
    http://www.ircache.net/cgi-bin/cacheability.py
    http://betterexplained.com/articles/how-to-optimize-your-site-with-http-caching/
    http://betterexplained.com/articles/speed-up-your-javascript-load-time/
    http://betterexplained.com/articles/speed-up-your-javascript-load-time/
    http://www.rubyrobot.org/article/5-tips-for-faster-loading-web-sites
    http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/
    http://www.gidnetwork.com/tools/gzip-test.php
    http://www.pipeboost.com/
    http://www.schroepl.net/cgi-bin/http_trace.pl
    http://leknor.com/code/gziped.php?url=http%3A%2F%2Fwww.google.com
    http://www.port80software.com/surveys/top1000compression/
    http://www.rexswain.com/httpview.html
    http://www.15seconds.com/issue/020314.htm
    http://www.devwebpro.com/devwebpro-39-20041117DevelopingYourSiteforPerformanceCompressionandOtherServerSideEnhancements.html
    http://www.webpronews.com/topnews/2004/11/17/developing-your-site-for-performance-optimal-cache-control
    http://www.sitepoint.com/print/effective-website-acceleration
    http://nazish.blog.com/1007523/
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/IETechCol/dnwebgen/IE_Fiddler2.asp?frame=true
    http://www.fiddlertool.com/fiddler/version.asp
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
    http://www.web-caching.com/cacheability.html
    http://www.edginet.org/techie/website/http.html
    http://www.cmlenz.net/blog/2005/05/on_http_lastmod.html
    http://www.websiteoptimization.com/speed/tweak/cache/
    http://www.webperformance.org/caching//caching_for_performance.html
    http://betterexplained.com/articles/how-to-debug-web-applications-with-firefox/
    Edited by tkoenings at 06/18/2007 6:26 AM

    Hi Scott,
    Does Weblogic platform 8.1 supports netscape? We have developed a portal which
    works perfectly on IE but it dies in netscape. Is netUI tags not supported in
    Netscape?
    Pls reply
    manju
    Scott Dunbar <[email protected]> wrote:
    From a pure HTML perspective Portal does it's rendering with nested
    tables.
    Netscape 4.x and below have terrible performance with nested tables.
    The
    problem is not the Portal server but rather Netscape on the client machine.
    If IE and/or a recent version of Netscape/Mozilla is not possible then
    there are
    really only two options:
    1) Faster client hardware - not likely to be an acceptable solution.
    2) Minimize the number of portlets and the complexity within the portlets.
    Neither of these solutions are a great answer, but the 4.7 series of
    Netscape is
    getting pretty old. Having said that, we've got customers who want to
    continue
    to use IE 4 :)
    Again, though, this problem is, I'm afraid out of our hands. It is the
    client
    rendering time that is the issue.
    cg wrote:
    Does anyone know of any known reasons why the 7.0 (did it also with4.0) portal
    pages can take up to almost 30 seconds to load in Netscape 4.7? I knowit is a
    very generic question but our customer still uses 4.7 and will notuse the portal
    b/c it takes so long to load some of the webapps. What the pages willdo when
    loading is that the headers will come up and when it gets to the bodyof the page
    it seems to stall and then comes up all of a sudden. For some of thepages it
    takes 6 seconds and for others it takes about 24-27 seconds.
    We have suggested using IE only but that is not an option with allof the customers
    and getting a newer version of Netscape is also out of the question.
    Any suggestions would be greatly appreciated.--
    scott dunbar
    bea systems, inc.
    boulder, co, usa

  • Since applying Feb 2013 Sharepoint 2010 CUs - Critical event log entries for Blob cache and missing images

    Hi,
    Since applying the February 2013 SharePoint 2010 updates, we are getting lots of entries in our event logs along the following:
    Content Management     Publishing Cache         
    5538     Critical 
    An error occurred in the blob cache.  The exception message was 'The system cannot find the file specified. (Exception from HRESULT: 0x80070002)’
    In pretty much all of these cases the image/ file in question that is reported in the ULS logs as missing is not actually in the collaboration site, master page / html etc so the fix needs to go back to the site owner to make the correction to avoid
    the 404 (if they make it!). This has only started happening, I believe since feb 2013 sp2010 cumulative updates updates
    I didn’t see this mentioned as a change / in the Fix list of the February updates. i.e. it flags up a critical error in our event logs. So with a lot of sites and a lot of missing images your event log can quickly fill up.
    Obviously you can suppress them in the monitoring -> web content management ->publishing cache = none & none which is not ideal.
    So my question is... are others seeing this and was a change made by Microsoft to flag a 404 missing image / file up a critical error in event log when blob cache is enabled?
    If i log this with MS they will just say, you need to fix it up the missing files in the site but would be nice to know this had changed prior! I also deleted and recreated the blob cache and this made no diffference
    thanks
    Brad

    I'm facing the same error on our SharePoint 2013 farm. We are on Aug 2013 CU and if the Dec CU (which is supposed to be the latest) doesn't solve it then what else could be done.
    Some users started getting the message "Server is busy now try again later" with a corelation id. I looked up ULS with that corelation id and found these two errors in addition to hundreds of "Micro Trace Tags (none)" and "forced
    due to logging gap":
    "GetFileFromUrl: FileNotFoundException when attempting get file Url /favicon.ico The system cannot find the file specified. (Exception from HRESULT: 0x80070002)"
    "Error in blob cache. System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)"
    "Unable to cache URL /FAVICON.ICO.  File was not found" 
    Looks like this is a bug and MS hasn't fixed it in Dec CU..
    &quot;The opinions expressed here represent my own and not those of anybody else&quot;

  • Browsers and Applets

    This is really a two part question that I just can't seem to find an answer too.
    The first part should be simple, what is the correct, browser wide way to put an applet on the page? My deitel book says applet and it does work on IE/Firefox but w3schools says it's depricated in HTML 4.01. Since embed isn't a real tag, I went and looked up object. Not only could I not make it work but it seemed like it wanted the version to be hard coded, never gonna work like that. So, how are you guys doing it?
    Second question, how do you stop your browser from caching the applet? I turned off 'enable chaching' in the plug-in, set IE to refresh every visted to the page (theres a joke, buggy ass... [rant]), used the meta no cache tags and set expire to -1. For all this it would only work if I cleared temp internet files, same for Firefox. Is it even possible to turn this off?
    Thanks for your help.
    Btw, this is my first post here, so, "Hello".

    Yeah, just try to stay healthly up on the standards; my sites still about 20 years away from the strict.dtd, which I wouldn't use on an intra net I installed the browsers on.
    Applet will probably go away about the same time center does, though M$ does seem to have a lot (not all, embed still isn't there) pull in the w3c and probably wouldn't care if we had to markup our applets in leet with the correct timestamp...
    <?php echo printf("<4ppl3+ c0d3='toolbar.class' curr3n++1m3='%s'>4ppl3+</>", mktime("r", date())); ?>

  • JAR Files and Applets with Java Plug-In

    This seems to be a basic question, but I can't figure it out! I have a jar file that contains all my class files for my applet. The jar file is in the same directory as the following html file:
    <html>
    <body>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 700 HEIGHT = 510 codebase="http://java.sun.com/products/plugin/1.3.1/jinstall-131-win32.cab#Version=1,3,1,0">
    <PARAM NAME = ARCHIVE VALUE = "myFiles.jar" >
    <PARAM NAME = CODE VALUE = "MainView.class" >
    <PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.3.1">
    <PARAM NAME="scriptable" VALUE="false">
    </OBJECT>
    </body>
    </html>
    I've checked the jar file, it's the same name. MainView.class is most certainly in the jar file - yet everytime I open the page up, I get the class not found error:
    java.lang.ClassNotFoundException: java.io.FileNotFoundException
    MainView.class (The system cannot find the file specified)
    If I don't jar the files, the applet works fine - but I want to jar them as it's some 20 class files. What am I doing wrong?

    I've had a similar problem where it pops up the Java Extension Installation window, and starts downloading. Everything appears normal, but when it tries to run the applet it gets "load: class <className> not found" where <className> is the name of the class in my CODE parameter.
    It appears that on occasion the download of the jar gets cut off. When I searched the browser's cache, I find a jar file that has fewer bytes than it should. In order to initiate a retry, you have to delete the jar file from your browser's cache, close all your browser windows so that the Plug-in with its truncated jar file stops running, and load the HTML page again. It appears that it checks the timestamp of the jar file in your cache and the one on the server and decides that it doesn't need to download it again. But if you delete it from your cache, it forces a retry.
    I never have this problem when I open from my hard drive. I've never had the problem with a cable modem connection. I've had it once from a corporate LAN hitting an internet server (ie., outside corporate WAN). I've had people report the problem with dial-up connections. My theory is that whatever Sun is using to download the applet is more sensitive than either HTTP download or FTP.
    Has anybody else experienced this problem? Is there anything you can do about it? I couldn't find a bug report on it. Is there one?

  • Statement caching and batch update

    Can these 2 JDBC features work together ?
    Is it possible while statement is cached to be reparsed (soft) if used in batch update ?
    I am asking this questions because i have a sitution where an insert is cached using implicit statement caching and then put in a batch to exeute batch updates !!! From statspack reports i find that 1/3 of statements are reparsed ... even soft !!!

    Statement caching and batch update work fine together. The most common cause of unexpected soft parses is changing the type of some parameters. If you first bind one type, setInt(1, ...), do addBatch, then bind another type to the same parameter, setString(1, ...), and do addBatch, you will get a soft reparse. There is nothing the JDBC driver can do about this, the RDBMS requires it.
    In general, whatever parse behavior you see with statement caching you would also see without it.
    Douglas

  • L2 Cache and Memory

    I'm about to buy a MacBook, mainly for Grad School purposes, but I also do a lot with music and movies. My questions are:
    What is the difference between a 3MB and a 4MB L2 cache? Will I notice the difference?
    Will there be a noticible difference between a 1GB and 2GB memory?
    I'm looking at the refurbished MacBooks. There is one with a 1GB memory and 4MB L2 cache for $1049 (originally $1499), and one with a 2GB memory and a 3MB L2 cache for $1099 (originally $1299). Thanks!

    What is the difference between a 3MB and a 4MB L2 cache? Will I notice the difference?
    1 MB. You might notice a difference depending upon what the computer is doing, but more than likely you won't. Bare Feats has some benchmarks you can check out. If you expect to do a lot of graphics and/or audio processing then more L2 cache will help.
    Will there be a noticible difference between a 1GB and 2GB memory?
    Yes. Not so much in speed as more memory doesn't actually make the computer run faster, but with more RAM you will not notice occasional slowdowns when running a lot of apps concurrently. I would suggest adding as much RAM as possible. This is a good investment in the long run.

  • How to display URL images and URL link (html) from Smartforms?

    Hi Gurus,
    I'm having difficulty on how to display targeted URL images and URL link from the smartforms, after i sending it out as html mail. The mail i sent just can be preview as a plain text, which can't execute the html code that i put inside the smartforms itself. I follow a few step from this very useful blog.. Hopefully, you guys can give me some solutions or ideas on this.
    /people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp -thanks to Pavan for his useful blog.
    My code is like this..
    <--- Start Code.
    FORM call_smartforms.
      DATA : lv_subject TYPE so_obj_des,
             lc_true(1) VALUE 'X',
             lw_control_parameters TYPE ssfctrlop,
             lw_output_options TYPE ssfcompop,
             lc_graphics(8) VALUE 'GRAPHICS',
             lw_xsfparam_line TYPE ssfxsfp,
             lc_extract(7) VALUE 'EXTRACT',
             lc_graphics_directory(18) VALUE 'GRAPHICS-DIRECTORY',
             lc_mygraphics(11) VALUE 'mygraphics/',
             lc_content_id(10) VALUE 'CONTENT-ID',
             lc_enable(6) VALUE 'ENABLE',
             lw_job_output_info TYPE ssfcrescl,
             lw_html_data TYPE trfresult,
             lw_graphics TYPE ssf_xsf_gr,
             lt_graphics TYPE tsf_xsf_gr,
             lv_html_xstr TYPE xstring,
             lw_html_raw LIKE LINE OF lw_html_data-content,
             lv_incode TYPE tcp00-cpcodepage VALUE '4110',
             lv_html_str TYPE string,
             lv_html_len TYPE i,
             lc_utf8(5) VALUE 'utf-8',
             lc_latin1(6) VALUE 'latin1',
             lv_offset TYPE i,
             lv_length TYPE i,
             lv_diff TYPE i,
             lt_soli TYPE soli_tab,
             lw_soli TYPE soli,
             lc_mime_helper TYPE REF TO cl_gbt_multirelated_service,
             lv_name TYPE mime_text VALUE 'sapwebform.htm',
             lv_xstr TYPE xstring,
             lw_raw TYPE bapiconten,
             lt_solix TYPE solix_tab,
             lw_solix TYPE solix,
             lv_filename TYPE string,
             lv_content_id TYPE string,
             lv_content_type TYPE w3conttype,
             lv_obj_len TYPE so_obj_len,
             lv_bmp TYPE so_fileext VALUE 'BMP',
             lv_description TYPE so_obj_des VALUE 'Graphic in BMP format',
             lc_doc_bcs TYPE REF TO cl_document_bcs,
             lc_bcs TYPE REF TO cl_bcs,
             lc_send_exception TYPE REF TO cx_root,
             lw_adsmtp TYPE lty_adsmtp,
             lv_mail_address TYPE ad_smtpadr,
             lc_recipient TYPE REF TO if_recipient_bcs,
             lc_send_request TYPE REF TO cl_bcs,
             lv_sent_to_all TYPE os_boolean.
      DATA : v_language TYPE sflangu VALUE 'E',
             v_e_devtype TYPE rspoptype.
      v_form_name = 'ZTEST_EMAIL'.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = v_form_name
        IMPORTING
          fm_name            = v_namef
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc = 0.
       break mhusin.
      ENDIF.
    starting here. ***
    Set title for the output
      lv_subject = 'Smartforms.'.
    Set control parameters to "no dialog"
      lw_control_parameters-no_dialog = lc_true.
    IF lw_service_subject-code = lc_fm1.
    *--- To get output device type
      CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          i_language    = v_language
          i_application = 'SAPDEFAULT'
        IMPORTING
          e_devtype     = v_e_devtype.
      lw_output_options-tdprinter = v_e_devtype.
      lw_control_parameters-getotf = 'X'.
      IF sy-subrc = 0.
       break mhusin.
      ENDIF.
    Set output options
      lw_output_options-xsf        = lc_true.
      lw_output_options-xsfcmode   = lc_true.
      lw_output_options-xsfoutmode = 'A'.
      lw_output_options-xsfoutdev  = space.
      lw_output_options-xsfformat  = lc_true.
      lw_xsfparam_line-name  = lc_graphics.
      lw_xsfparam_line-value = lc_extract.
      APPEND lw_xsfparam_line TO lw_output_options-xsfpars.
      lw_xsfparam_line-name  = lc_graphics_directory.
      lw_xsfparam_line-value = lc_mygraphics.
      APPEND lw_xsfparam_line TO lw_output_options-xsfpars.
      lw_xsfparam_line-name  = lc_content_id.
      lw_xsfparam_line-value = lc_enable.
      APPEND lw_xsfparam_line TO lw_output_options-xsfpars.
    Get the smartform content
      CALL FUNCTION v_namef
        EXPORTING
          control_parameters   = lw_control_parameters
          output_options       = lw_output_options
    *pass other application specific parameters (eg order number, items ).
      IMPORTING
          job_output_info    = lw_job_output_info
      TABLES
          tt_tabh              = tt_tabh
          tt_tabb              = tt_tabb
          tt_tabf              = tt_tabf
      EXCEPTIONS
          formatting_error = 1
          internal_error   = 2
          send_error       = 3
          user_canceled    = 4
          OTHERS           = 5.
      IF sy-subrc = 0.
       break mhusin.
      ENDIF.
      lw_html_data  = lw_job_output_info-xmloutput-trfresult.
      lt_graphics[] = lw_job_output_info-xmloutput-xsfgr[].
      CLEAR lv_html_xstr.
      LOOP AT lw_html_data-content INTO lw_html_raw.
        CONCATENATE lv_html_xstr lw_html_raw INTO lv_html_xstr IN BYTE MODE.
      ENDLOOP.
      lv_html_xstr = lv_html_xstr(lw_html_data-length).
      CALL FUNCTION 'SCP_TRANSLATE_CHARS'
        EXPORTING
          inbuff       = lv_html_xstr
          incode       = lv_incode
          csubst       = lc_true
          substc_space = lc_true
        IMPORTING
          outbuff      = lv_html_str
          outused      = lv_html_len
        EXCEPTIONS
          OTHERS       = 1.
    *HACK THE HTML CODE GENERATED BY SMARTFORM TO MAKE THE
    *EXTERNAL IMAGES APPEAR AS <IMG> TAG IN HTML
      REPLACE ALL OCCURRENCES OF '<IMG' IN lv_html_str WITH '<IMG' IGNORING CASE.
      REPLACE ALL OCCURRENCES OF '/>' IN lv_html_str WITH '/>' IGNORING CASE.
      REPLACE ALL OCCURRENCES OF '</A>' IN lv_html_str WITH '' IGNORING CASE.
      REPLACE ALL OCCURRENCES OF '<' IN lv_html_str WITH '<' IGNORING CASE.
      REPLACE ALL OCCURRENCES OF '>' IN lv_html_str WITH '>' IGNORING CASE.
    CALL METHOD html_control - >load_mime_object
       EXPORTING
         object_id  = 'ZWN'
         object_url = 'ZWN.GIF'
       EXCEPTIONS
         OTHERS     = 1.
      REPLACE ALL OCCURRENCES OF lc_utf8 IN lv_html_str WITH lc_latin1.
    REPLACE ALL OCCURRENCES OF lc_utf8 IN lv_html_str WITH 'iso-8859-1'.
       break mhusin.
      lv_html_len = STRLEN( lv_html_str ).
      lv_offset = 0.
      lv_length = 255.
      WHILE lv_offset < lv_html_len.
        lv_diff = lv_html_len - lv_offset.
        IF lv_diff > lv_length.
          lw_soli-line = lv_html_str+lv_offset(lv_length).
        ELSE.
          lw_soli-line = lv_html_str+lv_offset(lv_diff).
        ENDIF.
        APPEND lw_soli TO lt_soli.
        ADD lv_length TO lv_offset.
      ENDWHILE.
      CREATE OBJECT lc_mime_helper.
      CALL METHOD lc_mime_helper->set_main_html
        EXPORTING
          content     = lt_soli
          filename    = lv_name
          description = lv_subject.
      LOOP AT lt_graphics INTO lw_graphics.
        CLEAR lv_xstr.
        LOOP AT lw_graphics-content INTO lw_raw.
          CONCATENATE lv_xstr lw_raw-line INTO lv_xstr IN BYTE MODE.
        ENDLOOP.
        lv_xstr = lv_xstr(lw_graphics-length).
        lv_offset = 0.
        lv_length = 255.
        CLEAR lt_solix[].
        WHILE lv_offset < lw_graphics-length.
          lv_diff = lw_graphics-length - lv_offset.
          IF lv_diff > lv_length.
            lw_solix-line = lv_xstr+lv_offset(lv_length).
          ELSE.
            lw_solix-line = lv_xstr+lv_offset(lv_diff).
          ENDIF.
          APPEND lw_solix TO lt_solix.
          ADD lv_length TO lv_offset.
        ENDWHILE.
        CONCATENATE lc_mygraphics lw_graphics-graphics text-001 INTO lv_filename.
        CONCATENATE lc_mygraphics lw_graphics-graphics text-001 INTO lv_content_id.
        lv_content_type = lw_graphics-httptype.
        lv_obj_len      = lw_graphics-length.
    *Add images to the email
        CALL METHOD lc_mime_helper->add_binary_part
          EXPORTING
            content      = lt_solix
            filename     = lv_filename
            extension    = lv_bmp
            description  = lv_description
            content_type = lv_content_type
            length       = lv_obj_len
            content_id   = lv_content_id.
      ENDLOOP.
      TRY.
          lv_subject = lv_subject.
          lc_doc_bcs = cl_document_bcs=>create_from_multirelated(
                   i_subject          = lv_subject
                   i_multirel_service = lc_mime_helper ).
        CATCH cx_document_bcs INTO lc_send_exception.
        CATCH cx_bcom_mime INTO lc_send_exception.
        CATCH cx_gbt_mime INTO lc_send_exception.
      ENDTRY.
    Create send request
      TRY.
          lc_bcs = cl_bcs=>create_persistent( ).
        CATCH cx_send_req_bcs INTO lc_send_exception.
      ENDTRY.
      TRY.
          lc_bcs->set_document( i_document = lc_doc_bcs ).
        CATCH cx_send_req_bcs INTO lc_send_exception.
      ENDTRY.
    Set-up email receiver
      lv_mail_address = '[email protected]'.
    TRANSLATE lv_mail_address TO UPPER CASE.
      TRY.
          lc_recipient = cl_cam_address_bcs=>create_internet_address(
              i_address_string = lv_mail_address ).
        CATCH cx_address_bcs INTO lc_send_exception.
      ENDTRY.
      TRY.
          lc_bcs->add_recipient( i_recipient = lc_recipient ).
        CATCH cx_send_req_bcs INTO lc_send_exception.
      ENDTRY.
    Send smartforms as HTML email
      TRY.
          lc_bcs->send( ).
        CATCH cx_send_req_bcs INTO lc_send_exception.
      ENDTRY.
      COMMIT WORK.
      WRITE:/ 'Mail sent'.
    ENDFORM.                    "call_smartforms
    End Code --->
    Thanks and Regards.

    1- put your images in a directory under the web app directory. Example: app/images/
    2- in your jsp, use: String file = application.getRealPath("/images/"); to get the images directory. See http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
    3- it's not the right forum to post this kind of question. Post them in the JSP/Servlet JSTL forum instead

Maybe you are looking for

  • Transaction code for checking the capacity of  a job

    Hi,   Can anybody tell me if there is a transaction code for viewing the capacity of Job. Thanks and regards, Avinash.S

  • Satellite L500 will not load past the 'welcome' screen

    Hi, My Toshiba Satellite L500 laptop will not load past the 'welcome' screen. The cursor thing just keeps going around and around but won't go to my desktop. Last night it went into some temporary profile and it had a message saying 'your other profi

  • UCCX 8.0.2.11004-12

    In resources cisco unified contact center express state report the one agent are log-off but in the report shows the contact presented 1. Only one extension are facing this issue. We reset the phone but still same. Every day when we take the report a

  • Question about logic pro 7 & logic express

    I have been working in Logic Platinum 4.7 for several years & need to upgrade - I work mainly in MIDI for new Age music and add 1 or 2 live audio tracks - I don't use a lot of effects and never use loops - a salesman at Sweetwater suggested that I mi

  • Wont play videos from AMC

    My browsers won't play vis from AMCtv.com any thoughts?