Write code for authentication of username and password using struts

write code for authentication of username and password using session using struts with jdbc connection..

write code for authentication of username and
password using session using struts with jdbc
connection..and please, allow me to spoon feed you!

Similar Messages

  • Checkin for a specific username and password

    i have an html page where i enter username and password..now if i want that for a specific username and password only the next page say next.html is displayed otherwise the same page is diaplayed sayin that the usrename and password is to be reenterd...how can i do this servlets..also do tell me where to store the username and password

    I am sorry, I lost some code in cut and pasting it
    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;   
    public class LoginServlet extends HttpServlet{
            private Connection con;
            private PreparedStatement pstmt;
            private Statement stmt;
            private ResultSet rs;
            private String pass = "";
            private String login,password,done;
            private HttpSession session;
            public void doPost(HttpServletRequest request,HttpServletResponse response)
            throws ServletException, IOException{
                    login = ""+request.getParameter("login");
                    password = ""+request.getParameter("password");
                    done = ""+request.getParameter("done");
                    session = request.getSession(true);
                    PrintWriter out = response.getWriter();
                    try{
                            Class.forName("oracle.jdbc.driver.OracleDriver");
                    }catch(Exception e){
                            out.println(e.getMessage());
                    try{
                            con = DriverManager.getConnection("jdbc:oracle:thin:scott/[email protected]:1521:csapw");
                            if(!(password.equals("")&&login.equals(""))){
                                    pstmt = con.prepareStatement("select password from logon where login = ?");
                                    pstmt.setString(1,login);
                                    rs = pstmt.executeQuery();
                                                         pass = "";
                                    while(rs.next()){
                                            pass = rs.getString(1);
                                    if(pass.equals(password)){
                                            session.setAttribute("login",login);
                                            if(done.equals("null")){
                                                    done = "";
                                                    pass = "";
                                                    response.sendRedirect("/ksenji/quiz2/shoponline.jsp");
                                            }else{
                                                    response.sendRedirect(done.substring(5));
                                    else{
                                            response.sendRedirect("/ksenji/quiz2/login.jsp?"+done);
                            else{
                                    response.sendRedirect("/ksenji/quiz2/login.jsp?"+done);
                    }catch(SQLException ex){
                            out.println(ex.getMessage());
               

  • My computer is authorized, but when I try to open a recently downloaded audio file I get asked for my "Audible username and password"  and my AppleID and password do not work

    My computer is authorized, but when I try to open a recently downloaded audio file I get asked for my "Audible username and password"  and my AppleID and password do not work.

    thats because audible isnt apple provided, its a third party app/website so you'll have to get it from them

  • Access document in Library is being asking for an Infopath username and password

    Trying to get access to files in the library. And the user is having permissions but when he clicked the file in the library he is being ask for an Infopath username and password.
    A pop dialog box showing like  
        "Form will open in Offline Mode"
                                      You are currently working offline.
    To try to connect to data sources when the form is opened, click "Try to Connect". To use previously stored data......
    Can somebody reply on this please.. 

    Hi,
    According to your post, my understanding is that access document in Library is being asking for an Infopath username and password.
    Usually this error when the form is not connected to any of the data sources successfully. Please verify all the data connections are available or not.
    I recommend to enable the options for Infopath Form Services to ensure that InfoPath 2010 is in online mode.
    In addition, you can add your SharePoint server’s FQDN to your Trusted Sites or Intranet Sites zone and modify your registry settings for the WebClient service.
    For more information, you can refer to:
    Form will Open in Offline mode? Please help
    How to ensure that Infopath 2010 is in online mode?
    SharePoint Keeps Prompting for Credentials
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Firefox any version Mac, has a bug were it does not see or ask for the proxy username and password. This happens if you use a virtual tagged interface.

    Firefox any version Mac, has a bug were it does not see or ask for the proxy username and password. This happens if you use a virtual tagged interface. A recent network University policy change. The only way to fix this, is if you use a manual proxy configuration in Firefox. So all 100 + uni iMac's can only use Safari as I would need to do a profile push to all 300 students and I am unsure what file carries the proxy information.

    Firefox any version Mac, has a bug were it does not see or ask for the proxy username and password. This happens if you use a virtual tagged interface. A recent network University policy change. The only way to fix this, is if you use a manual proxy configuration in Firefox. So all 100 + uni iMac's can only use Safari as I would need to do a profile push to all 300 students and I am unsure what file carries the proxy information.

  • How to pass Username and password using Invoke to a webservice

    Hi Guys,
    Please tell me how can I pass Username and password using Invoke to a webservice, I am using SOA 11G.
    Thanks
    Yatan

    Hi Yatan
    I suppose you want to use basic HTTP authentication.
    Try to lookup in the SOA docs this property
    oracle/wss_http_token_client_policy
    http://download.oracle.com/docs/cd/E17904_01/web.1111/b32511/configuring.htm#WSSEC2261
    Regards
    Mihai

  • Using CreateObject for Webservice with username and password

    When using createObject() to call a web service how do I pass
    in the user name and password required by the service?
    If I do a cfdump on the webservice object I see it has
    setUserName() and setPassword() methods but they don't seem to be
    working.
    I also see there are properties named "USERNAME_PROPERTY" and
    "PASSWORD_PROPERTY" but I can't seem to modify them in code. I
    suppose they are protected.
    example:
    ws = createObject("webservice", "
    http://url.to/wsdl.xml",
    "serviceport");
    ws.setUserName("myawesomeusername");
    ws.setPassword("myawesomepassword");
    myReturn = ws.serviceMethodCall("bla");

    quote:
    Originally posted by:
    MACRStockHolder
    For anyone that encounters the same issue/question;
    apparently you can't apply a username/password to the object call
    like you can when using <cfinvoke> to make a web service
    call.
    FYI Adobe: this is VERY limiting, I have to use a web service
    that uses in/out parameters which to the best of my knowledge
    requires the use of createObject() but at the same time the web
    service requires a username and password which I can only do with
    <cfinvoke>. Looks like I will be writing a compiled custom
    tag just for a workaround.
    According to the docs you can provide a username and password
    by passing a struct containing these items to CreateObject
    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_c-d_18.html#45 14398
    If you like cfinvoke use it. You can get return values by
    using the returnVariable argument. I would assume mutliple output
    parameters would be returned in a struct.
    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_i_10.html#4001127

  • Connecting Using SSL Authentication Without Username and Password

    Hi,
    We're on RedHat Linux 4.0 using 10.2.0.3 (server/client). We're trying to figure out a way to connect to the database using instantclient and JDBC-OCI and SSL authentication without using a username or password. According to the documentation this should be possible but no sample code is given.
    LD_LIBRARY_PATH is set /opt/app/oracle/product/10.2.0/db_1/lib:/usr/lib:/home/oracle/instantclient where the instantclient was installed from the 10.2.0.1 client software
    and we are using JDK version 1.6.0_03.
    We're also referencing the following paper:
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/pdf/wp-oracle-jdbc_thin_ssl_2007.pdf
    We've got our client and server wallets configured and the sample code we tried looks like this:
    import java.sql.*;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.net.ns.*;
    import oracle.net.ano.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.*;
    import java.security.*;
    import oracle.jdbc.pool.OracleDataSource;
    public static void main(String[] argv) throws Exception {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Security.addProvider(new oracle.security.pki.OraclePKIProvider());
    System.setProperty("oracle.net.tns_admin", "/opt/app/oracle/product/10.2.0/db_1/network/admin");
    String url = "jdbc:oracle:thin:@orcl";
    java.util.Properties props = new java.util.Properties();
    props.setProperty("oracle.net.authentication_services","(TCPS)");
    props.setProperty("javax.net.ssl.trustStore",
    "/opt/app/oracle/product/10.2.0/db_1/admin/wallet/server/cwallet.sso");
    props.setProperty("javax.net.ssl.trustStoreType","SSO");
    props.setProperty("javax.net.ssl.keyStore", "/opt/app/oracle/product/10.2.0/db_1/admin/wallet/client/cwallet.sso");
    props.setProperty("javax.net.ssl.keyStoreType","SSO");
    props.put ("oracle.net.ssl_version","3.0");
    props.put ("oracle.net.wallet_location", "(SOURCE=(METHOD=file)(METHOD_DATA=(DIRECTORY=/opt/app/oracle/product/10.2.0/db_1/admin/wallet/client)))");
    System.out.println("At Here...");
    OracleDataSource ods = new OracleDataSource();
    //ods.setUser("scott");
    //ods.setPassword("tiger");
    ods.setURL(url);
    ods.setConnectionProperties(props);
    System.out.println("At Here1...");
    Connection conn = ods.getConnection();
    System.out.println("At Here2...");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select 'Hello Thin driver SSL "
    + "tester ' from dual");
    while (rset.next())
    System.out.println(rset.getString(1));
    rset.close();
    stmt.close();
    conn.close();
    When this code is compiled and run, the following error is thrown:
    Exception in thread "main" java.sql.SQLException: invalid arguments in call
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    If a username and password is supplied, the code works. So does anyone have a working of using SSL to authenticate without supplying username/password?
    Thanks
    mohammed

    Hi,
    I just solved this. I noticed from another thread that I was not using the OCI driver (see below):
    String url = "jdbc:oracle:thin:@pki14";
    Once I changed it to:
    String url = "jdbc:oracle:oci:@pki14";
    The code worked perfectly. One more setting that you'll have to do is to create the user you want to connect as externally:
    create user scott identified externally as
    'CN=acme, OU=development, O=acme, C=US';
    grant connect,create session to scott;
    Note that the DN should be the same as the SSL certificate that you created in your wallet.
    hth
    mohammed

  • [Deployment] How NOT to hard code the Database SID, Username, and Password

    Hi, I'm new in J2EE so be easy on me. :)
    How can I parameterize the database SID, username, and password in my J2EE application? So that anyone can change the SID, username, and password without the need to modify my code? I use Oracle 10g, ADF BC, JSF and JDeveloper 10.1.3.1.
    My friend said that I can use XML for this. But he didn't go to detail for doing this. Is it true? Is there any [or better alternative]?
    Any help or pointer to a simple tutorial would be fine.
    Thanks in advance.

    Hi -- this is quite easy to do with J2EE.
    In your application code, you declare "logical" references to resources (such as datasources, security roles, etc.) and use those in your application code so all it depends on is the logical name
    On the server where the application is deployed, "physical" resources are created that point to the actual resource -- in the case of a database, this would be the JDBC URL, username, password.
    At deployment time of the application, you then use the facilities of deployment tool to "map" the logical references in the application, to the physical references that exist on the server. So you connect the dots between your application needing something and the server providing the something. That way all the "details" are abstracted out of the your application code.
    I don't know how this works in ADF, BC4J, etc. but I presume that since they are based on standard/J2EE, it must be available somehow.
    I wrote something about this a while back using direct JDBC as an example:
    http://buttso.blogspot.com/2006/06/datasource-lookup-using-javacompenv.html
    -steve-

  • Configuring Basic Authentication with Username and password on BizTalk Schema Service

    Hi,
    I have published my schema as a webservice with WCF-BASICHTTP adapter in IIS 8.0.
    I wanted to have a Basic Authentication(User name and password restriction).
    I made the Receive location with Security mode as Transport and Transport Client Crediential Type as Basic.
    I also set the Service in IIS with Basic Authentication only enabled.
    But I don't know how to provide a UserName and Password Authentication.
    Please provide your suggestions
    Regards, Vignesh S

    Hi,
    Try & go through the below MSDN link as it explains configuring WCF BasicHttp adapter very well.
    http://msdn.microsoft.com/en-us/library/bb246064(v=bts.80).aspx
    HTH,
    Sumit
    Sumit Verma - MCTS BizTalk 2006/2010 - Please indicate "Mark as Answer" or "Mark as Helpful" if this post has answered the question

  • Leopard prompts for 802.1X username and password instead of WEP password

    hey!
    so i got leopard on friday and i haven't been able to connect to my wireless properly since.
    i have an old D-Link DI-624 (Revision B) router that i have protected with a WEP password. in tiger i never had any problems with this, but now instead of prompting me for a WEP password when i try to connect, leopard prompts me to enter username and password and below there is a dropdown entitled 802.1X with options automatic and TTLS-PAP.
    if i try to enter my WEP password as the password, the connection fails.
    i know that the issue is not the router because my girlfriend is still running tiger and has no issues.
    i ran that login and keychain update and that didn't help. i also deleted that old airport driver file that other people had mentioned for other airport issues and that didn't do anything either.
    any ideas??
    thanks!!

    I have this exact same problem.

  • I have changed my username and password but the apps are still asking for my old username and password. How do I change that

    I have changed my username and password for my apple account but the apps previously linked to it are still asking for the old info. And I don,t know it so that's why I updated it

    Apps are permanently tied to the ID and password used to purchase them. If you do not remember that information, you cannot update them. If you ned these apps, you will have to repurchase them under your new ID.

  • HT4623 I can't update my apps on my iPad because it keeps asking for an outdated username and password which is different to my current one

    I can't update my apps in my iPad because it asks me to sign in to an outdated id which is different to my current Apple ID

    Apps are always tied to the ID that was used to purchase them. If you bought the apps with old username and password, you have to continue to use them to update the apps.
    If you changed the username because you got a new email address, sign out of your old ID in Settings>iTunes and App Store. Tap the old ID and sign out then sign in with the new/changed ID.

  • My 2nd hand phone was recently restored by a repairer due to issues beyond my control and now since the restoration the phone asked me for an icloud username and password of which I have never created. what can I do???

    Activation help! 
    I need to activate my 2nd hand Iphone by entering the apple iD and password used to set up icloud. My problem is that I have never set up icloud. I purchased the phone off the original owner almost 12 months ago and have recently experienced problems which required repairing.
    The repairer apparently had to delete my iD I used to login to itunes and now is asking for icloud email and password. 
    Can someone help me please?

    The only solution is to contact the original owner. He will need to give you the info required. Apple will not help you circumvent the activation lock.

  • Username and password using page0 within

    I have developed an application where in which i have to register new users,
    by assigning them username password etc, the columns are username, password, confirmpassword in page zero or items in page zero on entering them
    where these values will get submitted .i have to write code for this to check whether it is a valid username and password where shall i write the code for
    this items after deleting the cookie package from login page .
    plz help me
    thanks in advance

    http://forums.oracle.com/forums/ann.jspa?annID=283

Maybe you are looking for

  • Macbook pro wireless won't turn on

    Ever since Yosemite (sound familiar?) I've been having wireless issues. At random times, wireless will simply stop working. Instead of showing the network name, it doesn't show anything. Turning off wireless results in wireless unable to be turned on

  • Error message when opening iTunes 10

    Everytime I try to open up iTunes, i get an error message: iTunes has stopped working  A Problem caused the program to stop working correctly.  Windows will close the program and notify you if a solution is available.  I'm running Windows 8 with iTun

  • Problem Dequeueing JMS_TEXT_MESSAGE payload

    I am writing a .net app to dequeue messages using ODP.net 11g Release 2 (11.1.0.7.20). The payload type is SYS.AQ$_JMS_TEXT_MESSAGE. When I make the dequeue call (DEQUEUE or DEQUEUEARRAY) I am get the following error: ORA-25215: user_data type and qu

  • Streaming games from imac osx10.4 to tv

    Bought new imac, love it (09/07). Bought my daughter a couple of imac games for Christmas, any way to stream them to a tv, even by cables? (Games were Diner Dash and Guitar Hero III). Hope you all have a great Holiday Season. Dan

  • One page not pinching and zooming on mobile devices

    Running OS X 10.9.2 Adobe Muse CC 2014 I have uploaded a 4 page website via FTP. Originally the pages were displaying too big (wide) on mobile devices. I couldn't find a solution to this problem so I created a tablet version of the site. Doing so got