Using applets in forms 9i

i am trying to use an "normal" applet (myapplet) designed for use in a html-page
in forms9i.
properties in applet can be set as "<param name="image1" value="1.jpg">...
i used jdevloper to create a wrapper-bean:
new->beans->Oracle Forms Pluggable Java Component
extends: oracle.jdeveloper.pjc.BeanWrapper
optional attributes: bean: myapplet.
then i tried to define the property ids like:
private final static ID image1 = ID.registerProperty("image1");
what next? any howto's??? the pjc-demo from otn does not exactly describe, how to make a wrapper bean...
kind regards

Close - but you don't need the .class extension.
1) Copy the Clock.class into your forms90/java directory (or you can have it in a JAR and point to in the various Archive Tags - but let's just copy the class for the moment)
Then the code you need in your When-New-Form-Instance is something like:
FBEAN.REGISTER_BEAN ('BLOCK1.CLOCKAREA',1,'Clock');
That should create the clock in the bean area (I've just tried the Java 1.4 Clock and it works)
The calls to FBean.SET_PROPERTY() are not going to be the way to set applet properties on the Clock. FBean.set_property is for setting the values of public variables on the bean (if it has any and this one does not).
Setting the Applet properties is done like the forms applet properties themselves. So you need to update the template HTML file - in this case basejini.htm and add in the properties that this Applet uses to the ones the Forms Applet uses -
e.g. I added <PARAM NAME="bgcolor" value="FF0000"> to my basejini to set the background of the clock to Red.
The only thing you won't be able to change in this way is the Width and height. The size of the Bean Area effectively becomes the Applet Area in that case.

Similar Messages

  • Using a java applet as form

    hi there,
    I'm new to programming applets (but not new to java and gui programming).
    Here's my question:
    I would like to use a java applet with a textfield as form input. is this possible?
    I see some several advantages over using standard html textfields and java script. (f.e.: I can set the cursor to any position after changing the text in the field).
    I'm thinking on a solution by my own. Would it be possible to use a java script method to access a property from the applet? so I could use a combination of java applet, html and java script. On the onClick() event I read the actual value from the applet and do some normal post request. Any better suggestions?
    thx
    soa

    I want to write the textfield in java. So I use the applet as form.
    What would be your suggestion?
    Write an applet with an textfield and and getValue() method? So I could create a normal html button and use javascript to write a method wich acces this getmethod. So I could register this method to the onClick() event.

  • Using graph in forms 10g

    Hello,
    I am using FormsGraph in forms 10g.
    Now I need additional options - more visualized graph and dynamic graph - like in Flash.
    Is there a way to achieve that using a java bean?
    Is it possible to use flash inside a form window?
    Thank you,
    Nina

    Java Plug-in 1.6.0_14
    Using JRE version 1.6.0_14-b08 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\nina_n
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    p: reload proxy configuration
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    Reading certificates from 141303 http://pc10-060.jer.ad.malam.com:8889/forms/java/frmall.jar | C:\Documents and Settings\nina_n\Application Data\Sun\Java\Deployment\cache\6.0\25\373de359-57e5f745.idx
    load: class oracle.forms.webutil.common.RegisterWebUtil not found.
    java.lang.ClassNotFoundException: oracle.forms.webutil.common.RegisterWebUtil
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    proxyHost=null
    proxyPort=0
    connectMode=HTTP, native.
    Reading certificates from 141303 http://pc10-060.jer.ad.malam.com:8889/forms/java/frmall.jar | C:\Documents and Settings\nina_n\Application Data\Sun\Java\Deployment\cache\6.0\25\373de359-57e5f745.idx
    גרסת Forms Applet היא : 10.1.2.3
    Reading certificates from 1990 http://pc10-060.jer.ad.malam.com:8889/forms/java/eHTMLBrowser.jar | C:\Documents and Settings\nina_n\Application Data\Sun\Java\Deployment\cache\6.0\9\603b1b09-2844393f.idx
    Reading certificates from 6718 http://pc10-060.jer.ad.malam.com:8889/forms/java/jdic.jar | C:\Documents and Settings\nina_n\Application Data\Sun\Java\Deployment\cache\6.0\51\2a47f033-52581ebc.idx
    org.jdesktop.jdic.init.JdicInitException: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
         at org.jdesktop.jdic.init.JdicManager.initShareNative(Unknown Source)
         at org.jdesktop.jdic.browser.WebBrowser.<clinit>(Unknown Source)
         at oracle.forms.fd.EnhancedHTMLBrowser.<init>(EnhancedHTMLBrowser.java:56)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at oracle.forms.handler.UICommon.instantiate(Unknown Source)
         at oracle.forms.handler.UICommon.onCreate(Unknown Source)
         at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)
         at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
         at oracle.forms.engine.Runform.processMessage(Unknown Source)
         at oracle.forms.engine.Runform.processSet(Unknown Source)
         at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
         at oracle.forms.engine.Runform.onMessage(Unknown Source)
         at oracle.forms.engine.Runform.sendInitialMessage(Unknown Source)
         at oracle.forms.engine.Runform.startRunform(Unknown Source)
         at oracle.forms.engine.Main.createRunform(Unknown Source)
         at oracle.forms.engine.Main.start(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
         at java.io.WinNTFileSystem.canonicalize0(Native Method)
         at java.io.Win32FileSystem.canonicalize(Unknown Source)
         at java.io.File.getCanonicalPath(Unknown Source)
         ... 23 more
    ------> ExtendedFrame title : Enhanced Web Browser
    Set Border=false
    Reading certificates from 141303 http://pc10-060.jer.ad.malam.com:8889/forms/java/frmall.jar | C:\Documents and Settings\nina_n\Application Data\Sun\Java\Deployment\cache\6.0\25\373de359-57e5f745.idx

  • Accessing a File within a zip, which was archived using Applet Tag

    Hi,
    Could Any one please tell me, How to Access a File from within an Applet. The File resides inside a zip which was Archived using <Applet> Tag.
    Actually, I want to write an application which runs both online and offline. So I have chosen Applet and All the files Which I need are zipped and is Archived through <Applet ARCHIVE="example.zip">.
    Now I want to access those XML files which are inside example.zip from my Applet.
    How can I do that?
    I think I will get security Exception.
    How to get rid of this security Exception.
    Kindly Answer soon.......
    It's very urgent.
    Thanking you,
    KumudaRaj

    Did you already try signing a jarfile? If no ->>
    You can call a class inside a jar-file within the applet.
    if this class should be able to acces files the jarfile
    first has to be signed. to do this, you must generate a key.
    the complete work:
    1. write your applet
    2. write a html-page with following code:
    <APPLET code="guestbook.class" archive="guestbook.jar" width=600 height=400></APPLET>
    3. make a zip-file with the guestbook.class, guestbook.form, guestbook$1.class, guestbook$... and rename it to guestbook.jar
    4. in the console type:
    keytool -genkey -alias YOURNAME
    5. sign the key to your jarfile with:
    jarsigner guestbook.jar YOURNAME
    6. try the applet. a warning should appear which you have to answer
    with YES then it should work
    my trouble is that i cant acces files anyway because right now i don�t
    alreadv have the clue to get the right (absolute?) path for the file. means i get an ioexception because the applet cant find the file :-((
    does anyone know how to solve this problem then? my code is:
    FileReader Stream = new FileReader("/members/Ui97u8g4f6b89mj90kh5gbr4ecf6KXC4/guestbook.txt");
    ...

  • Creatimg Data Flow Diagrams using applets

    i am using java applets to make an application for Data Flow Diagrams. how to provide for validations for rules for the same and to have multiple level of windowa for it.

    nsh11 wrote:
    Sorry, i am new to forums.sun.com. Please tell form where to search for creating data flow diagrams using applets.That is too specific a question. If you want help on DFDs, [search on DFDs|http://www.google.com/search?q=Data+Flow+Diagrams]. If you want help with custom rendering, search on [custom rendering Java Tutorial|http://www.google.com/search?q=custom+rendering+Java+tutorial] . If you want help with applets, search on [applets Java Tutorial|http://www.google.com/search?q=applets+Java+tutorial] . If you have any specific questions how to make your DFD work and render in an applet, ask a (much more) specific question.
    But to be honest, if you cannot frame a more specific question after researching those links, I would recommend you look to a career in some field other than programming.
    Edit 1:
    Hit 'enter' too early.
    Edited by: AndrewThompson64 on Feb 11, 2010 11:23 PM

  • Applet oracle/forms/fnd/formsclient/formslauncher started

    Hi All,
    DB:11.1.0.7
    Oracle Apps: 12.1.1
    O/S: Red Hat Linux
    One of the users is receiving the message - 'applet oracle/forms/fnd/formsclient/formslauncher started' and thereafter no further progress while launching form.
    Could anyone please share what the issue is and hwo to solve it.
    Thanks for your time!
    Regards,

    Should jinitiator be uninstalled and re-installed again for the client pc?Do you mean Sun JRE? If yes, then yes you could do -- Recommended Browsers for Oracle E-Business Suite Release 12 [ID 389422.1]
    Also, try the same from the same machine using a different browser and see if you can reproduce the issue.
    Thanks,
    Hussein

  • What is the use of this form?

    Hi all,
    What is the use of this form in include RV61B901?
    How does this code send any information to the program calling it? Is Sy-subrc global so that main program will know the reuslts?
    Code:
    FORM KOBED_901.
      DATA : l_anzpk LIKE likp-anzpk.
      SELECT SINGLE anzpk FROM likp
                          INTO l_anzpk
                          WHERE vbeln = komkbv2-vbeln.
      IF l_anzpk NE 0.
        sy-subrc = 4.
        exit.
      ENDIF.
      sy-subrc = 0.
    ENDFORM.
    Thanks,
    Charles.

    Hello,
    This form sets the value of sy-subrc(which is global) based
    on the value of l_anzpk.
    Regards
    Greg Kern

  • Using applet to select a part of an image and then save it

    Hi ,
    I want to use applet to select a part of an image and then save that particular selected part to a server. can anyone provide me a code for this. I have found codes on the sun site which help in uploading an image but I am having trouble in trying to select a part of the image.

    Sorry to get back to you so late, but I was away from my computer this afternoon.
    I'm not sure just what you are after. I do see that you have positioned the tree on the labels. I went to the web site for the label company, and their instructions are not too helplful.
    http://www.pixentral.com/show.php?picture=15sBkl9OZE9xSkHoLMxgwjTFv2VCg1
    I changed the white portion of 1 label to black - - this can be any color. To do this use the magic wand tool, tolerance=10 worked for me, then go to Edit>fill selection.

  • I am trying to use a interactive form and it says "If this message is not eventually replaced by the proper contents of the document, your PDF  viewer may not be able to display this type of document."  This is a IRS form and has worked before.

    I am trying to use a interactive form and it says "see below"  This is a IRS form and has worked before.
    is there a tech support phone number?
    Please wait...
    If this message is not eventually replaced by the proper contents of the document, your PDF
    viewer may not be able to display this type of document.
    You can upgrade to the latest version of Adobe Reader for Windows®, Mac, or Linux® by
    visiting http://www.adobe.com/go/reader_download.
    For more assistance with Adobe Reader visit http://www.adobe.com/go/acrreader.
    Windows is either a registered trademark or a trademark of Microsoft Corporation in the United States and/or other countries. Mac is a trademark
    of Apple Inc., registered in the United States and other countries. Linux is the registered trademark of Linus Torvalds in the U.S. and other countries

    That means you are looking at the form online with a browser that uses its own (incompatible) PDF viewer, not the Adobe Reader plugin.
    Either
    download the form to your local disk and fill it from there
    use a browser that employs the Adobe Reader plugin
    configure your browser to use the Adobe Reader plugin: http://helpx.adobe.com/acrobat/kb/pdf-browser-plugin-configuration.html

  • Multi-language support for user-specified text strings used in the forms

    multi-language support for user-specified text strings used in the forms
    Instead of creating multiple forms, 1 in each different language, for the same service, is there any workaround?

    Hoan - is your question what are the considerations when creating multiligual catalogs? If so, I can tell you that at other clients I have seen them use a single catalog for one or two languages. For the two langugages, such as Spanish/English, you can create a single catalog with both of them. Once you get to more than two languages, the catalog would get unweildy and is therefore not suggested.

  • Print string to client printer using applet

    How to print a string directly to the client printer after clicking a button from my jsp/html page?
    I have posted a similar question here and someone(pqeuens) advised to use applet. I have been reading about applet & created one.
    I tried running it as a Java application & it prints as expected. However when i put it inside a jsp/html page, it will not print.
    Can anyone help me out on this? Perhaps share a code. That will be very much appreciated...
    Thank you

    I said you couldnt just print from JSP but you might be when you use a SIGNED applet.
    But then you need to move to the java applet forum and ask question there.
    Furthermore a standard applet cannot print because of the security invloved in applets. Nor will you be allowed to write files onto the client.

  • Questions about using a PDF form online

    I have a client who wants to create an online version of a PDF form that they are currently using. I am currently trying to explain to them that this would be best done as an HTML web form, but I may not win this argument. I have only used PDFs for printed forms (either hand-written or using form fields) so I am not familiar with any problems that converting the form for use online would entail.
    When the 'Submit' button is pressed on the form, is there a way to redirect to another web page after the data is submitted? (i.e. does the PDF have access to it's outer 'environment'?)
    Are there any security issues submitting data using the PDF form as opposed to using a standard web form? (There may be sensitive data being submitted)
    I'm not sure how they plan to handle the data that is submitted, but there are several options in the submitForm parameters - I am assuming that using the HTML option would submit the data in the same format as a web form would. Am I correct here?
    Can the PDF be prevented from being downloaded or printed? This form should only be used to submit data to their server, not as a printed form.
    Are there any other 'gotchas' that I need to look out for? Does anyone have a recommendation for a site which contains any tutorials or guidelines for using PDF forms online?

    Thanks for the information.
    Yes, I agree that there is less reason for it to be a PDF form (Actually, no real reason other than the original form already exists in PDF), but I am unfortunately in the position that my input in this project is not necessarily being considered (my company is following direct -and inconsistent- directions from the client, and I have no contact with the client to ask questions about what their actual needs are). I have been told to give the client the 'Tomato' that they are asking for, even though they are describing an 'Apple'.
    The reason this form is not meant to be printed is that we have replaced the 'Signature' fields from the original form with checkboxes that the user must check to confirm they have 'signed' the document. If they are to print/fax/whatever the document, they should use the original form, not this one. And I am still trying to explain to them that this would be better served with an HTML web form, but I fear I am losing that battle.
    I have brought up the fact that it is not 100% guaranteed that Acrobat will be available in the browser, although I can only guess that it is less than likely that anyone will not have some sort of PDF viewer available to their browser.
    I will also mention that issues may arise if the file is not submitted from within the browser.

  • Using container managed form-based security in JSF

    h1. Using container managed, form-based security in a JSF web app.
    A Practical Solution
    h2. {color:#993300}*But first, some background on the problem*{color}
    The Form components available in JSF will not let you specify the target action, everything is a post-back. When using container security, however, you have to specifically submit to the magic action j_security_check to trigger authentication. This means that the only way to do this in a JSF page is to use an HTML form tag enclosed in verbatim tags. This has the side effect that the post is not handled by JSF at all meaning you can't take advantage of normal JSF functionality such as validators, plus you have a horrible chimera of a page containing both markup and components. This screws up things like skinning. ([credit to Duncan Mills in this 2 years old article|http://groundside.com/blog/DuncanMills.php?title=j2ee_security_a_jsf_based_login_form&more=1&c=1&tb=1&pb=1]).
    In this solution, I will use a pure JSF page as the login page that the end user interacts with. This page will simply gather the input for the username and password and pass that on to a plain old jsp proxy to do the actual submit. This will avoid the whole problem of having to use verbatim tags or a mixture of JSF and JSP in the user view.
    h2. {color:#993300}*Step 1: Configure the Security Realm in the Web App Container*{color}
    What is a container? A container is basically a security framework that is implemented directly by whatever app server you are running, in my case Glassfish v2ur2 that comes with Netbeans 6.1. Your container can have multiple security realms. Each realm manages a definition of the security "*principles*" that are defined to interact with your application. A security principle is basically just a user of the system that is defined by three fields:
    - Username
    - Group
    - Password
    The security realm can be set up to authenticate using a simple file, or through JDBC, or LDAP, and more. In my case, I am using a "file" based realm. The users are statically defined directly through the app server interface. Here's how to do it (on Glassfish):
    1. Start up your app server and log into the admin interface (http://localhost:4848)
    2. Drill down into Configuration > Security > Realms.
    3. Here you will see the default realms defined on the server. Drill down into the file realm.
    4. There is no need to change any of the default settings. Click the Manage Users button.
    5. Create a new user by entering username/password.
    Note: If you enter a group name then you will be able to define permissions based on group in your app, which is much more usefull in a real app.
    I entered a group named "Users" since my app will only have one set of permissions and all users should be authenticated and treated the same.
    That way I will be able to set permissions to resources for the "Users" group that will apply to all users that have this group assigned.
    TIP: After you get everything working, you can hook it all up to JDBC instead of "file" so that you can manage your users in a database.
    h2. {color:#993300}*Step 2: Create the project*{color}
    Since I'm a newbie to JSF, I am using Netbeans 6.1 so that I can play around with all of the fancy Visual Web JavaServer Faces components and the visual designer.
    1. Start by creating a new Visual Web JSF project.
    2. Next, create a new subfolder under your web root called "secure". This is the folder that we will define a Security Constraint for in a later step, so that any user trying to access any page in this folder will be redirected to a login page to sign in, if they haven't already.
    h2. {color:#993300}*Step 3: Create the JSF and JSP files*{color}
    In my very simple project I have 3 pages set up. Create the following files using the default templates in Netbeans 6.1:
    1. login.jsp (A Visual Web JSF file)
    2. loginproxy.jspx (A plain JSPX file)
    3. secure/securepage.jsp (A Visual Web JSF file... Note that it is in the sub-folder named secure)
    Code follows for each of the files:
    h3. {color:#ff6600}*First we need to add a navigation rule to faces-config.xml:*{color}
        <navigation-rule>
    <from-view-id>/login.jsp</from-view-id>
            <navigation-case>
    <from-outcome>loginproxy</from-outcome>
    <to-view-id>/loginproxy.jspx</to-view-id>
            </navigation-case>
        </navigation-rule>
    NOTE: This navigation rule simply forwards the request to loginproxy.jspx whenever the user clicks the submit button. The button1_action() method below returns the "loginproxy" case to make this happen.
    h3. {color:#ff6600}*login.jsp -- A very simple Visual Web JSF file with two input fields and a button:*{color}
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
        <jsp:directive.page
    contentType="text/html;charset=UTF-8"
    pageEncoding="UTF-8"/>
        <f:view>
            <webuijsf:page
    id="page1">
    <webuijsf:html id="html1">
    <webuijsf:head id="head1">
    <webuijsf:link id="link1"
    url="/resources/stylesheet.css"/>
    </webuijsf:head>
    <webuijsf:body id="body1" style="-rave-layout: grid">
    <webuijsf:form id="form1">
    <webuijsf:textField binding="#{login.username}"
    id="username" style="position: absolute; left: 216px; top:
    96px"/>
    <webuijsf:passwordField binding="#{login.password}" id="password"
    style="left: 216px; top: 144px; position: absolute"/>
    <webuijsf:button actionExpression="#{login.button1_action}"
    id="button1" style="position: absolute; left: 216px; top:
    216px" text="GO"/>
    </webuijsf:form>
    </webuijsf:body>
    </webuijsf:html>
            </webuijsf:page>
        </f:view>
    </jsp:root>h3. *login.java -- implent the
    button1_action() method in the login.java backing bean*
        public String button1_action() {
            setValue("#{requestScope.username}",
    (String)username.getValue());
    setValue("#{requestScope.password}", (String)password.getValue());
            return "loginproxy";
        }h3. {color:#ff6600}*loginproxy.jspx -- a login proxy that the user never sees. The onload="document.forms[0].submit()" automatically submits the form as soon as it is rendered in the browser.*{color}
    {code}
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    version="2.0">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    doctype-public="-W3CDTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html"
    pageEncoding="UTF-8"/>
    <html>
    <head> <meta
    http-equiv="Content-Type" content="text/html;
    charset=UTF-8"/>
    <title>Logging in...</title>
    </head>
    <body
    onload="document.forms[0].submit()">
    <form
    action="j_security_check" method="POST">
    <input type="hidden" name="j_username"
    value="${requestScope.username}" />
    <input type="hidden" name="j_password"
    value="${requestScope.password}" />
    </form>
    </body>
    </html>
    </jsp:root>
    {code}
    h3. {color:#ff6600}*secure/securepage.jsp -- A simple JSF{color}
    target page, placed in the secure folder to test access*
    {code}
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
    <jsp:directive.page
    contentType="text/html;charset=UTF-8"
    pageEncoding="UTF-8"/>
    <f:view>
    <webuijsf:page
    id="page1">
    <webuijsf:html id="html1">
    <webuijsf:head id="head1">
    <webuijsf:link id="link1"
    url="/resources/stylesheet.css"/>
    </webuijsf:head>
    <webuijsf:body id="body1" style="-rave-layout: grid">
    <webuijsf:form id="form1">
    <webuijsf:staticText id="staticText1" style="position:
    absolute; left: 168px; top: 144px" text="A Secure Page"/>
    </webuijsf:form>
    </webuijsf:body>
    </webuijsf:html>
    </webuijsf:page>
    </f:view>
    </jsp:root>
    {code}
    h2. {color:#993300}*_Step 4: Configure Declarative Security_*{color}
    This type of security is called +declarative+ because it is not configured programatically. It is configured by declaring all of the relevant parameters in the configuration files: *web.xml* and *sun-web.xml*. Once you have it configured, the container (application server and java framework) already have the implementation to make everything work for you.
    *web.xml will be used to define:*
    - Type of security - We will be using "form based". The loginpage.jsp we created will be set as both the login and error page.
    - Security Roles - The security role defined here will be mapped (in sun-web.xml) to users or groups.
    - Security Constraints - A security constraint defines the resource(s) that is being secured, and which Roles are able to authenticate to them.
    *sun-web.xml will be used to define:*
    - This is where you map a Role to the Users or Groups that are allowed to use it.
    +I know this is confusing the first time, but basically it works like this:+
    *Security Constraint for a URL* -> mapped to -> *Role* -> mapped to -> *Users & Groups*
    h3. {color:#ff6600}*web.xml -- here's the relevant section:*{color}
    {code}
    <security-constraint>
    <display-name>SecurityConstraint</display-name>
    <web-resource-collection>
    <web-resource-name>SecurePages</web-resource-name>
    <description/>
    <url-pattern>/faces/secure/*</url-pattern>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
    <http-method>HEAD</http-method>
    <http-method>PUT</http-method>
    <http-method>OPTIONS</http-method>
    <http-method>TRACE</http-method>
    <http-method>DELETE</http-method>
    </web-resource-collection>
    <auth-constraint>
    <description/>
    <role-name>User</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <realm-name/>
    <form-login-config>
    <form-login-page>/faces/login.jsp</form-login-page>
    <form-error-page>/faces/login.jsp</form-error-page>
    </form-login-config>
    </login-config>
    <security-role>
    <description/>
    <role-name>User</role-name>
    </security-role>
    {code}
    h3. {color:#ff6600}*sun-web.xml -- here's the relevant section:*{color}
    {code}
    <security-role-mapping>
    <role-name>User</role-name>
    <group-name>Users</group-name>
    </security-role-mapping>
    {code}
    h3. {color:#ff6600}*Almost done!!!*{color}
    h2. {color:#993300}*_Step 5: A couple of minor "Gotcha's"_ *{color}
    h3. {color:#ff6600}*_Gotcha #1_*{color}
    You need to configure the "welcome page" in web.xml to point to faces/secure/securepage.jsp ... Note that there is *_no_* leading / ... If you put a / in there it will barf all over itself .
    h3. {color:#ff6600}*_Gotcha #2_*{color}
    Note that we set the <form-login-page> in web.xml to /faces/login.jsp ... Note the leading / ... This time, you NEED the leading slash, or the server will gag.
    *DONE!!!*
    h2. {color:#993300}*_Here's how it works:_*{color}
    1. The user requests the a page from your context (http://localhost/MyLogin/)
    2. The servlet forwards the request to the welcome page: faces/secure/securepage.jsp
    3. faces/secure/securepage.jsp has a security constraint defined, so the servlet checks to see if the user is authenticated for the session.
    4. Of course the user is not authenticated since this is the first request, so the servlet forwards the request to the login page we configured in web.xml (/faces/login.jsp).
    5. The user enters username and password and clicks a button to submit.
    6. The button's action method stores away the username and password in the request scope.
    7. The button returns "loginproxy" navigation case which tells the navigation handler to forward the request to loginproxy.jspx
    8. loginproxy.jspx renders a blank page to the user which has hidden username and password fields.
    9. The hidden username and password fields grab the username and password variables from the request scope.
    10. The loginproxy page is automatically submitted with the magic action "j_security_check"
    11. j_security_check notifies the container that authentication needs to be intercepted and handled.
    12. The container authenticates the user credentials.
    13. If the credentials fail, the container forwards the request to the login.jsp page.
    14. If the credentials pass, the container forwards the request to *+the last protected resource that was attempted.+*
    +Note the last point! I don't know how, but no matter how many times you fail authentication, the container remembers the last page that triggered authentication and once you finally succeed the container forwards your request there!!!!+
    +The user is now at the secure welcome page.+
    If you have read this far, I thank you for your time, and I seriously question your ability to ration your time pragmatically.
    Kerry Randolph

    If you want login security on your web app, this is one way to do it. (the easiest way i have seen).
    This method allows you to create a custom login form and error page using JSF.
    The container handles the actual authentication and protection of the resources based on what you declare in web.xml and sun-web.xml.
    This example uses a statically defined user/password, stored in a file, but you can also configure JDBC realm in Glassfish, so that that users can register for access and your program can store the username/passwrod in a database.
    I'm new to programming, so none of this may be a good practice, or may not be secure at all.
    I really don't know what I'm doing, but I'm learning, and this has been the easiest way that I have found to add authentication to a web app, without having to write the login modules yourself.
    Another benefit, and I think this is key ***You don't have to include any extra code in the pages that you want to protect*** The container manages this for you, based on the constraints you declare in web.xml.
    So basically you set it up to protect certain folders, then when any user tries to access pages in that folder, they are required to authenticate.
    --Kerry                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Unable to close browser when using Adobe Interactive Form

    Hello,
    I'm using an Interactive Form in my Web Dynpro application. Everything works fine, but when the view with the Interactive Form is active, I am not able to close the browser window anymore. Moving to another view is also not possible.
    I already changed all the options of the Interactive Form but always the same behaviour.
    I am developing on Web AS 6.40, Service Pack 11. ADS is installed also with Service Pack 11.
    Adobe Reader is Version 7.0 and Adobe Designer is Version 7.1
    Has anyone an idea what's wrong?
    Thanks for your help!
    Best regards
    Christian

    Hi,
    I am facing a problem with viewing SAP interactive forms.
    I have the SAPForms.api in Adobe reader plugins but is outdated (19th apr, 05). How do I get the new one and how do I register it ? This same scenario works on a colleague's machine with same config except the SAPForms.api which is latest. (Nov, 05)
    Any pointers will be highly appreciated.
    Thanks,
    Samar

  • How can I use applet to get the desktop image of client

    hi,I have a question to ask u.
    How can I use applet to get the desktop image of client? Now I develop a web application and want user in the client to get his current image of the screen.And then save as a picture of jpeg format ,then upload it to the server?
    I have done an application to get the screen image and do upload file to server in a servlet with the http protocal.

    Since the desktop image is on the client's local hard drive, you'll need to look at trusted applets first.

Maybe you are looking for

  • Images in Layout

    I'm trying to develop an applet, i'm working from some old books I bought a few years ago now, so i'm not even sure that the code i'm using is still current, tbh my applet isn't showing right now (not with Mozilla on Fedora 3, but does on XP with Moz

  • Error 200524 Different number of channels in task and data

    Anyone out there with some information would be greatly appreciated. I  have attached my VI. Essentially I am trying to build a simple PID VI to controll the temperature of a piece of equipment in a system I am building. I have heating wire powered b

  • Cheque and payment advice through different printers

    Hi , We need to print cheques and payment advice through different printers , for both the above documents we are using z programs .... Both get printed at the same time ,whenever a cheque is printed a payment advice is also printed . any idea how to

  • Dequeue Error - Error Code -25228

    I have created the queue table, queue and added the subscriber. The subscriber agent is also an advanced queue. I have been facing problems with the Dequeueing bit. When I execute the Dequeue procedure, am getting this error. Error Code -25228 Error

  • Ringtones - can't open editor or move to folder or sync

    I'm a new iphone user. I bought 3 ringtones from itunes. They show up in my itunes under "Purchased," and in my music library. They do not have the bell icon next to them as they did in the store window. I read through the forums and saw that I need