Help with servlet controller

lets say I wanted to build a login function. The function needs to
1) validate the form
2) check the database to see if the u/p matches
3) return the user to the next step
What is the most efficent way to do this.
login.jsp -> package.FormValidate(servlet) ->check.jsp -> package.DBCheck(servlet) -> check.jsp -> succeed.jsp
or should their be one controller servlet which is called by the jsp page. The controller servet then calls the package.FormValidate servlet then the controller servlet calles the package.DBCheck servlet) then then controller servet send to either fail.jsp or succeed.jsp
Do you see what I mean? When I build a logical function ,should jsp call each servlet or should their be a main "controller" servlet?
thanks

Use Struts to solve all these issues and let struts do the work for you...

Similar Messages

  • Help with Servlets!!

    Hi all,
    I need help with Java and Jsp. Here are the specs:
    1. An HTML web form that contains info about a customer: name, address, telephone number.
    2. When the "Submit" button is clicked, the information will go directly into an Oracle database table named "customer".
    Where should I start?? So far, I have created the HTML web form. So what i need is to write a servlet that will take the data from the web form and insert that into the Oracle table. If you have any solutions to my problem, please let me know. Thanks a lot in advance.

    <%@ page language="java" import="java.sql.*" %>
    <html>
    <head>
    <title>
    Customer
    </title>
    </head>
    <body>
    <%!
    java.sql.Connection con;
    java.sql.PreparedStatement pstmt;
    java.sql.ResultSet rs;
    javax.servlet.http.HttpServlet request;
    String name,address;
    int phone;
    int i;
    %>
    <%
         try {     
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = java.sql.DriverManager.getConnection
    ("jdbc:odbc:<DSN name>","scott","tiger");
    %>
    <% } catch(Exception e){ System.out.println(e.getMessage()); } %>
    <%
    name = request.getParameter("name");
    address = request.getParameter("address");
    phone = Integer.parseInt(request.getParameter("phone"));
    pstmt=con.prepareStatement("insert into <table name> values(?,?,?)");
    pstmt.setString(1,name);
    pstmt.setString(2,address);
    pstmt.setInt(3,phone);
    i=pstmt.executeUpdate();
    %>
    </body>
    </html>
    1. create a dsn connecting oracle, using ODBC from control panel
    2. name the text fields in the html page as "name","address","phone"
    3. enter the table name you created in oracle in place of <table name>
    I hope this should work , let me know .......
    bye
    vamsee

  • Help with servlet

    I have a project with servlets in the 2 following folders
    myprojects and myclasses
    In my projects I have the helloProject and inside it I have the helloHtml folder and the helloPackage.
    So in the helloHtml folder I have the hello.html file and in the helloPackage I have the Hello.java (which is the servlet)
    when I compile this .java file the class file is inserted in the file myclasses\helloProject\helloPackage
    First in the file hello.html I have the code
    action="http://localhost:8080/servlet/helloPackage.Hello
    and so the servlet is executed fine.
    The problem is that I need to put a button in the code of Hello.java
    so that I can have reloaded the first page which is the hello.html
    But I am confused if I write onclick=history.go(-1) I have what I want but this page is not reloaded so I have some parameters there that I do not want
    Can I write sth like onclick=location.href=http://locahost:8080/.....??
    Could you please give me an advice considering the above description of my files??
    Thank tou very much....

    use sendRedircet(String AbsoluteURL) to send the Browser a redirect header so the browser send a new (fresh) request to the serlvet (with any parameter you specified).

  • Need some help with a controller module

    i have a controller module with a model # of CA1009. i've been trying to track down a configuration manual online but haven't had any luck. what i'm trying to determine is whether or not this particular model supports a fiber connection.
    here are some other specs:
    part #: 603-6332
    number above part #: KC62706LS9UA
    thanks for the help!

    Not sure what you're looking for here; supports a fibre connection? The 603-4406 CA1009 is the Apple Xserve RAID Controller Module, a component of the [Xserve RAID|http://manuals.info.apple.com/en/xserveraid_userguide.pdf]; it's the drive-facing part of the "whole show" within the SAN controller, and not part of the side "facing" the FC SAN.

  • Need Urgent Help with Servlets!!!

    I was just assigned a java project few days back and the thing is that i noe nuts abt JAVA!!! My first time and i admit i'm a slow learner.
    I was tasked to develop a servlet for web based query of inventory status in FIFO storage from QIS database.
    Basically, i heard according to my supervisor that this is a very simple project that may be completed in just days..but as i said this is my first Java program and i really need u guys to help me!!!! I have no idea how to start the entire coding process.
    The main page where the option buttons are is actually a form. This program have a HTTP extension i think. Below i have indicate the System and User Requirements.
    System Requirements
    * A Servlet
    * 2 option buttons
    * 1 for retrieving a Summarised Report
    * 1 for retriveving an Detailed Report
    * 1 command button for retrieval of data
    * Retrieved data will be displayed on another frame
    User Requirements
    * Be able to view Summarised Report at a click of a mouse
    * Be able to view Detailed Report also at a click of a mouse
    PLS HELP!!!!!!!!

    Justa comment...
    << according to my supervisor that this is a very simple project that may be completed in just days
    If your supervisor is so confident, then, maybe he/she should just get it done himself/herself. I really mean it. However, if that does happen, he/she should provide post-implementation support himslef/herself.
    In the meanwhile you can continue thinking about doing it the right way. Which is to first get some grasp of sorts about the various Java and other technologies and concepts you are talking about. Then have some kind of plan and follow it.
    I think at the end both you, and more importantly, your supervisor would see the difference in the result with respect to quality of work.
    Forums such as these provide an excellent wealth of information mostly because they are a means to consolidate knowledge gained by individuals from their past experience.
    However, in my opinion, it would be wrong to expect that one would be able to design and implement a real-life application just from information gathered from such forums. An example problem if you do it that way is: who will provide guaranteed support if something does not work in your real-life application. Your supervisor ?
    Instead, do the study part systematicaly. Try to convince your supervisor that thats the way to do it. Then do it. And come back with specific problems you might have.
    Best luck.

  • URGENT please help with servlets

    am using Jbuilder 3 and there is no servlet classs to import .imported JSDK and the javax files. but it keeps saying my class does not extend http servlet any ideas!!

    I've used JBuilder3 a few times and as far as I remember the default Target jdk (version 1.2) cannot be changed or ammended and so you can't really import javax.servlet stuff.
    Go to project -> properties.
    You probably just need to define a new jdk version call it "JDK 12 Servlets" or something. It'll prompt you most of the way and then you just need to edit the Class path and add the javax stuff.
    Alternatively you can just save the file with jbuilder and do the compiliation from the command line.
    Hope this helps.

  • Help with Servlet-RMI

    I am planning to write a servlet which communicates with another java processes via RMI. This is necessary because the java process will act as a server serving requests from the servlet which will pass results to the client. I am new to RMI and would appreciate very much if anyone can direct me to some examples, docs or recommend books (even better) which might help..........
    many thanks in advnace

    Hi DevMentee (nishil?)
    First many thanks and I am new to RMI and I did look
    at Sun and JGuru's RMI stuff on the web(good on theory
    but short on real world examples like stockquoteserver
    etc..).Perhaps these Web pages contain the type of examples you are looking for (assuming you are unfamiliar with them)
    http://www.javaworld.com/isearch?qt=RMI&x=56&y=11&site=javaworld&ms=1&tid=1&st=1&rf=0
    http://www.fawcette.com/Archives/premier/mgznarch/javapro/1998/jp_nov_98/th1198/th1198.asp
    http://www.fawcette.com/Archives/premier/mgznarch/javapro/1998/jp_febmar_98/rk0298/rk0298.asp
    Yours links they will be very helpful...is
    there a particular site you would recommend for
    examples etc?Personally I liked Dick Baldwin's tutorials, but each person is different -- that's why I gave a variety of resources. Hopefully one of them will be good for you.
    MY servers are in C++ on NT implemented using MS
    stuff, so perhaps CORBA would not be possible, but
    perhaps I can access using COM which could be easier
    than JNI...I remember seeing mention of a third-party COM-java bridge library, but I can't give you any details, sorry :-(
    ALSO, I have one more question :-)
    Is it possible to run multiple RMI servers (processes)
    on the same machine? if so what would happen if
    multiple requests came thru using same port and host
    name....I haven't tried it myself. My guess is that it's possible. Why don't you just try it and see?
    Good Luck,
    Avi.

  • Help with servlet and JSP

    I am creating a web application that allows users to submit questions and answers to a database. The users can also specify a number of questions and take a randomly generated test from the questions that have been submitted to the database. Currently, I am having trouble figuring out how to generate the test and then grade it. I was thinking I would use a question page that displayed a random question and its answers, allowed the user to answer the question and submit it, and then have the page reload with a new random question from the database. After the user has answered the number of questions they specified, then it would go to a results page with the percent and grade. I'm having trouble figuring out a servlet for the test generation. Any help would be much appreciated.
    Thanks, Mike
    [email protected]

    Please provide more information on exactly what the problem you are having is.
    For example: The following sentence you provide doesn't really say what the problem is:
    " I'm having trouble figuring out a servlet for the test generation."

  • Help with wireless controller and VLANs

    Hi I'm trying to setup a wireless controller in preparation for a large site go live later this year. I'm struggling to get the controller and the WLAN using the correct VLAN. I want the controller on VLAN 100 and the clients on the WLAN on VLAN 200.                 
    My thought is that I would need a config similar to:
    Switchport for wireless controller management port set to trunk VLAN 100 and 200 with no native VLAN set.
    The management interface on the controller set to VLAN 100.
    A dynamic interface created on VLAN 200.
    When setup like this I can get to the controller on its management address but only from VLAN100 not from another VLAN on site or from other sites over the WAN.
    I have setup a WLAN which is set to use the dynamic interface on VLAN 200.
    I have set the AP to use HREAP and set the native VLAN as 200 and added the dynamic interface into the VLAN mappings
    When I connecting a client to the WLAN I get an address on VLAN 100.
    The switchport for the AP is set to native VLAN 100 and trunk 200 – this setup works for standalone APs at other sites.
    What am I missing?
    Also any idea why the management interface address is not routing? The netmask and gateway are set correctly.
    Thanks
    Paul

    Just to add to Steve's post... You only need to create a dynamic interface for vlan 200 if you have ap's also in local mode.  If your ap's are in H-REAP/FlexConnect mode, you don't need a dynamic interface for vlan 200.
    In you H-REAP/FlexConnect ap, you would set the wlan to vlan mapping there and the switchport configuration would be a trunk allowing vlan 100 (im assuming your native vlan for your ap) and vlan 200.  You should see something like the following:
    Thanks,
    Scott
    Help out other by using the rating system and marking answered questions as "Answered"

  • Help With Servlet & SQL

    I'm working on a project for my Java class and I'm running into trouble with the JDBC section. My project is laid out as follows:
    This project consists of a HTML page, a servlet, and a database. I have already wrote up the code for the interaction between the login page and the servlet, however, I cannot figure out how to use java to interact with a Microsoft Access database.
    I'm trying to call to a method (which has the coding for JDBC & SQL) by calling to it through the doPost method. The program refuses to go to that method. I'm not sure if it's a syntax error or if it's not even allowed in Java. I think I've narrowed the problem down to this line:
    String user = getUser(username, password);
    getUser is the method I was refering to in the previous paragraph. When getUser as it's own class, without dealing with paramters, it works fine. When I calling it with parameters, it doesn't seem to work. It will not even return a string when I call it. If you need the getUser code, I can provide it.
    I hope I am being clear, if not please let me know. Thanks in advance for any help you can provide. It is much appreciated.

    I'm trying to call to a method (which has the coding
    for JDBC & SQL) by calling to it through the doPost
    method. The program refuses to go to that method. I'm
    not sure if it's a syntax error or if it's not even
    allowed in Java. I think I've narrowed the problem
    down to this line:
    String user = getUser(username, password);
    getUser is the method I was refering to in the
    previous paragraph. When getUser as it's own class,
    without dealing with paramters, it works fine. When I
    calling it with parameters, it doesn't seem to work.This the part that is a little confusing.
    You should always be able to call a method. The method may not return anything, but if the method exists and you supply the correct parameters, you can call it, or as you put it, "go to it". I.e.,
    public void doGet( HttpServletRequest request,
                       HttpServletResponse response ) {
       ... // some code that defines the output stream as "out"
       out.println( "The user's name was " + getUser( username, password ) );
    }Would work. You've "gone to" the method.
    That is a completely seperate problem from the getUser() method not working when you provide parameters. I suspect getUser() isn't working because you either provide the incorrect parameters, or you're expecting the wrong return value.
    This is one of those examples when being able to see your code would really help.
    However, I can make a guess... You've defined the function as:
    String getUser( username, password ).
    I would guess getUser() takes the username expressed as a string, the password expressed as a string, and returns what... the username as a string? In which case, why do you need getUser()?
    Another possibility is that Microsoft Access isn't really a multi-user application, I don't think it requires you to log in and present your credentials (the password). That may explain why it works when you call getUser() without any parameters.

  • Need help with servlets!!!

    Hi, I'm a beginner in Oracle and Servlets. So far I was able to make a servlet which could run a query to an existing table of an oracle database and return this data in an HTML form generated by that same servlet.
    I need some help on making a servlet that can accept user input and make an insert into that same existing table.
    null

    I suggest you break up the problem into manageable sub projects and solve each one in isolation. First, create a 'hello world' servlet. Search google for examples. Here is one problem with your code: if WelcomeServlet3 is in a package called 'myServlets, then you would use something like this: <servlet-class>myServlets.WelcomeServlet3<;/servlet-class> in the web.xml file.
    Next, is your database connection: I suggest you create a database connection in a class with a 'public static void main(String[] args) method to call it. Have the configuration data within the class. Dont get it from an xml file. This way, you can run it stand-alone by right clicking on the class and choosing 'run as application' and therefore ensure it works.
    Next go to the tomcat home page and read up on how to configure a database in tomcat by putting the configuration data in an xml file. Make sure you're reading the about the version of tomcat you're using. For all versions of tomcat, its something like this: If your web application is called 'myWebProject', then there should be an configuration xml file called 'myWebProject.xml' that goes under one of the tomcat sub folders. You use JNI to get the configuration data out of that xml file to configure the database. There is no database configuration data in the web.xml file.

  • Help with Servlet Addressing

    I'll never, ever, as long as I live ever figure out where to put JSP stuff in my directories.
    in my tomcat I have an examples directory with a helloworld servlet...
    C:\jakarta-tomcat-4.1.12\webapps\examples\WEB-INF\classes\HelloWorldExample.class
    that I can access from my browser at URL...
    http://localhost:8080/examples/servlet/HelloWorldExample
    I've created a new directory on my tomcat to hold the website I want to develop...
    C:\jakarta-tomcat-4.1.12\webapps\dumfries
    In it I have copied the HelloWorldExample.class file so that it sits at address...
    C:\jakarta-tomcat-4.1.12\webapps\dumfries\WEB-INF\classes\HelloWorldExample.class
    But, after stopping/restarting the server I go to url
    http://localhost:8080/dumfries/servlet/HelloWorldExample
    I get "The requested resource (/dumfries/servlet/HelloWorldExample) is not available."
    The paths to the HelloWorldExample.class files in "examples" and "dumfries" are identical below the parent directory...
    C:\jakarta-tomcat-4.1.12\webapps\examples\WEB-INF\classes\HelloWorldExample.class
    C:\jakarta-tomcat-4.1.12\webapps\dumfries\WEB-INF\classes\HelloWorldExample.class
    And the url's follow the same address structure...
    http://localhost:8080/examples/servlet/HelloWorldExample
    http://localhost:8080/dumfries/servlet/HelloWorldExample
    but one works and the other doesn't!!
    WHY WHY WHY WHY (sound of hair ripping out) WHY WHY WHY

    Don't pull your hair out! The stress will make it fall out by itself!
    Besides, your answer is at your question in the other forum:
    http://forum.java.sun.com/thread.jsp?forum=33&thread=357756
    Also, check out some working code:
    http://forum.java.sun.com/thread.jsp?forum=45&thread=357607

  • Help with ethernet controller​?

    Hi all! I recently formatted my HP Pavilion a1010y and reinstalled the OS. I went to go reinstall the drivers offered on the website, but it's lacking an ethernet controller driver! I can't seem to find it anywhere. I even managed to find out what kind of motherboard is in the computer but even then, no luck. The Hardware ID's on the controller are:
    PCI\VEN_8086&DEV_27DC&SUBSYS_000C1331&REV_01
    PCI\VEN_8086&DEV_27DC&SUBSYS_000C1331
    PCI\VEN_8086&DEV_27DC&CC_02O0OO
    PCI\VEN_8086&DEV_27DC&CC_02O0
    Hard to read the font on the computer, Some look like O's and some look like 0's (Oh's and Zero's). Hope it's not too confusing! Please help! Thanks!
    This question was solved.
    View Solution.

    For Windows XP
    For Windows Vista
    For Windows 7 (information only) drivers are "In the Box"
    Please send KUDOS
    Frank
    {------------ Please click the "White Kudos" Thumbs Up to say THANKS for helping.
    Please click the "Accept As Solution" on my post, if my assistance has solved your issue. ------------V
    This is a user supported forum. I am a volunteer and I don't work for HP.
    HP 15t-j100 (on loan from HP)
    HP 13 Split x2 (on loan from HP)
    HP Slate8 Pro (on loan from HP)
    HP a1632x - Windows 7, 4GB RAM, AMD Radeon HD 6450
    HP p6130y - Windows 7, 8GB RAM, AMD Radeon HD 6450
    HP p6320y - Windows 7, 8GB RAM, NVIDIA GT 240
    HP p7-1026 - Windows 7, 6GB RAM, AMD Radeon HD 6450
    HP p6787c - Windows 7, 8GB RAM, NVIDIA GT 240

  • Need help with Audio controller or cue points

    Haven't set up the actual project yet. Just trying to
    determine best method. Will be using Flash Pro 8.
    Goal: create an initial page showing a TOC that represents
    chapters in an hour long audio piece. Clicking a topic brings them
    to a certain point in the audio. Once leaving the TOC, the user
    will see a still PPT jpg associated with that section of audio. But
    they'll also need access to an audio controller so they can scrub
    to different portions of the audio. Once they let up, the PPT image
    needs to change -- if they went to a different section.
    So at first I thought about a regular flash set-up with the
    audio spanned throughout the timeline, PPT images set-up throughout
    the timeline, and frame labels to jump to. But I couldn't figure
    out how to set up an audio controller with this set-up.
    Then I thought about a Flash Slide Presentation set-up using
    a Media Playback component with the Media Controller component and
    cue points. I've looked at some of the on-line examples of this and
    they seem to work when playing forward but I notice that when you
    scrub backwards that the images fall out of synch. It seems if you
    have cues A, B and C and if you begin dragging from the C cue and
    let up BEFORE the B cue the image displays B. It should be
    displaying A though since your somewhere in-between A and B. But A
    doesn't show unless you scrub back far enough to cross the A cue
    time.
    So what is the best method. It seems the latter if there was
    only a way to calculate the time between the two cues. For instance
    "if time is >A but <B then display A".
    But the first example with the long timeline and frame labels
    would be fine if there was a nice controller out there that I could
    implement.
    And remember I need to be able to jump to any spot in the
    audio clip from the TOC menu on the first screen.
    Thanks!

    Is it AVCHD, Mini-DV, or DVD?  What format does the camera record to?

  • Help with Servlet and Unix Commands

    Hello,
    I want to write a Java Servlet that runs some Unix commands on the system..
    Any guidelines? A really small and simple java servlet example that runs "ls -la" for example and outputs the results would be great...
    Any help would be greatly appreciated :)
    Thanks in advance

    You'll want to use Runtime.exec() to run Unix commands.
    Why can't you just get this out of java.io.File.listFiles()? What's ls really doing for you here?
    If you insist on using Runtime.exec(), you'll want to read this:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    MOD

Maybe you are looking for

  • SSO from Microsoft wabsite to SAP Portal

    Hi My client wants SSO from .net based Microsoft website to SAP Portals. Requirement is that when customer enters the website e.g. www.mysite.com , he will be automatically gain access (SSO) to  SAP Portal . How it can be done ? Please help Thanks in

  • How to disable the option of "Overprint [Black] Swatch at 100%" in Indesign by Apple Scripting

    Hi Friends, I am new to Indesign Scripting by Apple Script. As a beginner, I am trying to do some basic scripting in Indesign by Apple Script. My aim is to disable the option of "Overprint [Black] Swatch at 100%" in Indesign. This option is available

  • Why can't I leave group messages with iOS 8?

    I updated my 5c to iOS 8 but I'm not able to leave group messages. I click under the Details for the group message but it doesn't present an option to leave.

  • Budget for Purchase requisition

    Hi everybody, Is there anyways that a budget can be done for balance sheet items? Scenario: Each and every purchase requisition raised should check for the available budget. Budget can be done for the P&L items through internal order likewise is ther

  • Installation Adobe Document Services

    Hi all, I have a WebAS 6.40 SP14 on my local machine and wanted to test Adobe Interactive Forms. So I followed the steps Achim Hauck provided in his blog (/people/achim.hauck/blog/2005/02/04/my-struggles-with-the-adobe-document-services-in-was640). I