Saving to and retrieving from database

Hi,
How can I save my program's data in a database and how can I view the data?
S.A.T

You can save data to a database using the SqlCommand.ExecuteNonQuery method:
https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery(v=vs.110).aspx
string query = "INSERT INTO TABLE (col1) VALUES (1)";
using (SqlConnection connection = new SqlConnection(
"your connection string...."))
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
You will have to supply a connection string to the database:
http://www.connectionstrings.com/sql-server/
...and an SQL query (INSERT, UPDATE) to be executed against the database.
You can retrieve data similarly using a SqlDataAdapter that fills a DataSet:
http://www.dotnetperls.com/sqldataadapter
DataTable t = new DataTable();
using (SqlConnection c = new SqlConnection(
"connection string..."))
c.Open();
// 2
// Create new DataAdapter
using (SqlDataAdapter a = new SqlDataAdapter(
"SELECT * FROM EmployeeIDs", c))
// 3
// Use DataAdapter to fill DataTable
a.Fill(t);
Please remember to mark helpful posts as answer to close your threads and then start a new one if you have a new question.

Similar Messages

  • Type in value and retrieve from database

    Hi,
    I have a database of clients and to keep it up to date, we will be sending out an email asking them to confirm if they're details are correct and up to date.
    In that email will be a link to a webpage where they can confirm their details are up to date. They will have to type in their email address which will then retrieve their information to update or confirm they are correct.
    I have no trouble updating. I usually list the data and then click on the one that needs updating.
    I'm having trouble retrieving the information after the user has typed in their email address.
    Here is my code so far - at the moment I have listed the data in a table with an "update" link next to each row that allows me to update.
    Where would I put the text field where the user can type in their email? I've tried different ways but was unsuccessful.
    Hope you can help
    Thanks
    <%
    strSQL = "SELECT * FROM emails"
    rsEmail.Open strSQL, conn
    %>
    <html>
    <head><title>All</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="layout.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <div id="wrapper">
      <p>  </p>
      <div id="view">
      <div class="insert"><a href="insertform.html">Insert</a></div>
      </div>
      <table width="1100" cellpadding="5">
        <tr>
          <td width="53">ID</td>
          <td width="300">firstname</td>
          <td width="378">lastname</td>
          <td width="121">email</td>
          <td width="92">Update</td>
          <td width="92">Delete</td>
        </tr>
      </table>
      <table width="1100" cellpadding="5">
        <%
       Do While not rsEmail.EOF
    %>
        <tr><td width="53"><% Response.Write rsEmail("id") %></td>
          <td width="294"><% Response.Write rsEmail("firstname") %></td>
          <td width="374"><% Response.Write rsEmail("lastname") %></td>
          <td width="119"><% Response.Write rsEmail("email") %></td>
          <td width="91"><%  Response.Write ("<a href=""update_form.asp?ID=" & rsEmail("ID") & """>")%>Update<%Response.Write ("</a>") %></td>
        </tr>
        <%
    rsEmail.MoveNext
    Loop
    'Reset server objects
    rsEmail.Close
    Set rsEmail = Nothing
    Set conn = Nothing
    %>
      </table>
    </div>
    </body>
    </html>

    This 'tutorial' is flawed and needs work. Use with care.
    1 - Upload the file correctly. This is NOT an example of how to upload a file from a web page. You need method="post" and enctype="multipart/form-data". Then in the servlet doing the file retrieval you need to get the input stream from the request. Using a library like the jakarta commons File Upload is recommended.
    2 - Database connection should not be done in a JSP. 'nuff said.
    3 - In fact scriptlet code in a JSP is a bad approach in general. avoid.
    4 - A better approach would be to use an ImageServlet as exampled, and just have img tag reference that servlet directly.
    While I applaud the intentions behind wanting to share the code, the code shows several basic design flaws. I think it is a better example of what NOT to do rather than the intended how-to.
    Thats my 2 cents.
    evnafets

  • Re: [Re: Keys retrieval from database]

    Hi Joseph,
    Thank you for your reply.I am using ODBC to connect Forte application with the database.And I went through the document, and tried all the possible ways, I could't succed in retrieval of whole data.I tried the sql execute procedure also.I will the error message
    after sometime.How does it related with escript?please clarify.
    Thank you,
    J.Babu
    [email protected] wrote:
    Hello Jendran,
    take a look at your 'Online-Help'. Search for 'DBDataType' (DBColumnDesc) and
    'GetDatabaseDesc' and look if your question is answered.
    See the 'Accessing Database Guide' Page 236 for a complete description of the
    call ('sql execute procedure' not 'sql execute Immediate procedure').
    Look wether you connect via ODBC or Direct to the database in your
    DBResourceMgr (Perhaps you have to look how this is specified in your
    environment in 'econsole'). If you have any more problems please copy
    the error-message in your email, to see what forte says to this error.
    Hope this helps
    Joseph Mirwald
    At 04:30 18.06.98, you wrote:
    Hi guys,
    Have any one used the method GetDatabaseDesc() of DbSession classto retrieve columns, primary keys and Foreign keys of a database? I
    couldn't retrieve any information except columns of MsSql server
    database.If possible give some information.
    I couldn't execute stored procedure from Forte, what could be theproblem? we tried with sql execute Immediate procedure.
    Thank you in advance,
    J.Babu
    Get free e-mail and a permanent address at http://www.netaddress.com/?N=1
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Babu,
    Note that though you will be able to get column information on
    most of the
    databases, some databases do not maintain or provide access to
    key
    information. For these databases, specifying DB_IN_KEYINFO and
    DB_IN_FOREIGNKEYINFO has no effect. Oracle, Ingres, and Informix
    do support key information. Check vendor documentation for
    other databases
    on specific platforms.
    As rightly mentioned by Joseph Mirwald, you might want to email
    a copy
    of the error message that you get.
    Good luck!
    Ajith Kallambella M.
    Forte Systems Engineer,
    Internationational Business Corporation.
    From: [email protected][SMTP:[email protected]]
    Reply To: [email protected]
    Sent: Thursday, June 18, 1998 12:30 AM
    To: [email protected]
    Cc: [email protected]; [email protected]
    Subject: Keys retrieval from database
    Hi guys,
    Have any one used the method GetDatabaseDesc() of DbSession
    class to retrieve columns, primary keys and Foreign keys of a
    database? I couldn't retrieve any information except columns of MsSql
    server database.If possible give some information.
    I couldn't execute stored procedure from Forte, what could be
    the problem? we tried with sql execute Immediate procedure.
    Thank you in advance,
    J.Babu
    Get free e-mail and a permanent address at
    http://www.netaddress.com/?N=1
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Data Could not be retrieved from database...

    Hi All,
    I have a problem on Excel 2007 while refreshing (for pivot table) data from SQL Server view:
    "Data could not be retrieved from database. Check the database server or contact your database administrator. Make sure that external database is availiable, and then try the operation again"
    Excel file is distributed on about 20 workstations in network with the same Excel version, and problem occurs only on one station. I have checked credentials and connection between workstation and server and it seems to be ok.
    Any ideas?

    it is problem, because sql server is not member of domain... so I'm using sql aunthentication.
    strange thing is that from any other workstations (aldo in domain) it works fine when providing SQL user. I'm supposing that it is problem with some excel settings

  • Loading the username and password from database when login to xMII

    Hi
      can you explain briefly about how to configure the netweaver for loading username and password from database when the user login to xMII via netweaver platform?
    In xMII 11.5 we are configuring xMII itself? but in xMII 12.0 configuring by netweaver platform. if anyone know please explain step by step

    I am sending you some java code, which you can use in JSP.
    import java.sql.*;
    public class connectOracle{
    public static void main(String[] args) {
    System.out.println("Getting Column Names Example!");
    Connection con = null;
    String url = "jdbc:oracle:thin:@172.16.0.21:1521:orcl";
    String driver = "oracle.jdbc.driver.OracleDriver";
    String user = "scott";
    String pass = "tiger";
    try{
    Class.forName(driver);
    con = DriverManager.getConnection(url, user, pass);
    catch (SQLException s){
    System.out.println("SQL statement is not executed!");
    catch (Exception e){
    e.printStackTrace();
    }

  • Playing a video file retrieved from database using JMF

    Hello!
    I am developing a multimedia application that has to store videos, music, pictures in a database. I did a little searching and found that JMF is a very good solution in playing video/music using Java. I found some examples to play the video/music stored on the hard drive (as separate files), but i have to be able to take the video/music from the database, and feed it to the JMF player. Has anyone some suggestions about how this could be done?
    Thanks in advance!
    Edited by: radu.miron on May 8, 2008 9:03 AM

    Well, i think i didn't make myself clear enough :). i know how to retreive the data from the database. The thing is this: let's suppose i have a 700 MB movie stored in the database. One option to play that movie would be to retrieve it from the DB, create a file somewhere on the disk, and put the data retrieved from the database in that file. But this involves that the disk will be overflooded when let's say 100 people watch 100 different movies. Another option (as i see it) would be to gradually take parts of the movie from the database (first 50 MB, then another 50 MB, then another and so on), and feed it to the JMF player. The user will watch the movie, but will not have the whole movie available, just a part of it. As he watches it, the application takes the next chunck of movie data and feeds it to the JMF player. That was the question i intended to ask, if anyone has any idea regarding the second option, and not the part with retrieving from the database, but the part with giving the JMF player video data to play.
    The example i found on the web with JMF player is the following:
    import javax.swing.*;*
    *import javax.media.*;
    import java.awt.*;*
    *import java.awt.event.*;
    import java.net.*;*
    *import java.io.*;
    public class PlayVideo extends JFrame {
         Player player;
         Component center;
         Component south;
         public PlayVideo() {
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              JButton button = new JButton("Select File");
              ActionListener listener =
                   new ActionListener() {
                   public void actionPerformed(
                             ActionEvent event) {
                        JFileChooser chooser =
                             new JFileChooser(".");
                        int status =
                             chooser.showOpenDialog(PlayVideo.this);
                        if (status ==
                             JFileChooser.APPROVE_OPTION) {
                             File file = chooser.getSelectedFile();
                             try {
                                  load(file);
                             } catch (Exception e) {
                                  System.err.println("Try again: " + e);
              button.addActionListener(listener);
              getContentPane().add(button,
                        BorderLayout.NORTH);
              pack();
              show();
         public void load(final File file)
         throws Exception {
              URL url = file.toURL();
              final Container contentPane =
                   getContentPane();
              if (player != null) {
                   player.stop();
              player = Manager.createPlayer(url);
              ControllerListener listener =
                   new ControllerAdapter() {
                   public void realizeComplete(
                             RealizeCompleteEvent event) {
                        Component vc =
                             player.getVisualComponent();
                        if (vc != null) {
                             contentPane.add(vc,
                                       BorderLayout.CENTER);
                             center = vc;
                        } else {
                             if (center != null) {
                                  contentPane.remove(center);
                                  contentPane.validate();
                        Component cpc =
                             player.getControlPanelComponent();
                        if (cpc != null) {
                             contentPane.add(cpc,
                                       BorderLayout.SOUTH);
                             south = cpc;
                        } else {
                             if (south != null) {
                                  contentPane.remove(south);
                                  contentPane.validate();
                        pack();
                        setTitle(file.getName());
              player.addControllerListener(listener);
              player.start();
         public static void main(String args[]) {
              PlayVideo pv = new PlayVideo();
    }but this example plays a video stored on the disk ( player = Manager.createPlayer(url); ), rather than a chunck of data (the whole movie or parts of it) retrieved from the database.
    Sorry for the misunderstanding!
    Cheers!

  • Image upload and display from database blob coloumn in ADF

    HI
    how can i upload and display image from database ( blob ) coloumn in ADF

    Hi,
    Take a look to this video: http://www.youtube.com/watch?v=_KYquJwYFGE
    AP

  • Separate ASCS and PAS from Database server

    Dear friends, in a customer we have the following need:
    We need to separate de ASCS and the Primary application server to a host different from database server. The SAP system is an ERP 6.0 EHP4 based in NW 7.01.
    We have used Software provisoning manager to splitt off the ASCS from the CI. Before the splitt off we only had the directory DVEBMSG00, and after the splitt off, we had ASCS01 and DVEBMSG00 directories. But, this is only half of the solution, because we need to move this services to another hosts.
    We tried to use Software provisioning manager to deinstall the ASCS, and install it in the other host. This works. But the problem is the Primary application server, because if we uninstall it, when insttall in the other host with the option "System Copy" the sapinst promts for the installation export.
    In the Marketplace i could not find any note form aour scenario.
    Do you know a way to separate de CI and the PAS from de database server without a system copy?
    Thanks and best regards.

    Hi
    http://scn.sap.com/community/netweaver-administrator/blog/2013/12/04/why-splitting-off-the-ascs-from-pas
    This link might be useful
    But if you have a system based on SAP NetWeaver 7.0x, this option is not available in the 70SWPM, The only way to do that would be running a system copy of the system. Then during the target system installation, you would be able to install the new system with sepated ASCS from PAS . "

  • Flush data TDMS, programmatically saving data and retrieval

    Hi all,
    The purpose of this LabView is to simulate a DAQ&writting-to-file scenario. The first loop creates the data, within this loop, if the user pushed the write to file toggle switch, the data will be queued and then sent to a TDMS file writing loop (second loop). Finally the last loop retrieves the saved data and displays it in the scroll bar Waveform graph.
    If TDMS-OPEN VI option operation option is "open or create"; at first the program seems to work fine but if I want to run the program again, new values will be appended to the ‘first run’ values. The correct operation would be to rewrite or replace the old file and save it with new values (keep same file name). The most logical thing to do is to change the option of the TDMS OPEN to “create or replace” but this doesn’t work and the data or file is not even created.  I do not understand why this is happening.
    Thanks in advance for your help
    호아킨
    Solved!
    Go to Solution.
    Attachments:
    Waveform with optional file writting.vi ‏30 KB

    For the "False" case frame, it's fine to wire the case structure terminal to the while loop condition terminal, or just wire a "F" boolean constant to it, both way shuold work.
    To stop the VI by clicking only one stop button, I think you should use a global STOP button for all the while loops. For example, you can wire this STOP button to the loop condition terminal of your DAQ while loop, and use two local variable copies of this STOP button in the other write and read while loop. Then all the loops are controlled by the common switch, once it is clicked, the VI will stop running.
    By the way, you should configure this STOP button's properties as below dialog(Right click >> Properties), otherwise the VI might be broken because the local variable copy doesn't work.

  • Saving Gallery and iWeb from MobileMe before June 30

    How do I save my iWeb and Gallery from Mobile Me before June 30 ???

    iWeb: you don't need to save anything from the iDisk - iWeb does not open html files. Your iWeb sites are held in (user)/Library/Application Support/iWeb in a file called Domain. So even after MobileMe terminates you will still be able to open iWeb and see your sites, you just won't be able to publish them to MobileMe. You can publish them to any other webspace - please see this page:
    http://rfwilmut.net/migrate2
    Gallery: if your albums arre synced with iPhoto or Aperture then the pictures are on your Mac anyway. If not, and you don't have local copies (which is always a risky procedure) you will have to download each picture separately. Alternatively there is an online photo gallery service called ZangZing which provides an easy import facility from various other services including MobileMe's Gallery. It's free until June 2012 after which the first 2GB is free with escalating price levels starting at $5 per month or $50 a year.

  • Where is the binary data of this icon stored and retrieved from Application server?

    Hello guys,
    Today I observed one phenomenon and could not explain it per my knowledge.
    I have one url which points to an icon in application server:
    https://<host name>:44301/sap/public/bc/ur/nw5/themes/sap_corbu/common/libs/Icon/SuccessMessage.gif
    I could successfully open it via chrome:
    and after that I could see an entry in ICM server cache. Everything works perfectly.
    Then I tried to check this icon in mime browser in SE80. To my surprise, the folder /sap/public/bc/ur/nw5/themes is empty.
    However, the ICM cache shows that there is a subfolder called "sap_corbu" under "themes" folder. But why I cannot find it in mime browser?
    Then I write a report to retrieve the binary data of icon via CL_HTTP_CLIENT, and clear the ICM buffer via tcode SMICM.
    I expect this time some database table will be queried to load the content of the icon, since now the buffer is not available.
    To my surprise again, in SAT no database table is involved.
    So now I am confused: since I have already cleared the ICM server cache, where does the icon binary data come from when I run the report to access the icon?
    Best regards,
    Jerry

    Hello guys,
    one colleague today told me that there is a zip file "ur_mimes_nw7.zip" in MIME repository /PUBLIC/BC/UR/ur_mines_nw7.zip. I download it locally and unzip it and indeed find many theme folders including sap_corbu folder and its resource files. So I guess there must be some logic done in web application server which will unzip this archive file and put each theme folder to the corresponding folders in application server. I would assume those logic are done outside ABAP stack side, this is the reason I cannot find any hint of them in ABAP backend via tcode SAT even I clear both client and server side cache.
    Best regards,
    Jerry

  • How to convert an output retrieved from database to an excel sheet?

    Hello friends,
    I am preparing an online JSP based project for our training and placement department.
    In this context, I am showing an output into a JTable format to the user for the shortlisted candidates by retrieving this information from my database (MySQL).
    Now I need to convert this output into the Excel Sheet so that I can perform various operations over there.
    So, what are the things required to perform from my side for implementing the same.

    The easiest thing for you to do would be to save it as CSV (Comma Separated Values). In general, your fields would be separated by commas, and any fields that are not numbers would be surrounded with double quotes:
    1,"text",...
    Dates and times are semi-tricky, but excel is pretty good about accepting "YYYY/MM/DD" and "HH:MI AM" format.
    Other than that, you'll be learning the internal structures of Excel or perhaps there is a third-party library that can do this for you...

  • Display Videos retrieved from Database?

    Hi all,
    I am trying to display videos from my database, does anyone know how to do this? I would like to display the video on my jsp page. I have no problem retrieving it but how do i get it to have a player for example like embedding a video from Youtube. Any suggestions? Thanks!

    Well it doesn't work as the video which you are retriving from the database is not in SWF / FLV or any shockwave supported format.
    Well if i were given a similar situation i'd solve it by the below stratergy.
    1).I'd Query my database and i'd get some metadata about the video like
    (videoId interger(5) PK,videoName varchar(50) not null,isYouTubeVideo varchar(1) not null,youTubeVideoUrl varchar(200),videoMimeType varchar(40) not null)
    2).On a basic grounds i'd apply a small display logic if the video is a youtube video( as youtube simply converts the videos into FLV format with a high compression ratio) or if the video's MIME type is video/x-flv (FLV's mime type) lets simply use youtube's standard embeding feature and render the JSP accordingly else use Media Player's embeding feature and render the JSP accordingly.
    jsp code snippet
    eg:*
    <jsp:useBean id="videoBean" class="com.myapp.entity.VideoBean" scope="request"/>
    <c:choose>
       <c:when test="${videoBean.YouTubeVideo == 'Y' || videoBean.videoMimeType == 'video/x-flv'}">    
              <object width="425" height="344">              
                   <c:if test="${videoBean.videoMimeType == 'video/x-flv'}">
                        <param name="movie" value="fileServlet?fileId=${videoBean.videoId}"/>
                        <param name="allowFullScreen" value="true"/>
                        <embed src="/fileServlet?fileId=${videoBean.videoId}" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"/>
                    </c:if> 
                   <c:if test="${not empty videoBean.youTubeVideoUrl}">
                        <param name="movie" value="${videoBean.youTubeVideoUrl}"/>
                        <param name="allowFullScreen" value="true"/>
                        <embed src="${videoBean.youTubeVideoUrl}" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"/>
                    </c:if> 
              </object>
       </c:when>
       <c:when test="${videoBean.videoMimeType == 'application/x-Shockwave-flash' || videoBean.videoMimeType == 'application/futuresplash'}">
              <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="425" height="344">
                    <param name="quality" value="high"/>
                    <embed src="/fileServlet?fileId=${videoBean.videoId}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="425" height="344"/>
              </object>
       </c:when>
       <c:otherwise>
               <OBJECT ID="MediaPlayer" WIDTH="425" HEIGHT="344" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" STANDBY="Loading Windows Media Player.." TYPE="application/x-oleobject">
                      <PARAM name="FileName" value="${videoBean.videoName}"/>
                      <PARAM name="autostart" value="false"/>
                      <PARAM name="ShowControls" value="true"/>
                      <PARAM name="ShowStatusBar" value="false"/>
                      <PARAM name="ShowDisplay" value="false"/>
                     <EMBED TYPE="application/x-mplayer2" SRC="/fileServlet?fileId=${videoBean.videoId}" NAME="MediaPlayer" WIDTH="425" HEIGHT="344" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"/>
               </OBJECT>
        </c:otherwise>
    </c:choose>
    NOTE: I have taken an example of embeding media player as an alternative player in this example however as Balusc explains it is on you to choose an alternative player which can fit your client's requirement or the browsers which he uses.
    Hope,that helps you out :)
    REGARDS,
    RaHuL

  • JSP: Data retrieval from database

    Hi Everyone...
    I know that inorder to extract a value from a database and output to the screen the syntax will be
    <%= rst.getString("DeliveryID")%>.
    But what if I want to extract the value from the database and instead of outputting to the screen, I want to assign it to a variable I have declared.
    I tried the following but it did not work:
    <% String name = request.getString("DeliveryID"); %>.
    I hope someone can help me out in this.
    regards
    BabyJava

    Hi Guys...
    Really thanks for the advice, I guess you guys are right. But it's too late for me to change anything now so I am more or less stuck with the existing design. I have got one new problem though.
    I want to update all values of a table at once and this is the SQL statement I used, but it's not working. I guess the problem could be with the way I am using the wildcard. Here is the code:
    String query = " UPDATE Customer SET CustomerID = '"+CustID +"'," +
                           " CustomerName = '"+CustName+"', CustomerPassword = '"+CustPassword+"', " +
                           " CustomerType = '"+CustType+"' , CustomerAddress = '"+CustAddress+"' ," +
                           " CustomerHandphone = '"+CustHandphone+"'" +
                           " WHERE CustomerID LIKE 'C%' ";
                           I am getting a general error. Is there anything wrong with my code??
    regards
    BabyJava

  • Web application security. Getting username and password from database

    Hi!
    I need to write the following web application (I write it using java server faces):
    1) User enters his username/password on the login page
    2) Program goes to database where there are tens of thousands of usernames/passwords, and verifies it.
    3) If user and password exist in DB, user gets access to the other pages of the application
    Maybe I don't understand some point. I tried to use j_security_check(it's very easy to configure secured pages in web.xmp). The problem is that it works(as far as I understand) only with roles defined on server before the application runs. I can't add ALL these usernames to the roles on server. The best way, as I see it, is to go to DB, check username/password, create new role for the time of session, go to j_security_check where the j_username and j_password get the values from db and get the access to secured pages(as far as the roles have been dinamically added).
    Am I right and this should be the algorithm?
    How can I implement it?
    I've read about JAAS. How can it help to solve the problem? Do I need j_security_check if I use JAAS? How should I configure my application if I use it?
    Could you please give me some code example?
    All this must work on IIS (for now, I develope it in Netbeans and run it on Java Application Server)
    Please help.
    Edited by: nemaria on Jul 7, 2008 2:39 AM

    Hi,
    Any security constrained url pattern which calls the action j_security_check passes the parameter to the realm mentioned in the server.xml.If the realm is set as JAAS,then the authenticate method of the jaasrealm does the basic validation like non empty field value from the input form.The appname set as the realm parameter points to the one or more loginmodules which has the life cycle methods like initialize(...),login(),commit(),abort() and logout().Once the basic validation is done in the JaasRealm class of the webcontainer,the LoginContext is created and user is autheticated (against DB username/password) via the login().Then the user is authourised in the commit().Then Jaasrealm takes care of creating the LoginContext,calling login(),creating Subject with principals,credentials added and setting that in the session.
    I have a big trouble in accessing the HttpServletRequest object in the LoginModules.i.e getting the j_username and j_password in the LoginModules or in the CallBackHandlers.PolicyContext doesn't work for me.Is there any other way?
    Regards,
    Ganesh

Maybe you are looking for