JSP- Applet- Servlet- JSP

Ok, I know there are better ways to do what I am about to describe, but due to numerous circumstances this is my only option:
I have a JSP that runs an Applet - All Good
I have that Applet talk to a Servlet - All Good
I need that Servlet to the load the original JSP - How?
The entire process should look like this to the user:
1) Load JSP
2) Click a button, runs Applet
3) Applet communicates with Servlet
4) Servlet puts some data in the Request
5) The original JSP is reloaded in the same browser window
How do I do step #5?
-or-
Can I have the Applet put some data in the request and go directly to the JSP?

You can use the "response.sendRedirect(<String url>)" for Servlet.

Similar Messages

  • Best IDE for developing Applets,Servlets,JSP

    Hi,
    I'm looking for a little bit of advise. I have been developing prototypes using Apache Tomcat. Now I need to go into a full development phase, and I need an IDE to help speedup my work, especially when it comes to debugging applets and servlets. So the following are my questions:
    1. What is the best IDE to use in conjunction with Apache Tomcat? Does JBuilder, for example, fit this bill?
    2. Outside of Apache, I believe there is for example IBM's Websphere, which includes an IDE and a Servlet/JSP container. Which is the best of these packages?
    Thank you for your help.
    Miguel

    Check out NetBeans 3.5 at www.netbeans.org

  • JSP & APPlet - HTML

    Hi All,
    I am new to web development platform. I know core java, now as I need to proceed to web development I would like to know certain concepts / languages used.
    Jsp - Jsp is used to develop webpages, how does it differ from html.
    Applets - We can develop web pages using applets. Then what are the circumstance we use applets, jsp.
    JSP & Applets - Can JSP and Applet both used to create a webpage? If yes how?
    Kindly answer my question. Thank you.
    Regards,
    lg

    Go look up a basic tutorial dude.
    Basically JSP lets you create an HTML page on the fly. Rather than just serving up a static page, you customise it for each request.
    This gives a pretty good example of how JSP fits into things
    http://www.javaranch.com/journal/200510/Journal200510.jsp#a1
    Applets - Its a program running on a web page. I kinda lump them into the same box as "flash" and "activex". They let you step outside the bounds of html which a webpage is tied to. That has both advantages and disadvantages. Most web applications don't use applets.

  • Advantages and Disadvantages of  Applet over JSP/servlet

    Can some one please let me know what are the major advantages and disadvantages of using Applets over JSP/Servlet technology?

    Well, a servlet / jsp is generated on the server, an applet on the client side. That's the most important difference.
    Appelt's usually are for little applications like games and stuff, you can run in a browser.
    Servlets are for dynamic pages, for example database-viewing and stuf...

  • Applet in jsp from servlet, but error: ClassNotFoundExcep

    The problem that I'm having is already mentioned a couple of times in this forum, but unfortunately I haven't found a solution, in thread http://forum.java.sun.com/thread.jspa?forumID=33&threadID=239405 is proposed solution but it's not working for me.
    I'm developing a project in IBM's Websphere Developer Studio 5.1.1. and JRE that I'm using for this project is 1.4.2. I have created servlet "CompanyDocument.java" and applet "SimpleApplet.java". Applet was created as single project and then imported into this one, that means that it's contained in current project as "SimpleAppletPackage.jar". I have placed jar in folder "Applets", Websphere automatically creates folder "simpleAppletPackage" and in it's root complied "SimpleApplet.class".
    When I put following code in the jsp page applet works correctly when application is runed.
    <APPLET code="simpleAppletPackage/SimpleApplet.class" codebase="Applets" archive="SimpleAppletPackage.jar" width="250" height="250"></APPLET>
    But I wanted to create jsp from servlet. So I used this code within servlet:
    out.print("<APPLET code=\"simpleAppletPackage/SimpleApplet.class\" codebase=\"Applets\"");
    out.print("archive=\"SimpleAppletPackage.jar\" width=\"250\" height=\"250\"></APPLET>");
    But I get an error (when running, no error when compiling). The error is copied from Java console:
    load: class simpleAppletPackage/SimpleApplet.class not found.
    java.lang.ClassNotFoundException: simpleAppletPackage.SimpleApplet.class
    at sun.applet.AppletClassLoader.findClass AppletClassLoader.java:162)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:566)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:619)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:548)
    at sun.applet.AppletPanel.run(AppletPanel.java:299)
    at java.lang.Thread.run(Thread.java:534)
    Caused by: java.io.IOException: open HTTP connection failed.
    at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:265)
    at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:43)
    at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:152)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:149)
    ... 9 more
    In the same time I'm creating some more code from servlet and it works with no errors and is shown in browser properly (it consists of connection to Oracle, formatting table, and presenting data within that table).
    Any idea? I'm totally stuck.

    In your browser, look at the HTML code that gets sent to the browser and see if there is something wrong with it.
    Specifically, I would look at the code near the <APPLET ..></APPLET> tags, both before and after and look for stray quotes, brackets, or what not.
    Finally, I would look inside the <APPLET ...> tag. It appears to me that the output will probably be:
    <APPLET code="simpleAppletPackage/SimpleApplet.class" codebase="Applets"archive="SimpleAppletPackage.jar" width="250" height="250"></APPLET>See, you may be missing a space between the "Applets" and the archive=. Try making the second out.print look like this:
    out.print(" archive=\"SimpleAppletPackage.jar\" width=\"250\" height=\"250\"></APPLET>"); See the extra space at the start of the output?

  • How can i upload a image file to server by using jsp or servlet.

    Hi,
    I m gurumoorthy. how can i upload a image file to server by using jsp or servlet without using third party API. pls anyone send me atleast outline of the source code.
    Pls send me anyone.
    Regards,
    Gurumoorthy.

    I'm not an applet programmer so I can't give you much advice there.
    If you want to stream the file from the server before it's entirely uploaded, then I don't believe you can treat it like a normal file. If you're just wanting to throw it up there and then listen to it, then you can treat it like a normal file.
    But again, I'm not entirely certain. You might be able to stream the start of the file from the server while you're still uploading the end of it, but it probably depends on what method you're using to do the transfer.

  • Is it possible to replace applet with JSP

    I m working for the extension of the a Chat Application which is Applet based...
    It is slow as the Applet loaded...
    Is it possible to replace the applet with th JSP....
    what r the pro and cons of it???
    Thanks in advance...

    sure it is possible.
    main difference is, that applet maintance a permanten connection to the server and therefor has a 'smaller' communication where as with servlets/jsp the client will have to communicate more information for each request.
    have a look at pushlets.com, a servlet based framework that keeps the connection to the client open (works with hidden frames and dhtml). very smart framework.

  • How to push back a message to browser using JSP or Servlet?

    Hi,
    I am coding some JSP and Servlet codes, and want to push back a mssage to browser and don't let browser first send a request to server like chat. Who can help me for that?
    Thanks,
    Wise

    You wrote:
    Not quite correct - see Pushlets:I wrote:
    "...to have code running on the client (eg an applet or a flash movie)"
    I add "...(eg an applet or a flash movie OR JavaScript)..." ;-)

  • Including applets in JSP - problem!!

    I'll begin by admitting that I am fairly new to JSP. That said, I am experiencing a ClassNotFoundException when trying to include an applet in a JSP under certain conditions. Here's the detail:
    I'm using Tomcat 4.0.4 and am working in the default ROOT webapp directory. This is running on Win2k Pro on port 8080. I HAVE managed to get the applet to load under the following circumstances:
    - JSP page in ROOT/jsp directory
    - applet class file (and supporting classes) ALSO in ROOT/jsp directory
    That's just great... but I want to be able to place the applet class file and supporting classes with all of the other class files in ROOT/WEB-INF/classes. Here's the scenario that fails time and time again:
    - JSP page in ROOT/jsp directory
    - applet class file (and supporting classes) in ROOT/WEB-INF/classes
    - in this scenario I have added a 'codebase' attribute to the applet tag (please be aware that I have tried this with both the APPLET tag and the jsp:plugin tag, each method yielding identical results)
    - I have tried several different codebase values, all listed below:
    codebase="../WEB-INF/classes/"
    codebase="http://localhost:8080/servlet/"
    codebase="http://localhost:8080/WEB-INF/classes/"
    codebase="."
    and I have tried it w/o a codebase at all
    None of these help the JSP to find the applet class file. I've really thrown my hands up in the air with this. I realize that every 3rd or 4th thread is typically a beginner with some Class not found error... but I've put my time in on this one, and I cannot figure it out. Thanks.

    Hi, Ben
    You bring up a very good issue that a lot of these books about JSPs and Servlets usually forget to mention.
    I dont know what sort of Web Servlet Container you are using, but I know that in Tomcat there is a 'lib' and and 'classes' directory, so if you want to have classes that are used by different applications from different directories then you can place them there. If you want you can compile all these classes into a jar and put that jar either in the 'TOMCAT_HOME/lib' or 'TOMCAT_HOME/common/lib' directories or you can simply put all the .class files into either the 'TOMCAT_HOME/classes' or 'TOMCAT_HOME/common/classes' directories. This way your classes will be known to any applications running on your webserver.
    If, however, you want supporting classes to be only used by servlets or jsps, then you should put them in the web-inf directory.
    Let me know if this works,
    Val.

  • Download Multiple Files?? (Servlets/Jsp)

    Hello Forum Members,
    I need to download multiple files from Server on a single click of button thats says "download". Using Servlets/Jsp only( I don't want to use applets/or Zip the files).
    The scenario would be on the browser I will have 'n' number of checkboxes each corresponding to a file and there is a button that say's download. Once I click "download" the browser should prompt me to save in a directory.

    I don't know if there's a Java implementation already out there (i'm sure there must be), but I think you'd need a separate Download Manager to be able to handle multiple file downloads. I'm all but positive that the standard download isn't gonna cut it, especially if the user selects a whole bunch of files. I don't think the built in download function allows for more than one file to download at a time, so unless you want a whole bunch of download windows all going at once, you'll need to either find (or implement) something that can.

  • JSP - Applet problem

    Hi
    How do I call an Applet from JSP?
    I have a applet that talks with jsp which talks to a bean, the connection between jsp and the bean is okay but between jsp and the applet im not sure how to do. Any suggestions?
    Jonas

    Yes JSP is an extension of Servlets, bu you have to understand the difference and the need why JSP's are created and where it fits the best. For you situation I assuming you want to access a JSP page which has an applet in a browser, then to interact the applet which needs to communicate the server it came from(not necessarily that particular JSP). If that is the case you need and a Servlet for the rest of the communication(Servlets are better choice whent there is no presentation going back to the client) which is just exchange of data between the servlet and the Applet.
    The Applet and the servlet could communicate through sockets or URLConnection or even RMI which ever you feel more convertible(RMI if you are passing objects).

  • Applet to JSP and JSP to C++

    I am looking for some information and sample code for
    (1)Java Applets to JSP connection
    (2)JSP to server-side functions written in C++
    Thanks in advance.

    I am looking for some information and sample code for
    (1)Java Applets to JSP connection
    Look out for it [url http://www.unix.org.ua/orelly/java-ent/servlet/ch10_02.htm]here
    It shows applet-servlet communication. By making minor changes to it, you can setup applet - jsp communication as well.
    (2)JSP to server-side functions written in C++Refer to the previous post.
    All the best.

  • Problem with post and get (jsp to servlet)

    ===jsp code(login.jsp)
    out.println("<form action='servlet/Login' action='post'>");
    out.println("Username <input type='text' name='user' /><br>");
    out.println("Password <input type='password' name='pass' /><br>");
    out.println("<input type='submit' value='Login' /><br></form>");
    the above jsp page is included in another jsp page
    ===jsp code(index.jsp)
    <jsp:include page='login.jsp' flush='true'/>
    when submit is clicked in the login form, the data is send (to Login servlet) in the url string, even though i am using "POST" method in the form.
    the output of request.getMethod() in the Login servlet gives "GET"
    what could be the problem?

    The code you've shown us looks fine. The problem isn't in the form code you've listed. Is the form being included inside another form on index.jsp? Does index.jsp have any forms of it's own? Perhaps you aren't submitting the form you think you are submitting. Or, are you redirecting in your serlvet somewhere? Or are you forwarding the request somehow?
    I agree with the previous post - we need to see the HTML output that index.jsp results in.
    Michael

  • PL/SQL vs JSP vs Servlets

    We are in the stage of deciding which language to develop portlets. I lean towards JSP or servlets for the wide array of Java libraries we can use. I think the only advantage of PL/SQL is speed. Thanks.

    It depends. If your developers are mainly Java developers, you'll probably prefer building web portlets. But if you have a strong PL/SQL skill set you could choose the latter. Additionally, if you're developing content that is database intensive you may want to build PL/SQL portlets since they transact with the database faster. If you're going to aggregate content from various web sites, using web providers is preferable. It's a matter of choice based on your requirements and preferences.

  • How to import and display an applet from JSP

    i m using netbeans 5.0
    i have class named myapplet.class
    and jsp named myjsp.jsp
    now i want to access(import) this myapplet.class from jsp
    also i want to display this applet from this jsp
    i am able to do either thing but not both
    so please help me it is so urgent and important for me bcoz
    i have to complete my project as early as possible
    Thanks in advance

    my jsp source file page path is D:\Reliance
    project\WebApplication3\web\
    and classes path is D:\Reliance
    project\WebApplication3\build\web\WEB-INF\classes\
    so problem is that if i want to use myapplet.class
    then i have to put my class in D:\Reliance
    project\WebApplication3\build\web\WEB-INF\classes\
    location
    but at that time i am not able to display this applet
    on my jsp
    if i put my myapplet.class in
    D:\Reliance project\WebApplication3\web\ then i m
    able to display
    applet but not able to access(import) this class
    hope you will got the problem!!!
    thanks for your reply !!!try to set the path of your applet on jsp something like this
    "WEB-INF/classes/myclass.class"

Maybe you are looking for