Need code help in jsp:forward ... /

Can any one give a little code as to how am i suppose to redirect my jsp execution with <jsp:forward../> tag.
Give a little code of JSP file. i have tried with 2-3 examples but i could not do it. Certainly some wizard will help me doing this.
Thanx in advance.
husami

its fine. i have understood your code. i have even tested with param attribute.
Earlier i was using JWS2.0 now i have shifted to tomcat. it gives me problem to run jsp file. what could be the reason? servlets are running fine.
is there any path or classpath setting probs
or do i have to execute some other files of tomcat
or do i have to use jspc with some options?.......
please help
husami

Similar Messages

  • Help with JSP Forward !!!

    I have 3 pages ...1) index.jsp 2) Forward.jsp 3) welcome.jsp
    I have 2 fields in the index.jsp once upon filling & hit submit it has to to go Forward.jsp page...in the Forward.jsp..i have coded only one tag with
    <jsp:forward page="welcome.jsp" />
    I have one question...once the page comes to Forward page...will it display the contents of the Welcome .jsp in the same page itself...or it will go to Welcome.jsp page..
    As i saw it will display the contents of Welcome.jsp page in itself...
    Please let me know...
    Regards
    Gnanesh

    I understand your question only because I have a set up totally identical to yours. The thread Matt suggested does explain the situation (i.e. the server passed control to another page but the client doesn't know that), but doesn't necessarily give a good solution a problem that you may have, and that I do have:
    If the user sees the welcome page, and for some reason decides to "reload", the forward page is re-executed, even though it has done its job. This could be a problem for session management if you specifically don't want that job being done twice in a session. Now you could hack around that, but I'd really rather see a neat solution. Is there one?

  • Need serious help with JSP + JDBC/Database connection

    Hey all,
    I have to build an assignment using JSP pages. I am still pretty new and only learning through trial and error. I understand a bit now, and I have managed to get a bit done for it.
    I am having the most trouble with a Login Screen. The requirements are that the a form in a webpage has Username/Number and Password, the user clicks Login, and thats about it. The values for the username/number and password NEED to come from the database and I cannot manage to do this. The thing I have done is basically hardcode the values into the SQL statement in the .jsp file. This works, but only for that one user.
    I need it so it checks the username/number and password entered by the user, checks the database to see if they are in it, and if so, give access. I seriously am stuck and have no idea on what to do.
    I dont even know if I have made these JSP pages correct for starters, I can send them out if someone is willing to look/help.
    I have setup 3 other forms required for the assignment and they are reading data from the db and displaying within tables, I need to do this with non-hardcoded values aswell. Im pretty sure I need to use for example 'SELECT .... FROM .... WHERE username= +usrnm' (a variable instead of username="john" , this is hardcoded), I just CANNOT figure out how to go about it.
    Its hard to explain through here so I hope I gave enough info. A friend of mine gave some psuedocode i should use to make it, it seems ok to follow, its just I do not know enough to do it. He suggested:
    get the username and pass from the env vars
    open the db
    make an sql (eg SELECT user, pass FROM users WHERE user = envuser)
    index.jsp points to login.jsp
    login.jsp get the vars you put into index.jsp
    opened the db
    is the query returns nothing - then the user is wrong
    OR if the passwords dont match
    - redirect back to index.jsp
    if it does match
    - set up a session
    - redirect to mainmenu.jsp
    Anyway, thanks for any help you can give.
    -Aaron

    Hi,
    Try this... it may help you...
    mainMenu.jsp
    <html>
    <body>
    <form method="POST" action="login.jsp">
    Username: <input type="text" name="cust_no">
    <p>
    Password: <input type="password" name="password">
    <p>
    <input type="submit" value="LOGIN">
    </form>
    </body>
    </html>
    login.jsp
    <%@ page import="java.io.*, java.sql.*"%>
    <html>
    <body>
    <%
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection connection = DriverManager.getConnection("jdbc:odbc:rocky");
    Statement statement = connection.createStatement();
    String query = "SELECT cust_no, password FROM customers WHERE cust_no='";
    query += request.getParameter("cust_no") + "' AND password='";
    query += request.getParameter("password") + "';";
    ResultSet resSum = statement.executeQuery(query);
    if (request.getParameter("cust_no").equalsIgnoreCase(resSum.getString("cust_no") && request.getParameter("password").equalsIgnoreCase(resSum.getString("password"))
    %>
    <h2>You are logged in!</h2>
    <%
    else
    %>
    <h2>You better check your username and password!</h2>
    <%
    }catch (ClassNotFoundException cnfe){
    System.err.println(cnfe);
    }catch (SQLException ex ){
    System.err.println( ex);
    }catch (Exception er){
    er.printStackTrace();
    %>
    </body>
    </html>
    I didn't check the code that I wrote. So you may have to fix some part of it. Also this may not be the best solution, but it will help you to understand the process easily.
    The more efficient method is to check whether the result set returned from the database is null or not.... I hope you got the idea... Good luck!
    Rajesh

  • Need Code Help In Dreamweaver CS4

    I still just a beginner at Dreamweaver and don't know enough about coding yet. But I am working on a project that I am stuck on. It's an e-newsletter that I created using 3 columns in Dreamweaver CS4. Here is a link that I posted to my personal site for all to view.
    http://www.marketingintelligence.bz/COH_Newsletter.html
    Hopefully someone can give me a reason why the middle column is below the rest the left and right columns. Of course it looks great in Dreamweaver so I figure it's gotta be something in the code or perhaps the CSS file. Since I am so new I don't know where to start. Any help would be greatly appreciated. Thanks!
    P.S. I attached a screen shot from my Dreamweaver file to show everyone that how it looks on my screen.

    Thank you. I figured that out after I posted the question and jumped back into the file. I really need to get deeper into coding and HTML. CSS I get pretty well. I think a semester long class on HTML is in store for me this fall.
    Thanks again!

  • Help in jsp:forward

    Hi
    I am forwarding a request from my Servlet to a Jsp using Requestdispatcher class.From that Jsp i want to forward the request to some other servlet on Clicking a Button. I dont want to put it in form action.I want to again forward the request to some other servlet.
    Help in this.
    Thanx

    Sounds like you're going to want to use the session to store your objects. The request object will only persist when you forward from one page/servlet to another, but once you display a page to the browser it is lost. A new request will be sent when the user clicks on your button.
    So use the session :)
    -Derek

  • Need a help in jsp

    hello all:
    i try to make an dynamic page by using jsp
    i used tomcat4.6.1 as an application server and jdk 1.4
    and i used DreamweaverMx to do this development
    when i used an access database as an tutorial and when i make an jdbc connction to this database it give me an error massege this massege is:
    "while executing getComponentchildren in connections.htm the following JavaScript erros(s) occurred:
    at line 65 file "c:/marcomedia\DreamweaverMx\configuration\component\common\connections\connections.js"
    exception throw in native function"
    and when i try to make an asp pages the connection is working without any error
    this error is just display when i try to make an jsp pages
    another question i want to know if there is any configuration can i make for the application server in dreamweaver
    so plz can u tell me where the problem is
    thankx

    I would suggest getting the database connection working outside of Dreamweaver. Once it's working, then just "include" the file that makes the connections.
    What exactly does your connection code look like?

  • Need code help to make website work

    I am using Flash CS3 (ver 9.0)
    Any help with this would be greatly appreciated.
    I am creating a flash website and have all of the content in
    one file with multiple layers and separate movie clips inside scene
    1. I have a movie clip for the home page, a separate movie clip for
    about page... and inside each of those movie clips is where my
    content is for that page.
    I have a separate layer for labels, and a separate layer for
    actions. I am having trouble getting the actionscript to work
    correctly.
    What I want is a preloader (which I already have), then to
    have the intro/splash page play through, and at the end of the
    intro/splash page I want it to automatically go to the home page
    and stay there until the user clicks on one of the buttons to go to
    another page.
    My labels are "introPage", "homePage", "about"...
    My preloader code is: (even though it gives me a warning that
    _totalframes is no longer supported)
    if (this._framesloaded >= this._totalframes) {
    this.gotoAndPlay("introPage");
    In the second frame in my actions layer I have the code:
    this.gotoAndPlay("introPage");
    Actionscript for "introPage" is:
    stop();
    Actionscript for "homePage" is:
    stop();
    this.home_btn.onRelease = function() {
    this._parent.gotoAndStop("homePage");
    this.about_btn.onRelease = function() {
    this._parent.gotoAndStop("about");
    With the code given above the whole website just blinks
    really fast showing the content for only a second and then starts
    running through the whole cycle the same way again.
    If I remove the above code for the "homePage", except for the
    stop(); everything works fine until it's time to enter the home
    page which it does not do.
    Please let me know what I'm doing wrong with my code. And I
    know from reading other posts that it's better to have separate
    swfs for each page but I'm not sure how I would link them later if
    I did it that way.
    Thank you,
    ar

    Try the following steps, check whether things are working after each step where appropriate, before trying the next.
    Check AirPlay is turned on on the Apple TV (turn it off and on if it already is)
    Check that both devices are on the same network (Settings > Wifi, on the mobile device and Settings > General > Network, on the Apple TV).
    Restart the Apple TV (Settings > General > Restart).
    Restart the Apple TV by removing ALL the cables for 30 seconds.
    Restart your router. (Also try removing it’s power cord for at least 30 seconds)
    Restart your mobile device.

  • Need code help, please

    I am making a program where there are 3 ellipses. For two of the ellipses I want they to be able to be dragged across the screen when the mouse is pressed on them, they will also change color. For the third ellipse I want all three ellipses to move and change color when I click on it. I have the two ellipses doing what I want but I cant get a third move them all. Thanks.
    public interface Draggable
       public void setColor      (java.awt.Color aColor);
       public void setLocation   (int x, int y);
       public void mousePressed  (java.awt.event.MouseEvent XX);
       public void mouseDragged  (java.awt.event.MouseEvent XY);
       public void mouseReleased (java.awt.event.MouseEvent XZ);
    import wheels.users.*;
    public class DraggableSun extends Ellipse implements Draggable
       private java.awt.Point _lastMousePosition;
       public DraggableSun (int x, int y)
          super (java.awt.Color.YELLOW);
          _lastMousePosition = new java.awt.Point ();
          this.setLocation (x, y);
       public void mousePressed  (java.awt.event.MouseEvent mouseEvent)
          _lastMousePosition = mouseEvent.getPoint ();
          this.setColor (java.awt.Color.BLUE);
       public void mouseDragged  (java.awt.event.MouseEvent me)
          java.awt.Point currentPoint;
          int diffX, diffY;
          currentPoint = me.getPoint ();
          diffX = currentPoint.x - _lastMousePosition.x;
          diffY = currentPoint.y - _lastMousePosition.y;
          this.setLocation
             this.getXLocation() + diffX,
             this.getYLocation() + diffY
          _lastMousePosition = currentPoint;
       public void mouseReleased (java.awt.event.MouseEvent me)
          this.setColor (java.awt.Color.YELLOW);
    import wheels.users.*;
    public class Leader extends DraggableSun
       private MovableSun follower1;
       private MovableSun follower2;
       public Leader(int x, int y, MovableSun follower1, MovableSun follower2)
         super(x,y);
         this.follower1 = follower1;
         this.follower2 = follower2;
       public void mousePressed (java.awt.event.MouseEvent e)
         super.mousePressed (e);
         this.setFillColor (java.awt.Color.BLUE);
         //follower1.setFillColor (java.awt.Color.BLUE);
         //follower2.setFillColor (java.awt.Color.BLUE);
      // public void mouseDragged (java.awt.event.MouseEvent e)
         //super.mouseDragged(e);
       }Not sure if mouseDragged method in last class should be the same as the 2nd class, last class isnt finished, got lost.

    sorry, but I have gotten this far in the Leader class. It complies but all three don't move when drag the one. Any help would and I would be grateful.
    import wheels.users.*;
    public class Leader extends DraggableSun
       private DraggableSun _sun;
       private DraggableSun _sun1;
       private java.awt.Point _lastMousePosition;
       public Leader(int x, int y, MovableSun follower1, MovableSun follower2)
         super(x,y);
         this._sun = _sun;
         this._sun1 = _sun1;
       public void mousePressed (java.awt.event.MouseEvent e)
         super.mousePressed (e);
         this.setFillColor (java.awt.Color.BLUE);
         _sun.setFillColor (java.awt.Color.BLUE);
         _sun1.setFillColor (java.awt.Color.BLUE);
       public void mouseDragged (java.awt.event.MouseEvent e)
         super.mouseDragged(e);
         java.awt.Point currentPoint;
            int diffX, diffY;
            currentPoint = e.getPoint ();
            diffX = currentPoint.x - _lastMousePosition.x;
            diffY = currentPoint.y - _lastMousePosition.y;
            this.setLocation
             this.getXLocation() + diffX,
             this.getYLocation() + diffY
         _sun.setLocation
               _sun.getXLocation() + diffX,
            _sun.getYLocation() + diffY
            _sun1.setLocation
               _sun1.getXLocation() + diffX,
               _sun1.getYLocation() + diffY
         _lastMousePosition = currentPoint;
       }

  • Need code help

    Could somebody add an OK button to this code so that when it is clicked a dialog box would pop-up stating the name and which options were selected? Thanks.
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
      <applet code="Lister" width=300 height=180>
      </applet>
    public class Lister extends Applet implements ActionListener
    List os, browser;
    String msg = "";
    public void init()
       os = new List (4, true);
       browser = new List (4, false);
       os.add("Windows 98");
       os.add("Windows NT/2000");
       os.add("Solaris");
       os.add("MacOS");
       browser.add("Netscape 1.1");
       browser.add("Netscape 2.x");
       browser.add("Netscape 3.x");
       browser.add("Netscape 4.x");
       browser.add("Internet Explorer 3.0");
       browser.add("Internet Explorer 4.0");
       browser.add("Internet Explorer 5.0");
       browser.add("Lynx 2.4");
       add(os);
       add(browser);
       os.addActionListener(this);
       browser.addActionListener(this);
       public void actionPerformed(ActionEvent ae)
         repaint();
        public void paint(Graphics g)
          int idx[];
          msg = "Current OS: ";
          idx = os.getSelectedIndexes();
          for(int i=0; i<idx.length; i++)
          msg += os.getItem (idx) + " ";
    g.drawString(msg, 6, 120);
    msg = "Current Browser: ";
    msg += browser.getSelectedItem();
    g.drawString(msg, 6, 140);

    This works
    import java.applet.Applet;
    import java.awt.BorderLayout;
    import java.awt.Button;
    import java.awt.Graphics;
    import java.awt.List;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    <applet code="Lister" width=300 height=180>
    </applet>
    public class Lister extends Applet implements ActionListener
    List os, browser;
    String msg = "";
    public void init()
    os = new List (4, true);
    browser = new List (4, false);
    os.add("Windows 98");
    os.add("Windows NT/2000");
    os.add("Solaris");
    os.add("MacOS");
    browser.add("Netscape 1.1");
    browser.add("Netscape 2.x");
    browser.add("Netscape 3.x");
    browser.add("Netscape 4.x");
    browser.add("Internet Explorer 3.0");
    browser.add("Internet Explorer 4.0");
    browser.add("Internet Explorer 5.0");
    browser.add("Lynx 2.4");
    Button button = new Button("OK");
    add(os);
    add(browser);
    add(button,BorderLayout.SOUTH);
    os.addActionListener(this);
    browser.addActionListener(this);
    button.addActionListener(this);
    public void actionPerformed(ActionEvent ae)
    repaint();
    public void paint(Graphics g)
    int idx[];
    msg = "Current OS: ";
    idx = os.getSelectedIndexes();
    for(int i=0; i<idx.length; i++)
    msg += os.getItem (idx) + " ";
    g.drawString(msg, 6, 120);
    msg = "Current Browser: ";
    msg += browser.getSelectedItem();
    g.drawString(msg, 6, 140);

  • I can't use have JSP code in jsp:forward ?

    when i try to use
    <jsp:forward page="product.jsp?id=<% out.print(bid.getItemID()); %>&action=bidfail" />it dont seem to have any id value?
    i will get something like
    /AuctionProject/product2.jsp?id=<% out.print(bid.getItemID()); %>&action=bidfailhow can i have some jsp code inside the forward url? like in this case i need a item ID

    You can use run time expressions in jsp:forward, but you shouldn't use a scriptlet with out.print(...). Instead use an expression. An expression looks like <%= value to display %> instead of <% out.print(value to display) %>
    <jsp:forward page="product.jsp?id=<%= bid.getItemID() %>&action=bidfail" />See the JSP Syntax Reference at: [http://java.sun.com/products/jsp/syntax/2.0/syntaxref20.html |http://java.sun.com/products/jsp/syntax/2.0/syntaxref20.html]

  • HI, I need your help. How can I delete all data, when I do not have the special security code, which I didn´t remember ? I also think, that I never create this code before. But I cannot put my settings back.

    HI, I need your help. How can I delete all data, when I do not have the special security code, which I didn´t remember ? I also think, that I never create this code before. But I cannot put my settings back.

    You must remember the code, if you can't then take the phone and proof of purchase to an Apple Store.

  • Having problem buying online.need your help since it's my first time here.apple is asking for my billing address but when i enter my address here in qatar,it's saying i should enter a valid zip code within the u.s.does it mean i can't buy online

    having problem buying online.need your help since it's my first time here.apple is asking for my billing address but when i enter my address here in qatar,it's saying i should enter a valid zip code within the u.s.does it mean i can't buy online even if it wil be shipped within u.s. only?

    To buy in for delivery in Qatar, you should be starting from the Apple Qatar site:
    http://www.apple.com/qa/
    Do you have an Apple-ID? if you do, then you should not have to enter your Address again, and may be able to sidestep the US Zip Code issue.

  • Need a help to generate online html code

    I need a help with html code. I my page user in the tet area inserting a plain text and i am using servlet put it to DB, but now we need to use not plane text. Need to use custom text like <font color=121245>hello</font> <font color=457898> nice day</font>

    but now we need to use not plane text.Who is we?
    Need to use custom text like <font color=121245>hello</font> <font color=457898> nice day</font>Have you tried anything yet?
    What aspect of this requirement is tripping you up?

  • Urgently Need Code for Copy & Paste from Html Table in JSP to Excel file

    I am creating a html table in JSP file .
    I need code for 'Cut,Copy,Paste' functions ie. if someone wants to copy data from my table to excel file or from excel file to html table he shud be able to do that.
    Can someone give me code for 'Cut,Copy and Paste' i.e. some javascript functions which can do cut, copy and paste which i can put in my jsp file
    Thanks
    Message was edited by:
    javatechguru2007

    package com.chinmayananda
    public class Tetris{
    // complete here
    code]
    public abstract class AbstractTetris {
       public abstract void start();
       public abstract void stop();
    }nearly done

  • Survey creation abap code help needed

    hello experts,
    I need to create a survey in crm, by taking values from end-user from a webpage
    A sample code help is needed.
    Thanks in advance

    Take a look at this SAP note - It does a pretty good job of detailing the steps for you.  No coding necessary, it worked out of the box for us after patching this note.
    https://service.sap.com/sap/support/notes/638320

Maybe you are looking for