Can I Use Swing Components in a JSP Page

Hi,
Can I use Swing Componnents in a JSP Page.If so,Can anybody provide with a sample code.
Thanks.

hi,
I wanted to use the JTabbedPane for tab buttons in my
Jsp Page.Is that possible?I am afraid that you can't.
As for GUI (graphics) in the HTML page you can use only the html form elements (but you should simulate other behaviours by dynamically reloading the page).-
Ionel.

Similar Messages

  • I can't use swing components in my applets

    When I write an applet without any swing components, my browser never has any trouble finding the classes it needs, whether they're classes I've written or classes that came with Java. However, when I try to use swing components it cannot find them, because it is looking in the wrong place:
    On my computer I have a directory called C:\Java, into which I installed my Java Development Kit (so Sun's classes are stored in the default location within that directory, wherever that is), and I store my classes in C:\Java\Files\[path depends on package]. My browser gives an error message along the lines of "Cannot find class JFrame at C:\Java\Files\javax\swing\JFrame.class"; it shouldn't be looking for this non-existent directory, it should find the swing components where it finds, for example, the Applet class and the Graphics class.
    Is there any way I can set the classpath on my browser? Are the swing components stored separately from other classes (I'm using the J2SE v1.3)?
    Thanks in advance.

    Without having complete information, it appears that you are running your applets using the browser's VM. Further, I assume you are using either IE or Netscape Navigator pre-v6. In that case, your browser only supports Java 1.1, and Swing was implemented in Java 1.2. You need to use the Java plug-in in order to use the Swing classes (see the Plug-in forum for more information), or else download the Swing classes from Sun and include them in your CLASSPATH.
    HTH,
    Carl Rapson

  • New - can't use Swing components????

    I downloaded jdk-1_1_8_009-win.exe and installed and I'm merrily learning Java - except I don't have the javax.swing.* classes in this download (when I look in \lib\classes.zip).
    I have repeatedly tried downloading the SDK 1.3.1 and Java Foundation Classes (JFC), but all I get is Page Not Found over and over.
    This is getting freaking frustrating. What am I supposed to do? All I'm trying to do is create a JFrame with a JButton, and continue from there. Why isn't the Swing stuff in their latest JDK download?
    Thanks for reading a dumb question from a beginner!

    Why isn't the Swing stuff in their latest JDK download?It is! The problem is that you downloaded an obsolete JDK version (1.1.8), and javax.swing did not appear until version 1.2.
    What am I supposed to do? Download the lastest version of the SDK.
    http://java.sun.com/j2se/1.4/download.html

  • Can i use swing under JSP?

    i have a JSP, now my question is, can I display swing components under JSP?

    A JSP is just a way to write HTML back to browser.
    It is a mix of HTML and java.
    A JSP is converted to a java source file, with code like:
    out.println(".... HTML code you wrote ...");In this way a java application writes back to the client browser on a page request.
    A totally different mechanism are either a java applet (embedded in an HTML page),
    or Java WebStart, which distributes entire java applications via the net.
    If you are familiar with Swing, or have an existing Swing application, or need a
    user friendly GUI, those are the ways.

  • Can I use AWT elements in a JSP, and so could I generate events with them?

    This is because I�m doing a simple JSP that showing a button, my JSP is:
    <html>
    <%@ page import="java.awt.*" %>
    <%! Button b = new Button("Hola!!!"); %>
    <% add(b); %>
    </html>
    But when I tried to see the button in the browser, my JSP generates the following:
    Compilation of '/RAID5/weblogic/myserver/classfiles/jsp_servlet/_gep/_alterno/_23_mayo/__mr4.java' failed:
    /RAID5/weblogic/myserver/classfiles/jsp_servlet/_gep/_alterno/_23_mayo/__mr4.java:79: cannot resolve symbol
    probably occurred due to an error in /gep/alterno/23_mayo/mr4.jsp line 7:
    <% add(b); %>
    Could somebody help me please?.....
    Can I use AWT elements in a JSP, and so could I generate events with them?
    Thanks!!!

    There are 2 ways to run a web page dynamically:
    1) Reload the page via use of javascript or some other scripting language.
    2) Use an applet to regularly check a URL for the data
    Remember, as Paul pointed out, JSP's only generate HTML output. AWT components need to run inside a JVM not a just the browser.
    I could recommend an applet but you may have problems with IE6 not supporting java. Otherwise there shouldn't be too much of a prob.
    If you prefer to use an AWT/Swing setup (for example an application) rather than a JSP setup, Webstart is good for delivering online applications which operate standalone or remotely.
    When you consider that the Java-Plugin and the Webstart puligin are about the same size it's just a matter of weighing up who your target clients are and whats easiest.
    Cheers,
    Anthony

  • How Can i use Html frames with  simple JSP???

    How Can i use Html frames with simple JSP???
    Actually i am creating an application in which i have used Index.html as frame.
    Noew i am trying that if i click on a link of one frame(say menu frame) the \result shoul come to some other frame(say frame named mainwindow).
    Hoe can i do like this???
    Anand Pritam

    Well i am using..
    < Base target="mainwindow">
    But it is no working is there some other way??

  • Java.lang.NullPointerException warning beside components on ADF JSP page

    java.lang.NullPointerException warning beside components on ADF JSP page problem
    Hello
    i developed a web application with the help of the Adf technology On jdeveloper 10.1.3.3.0 . Everything is Ok.
    But when i use application sometimes on the page i take a java.lang.NullPointerException warn beside the some components like a inputbox or a radio button ..)
    i looked the logs but nothing.
    How can i solve this problem.
    Have you got any idea?

    Hi,
    it's the validator property on inputText components that causes it. not validation or StateValidation or EnableTokenValidation.
    Paste your inputText source from the page if you are not sure.
    Brenden

  • Using Java Objects in my JSP page... objects are in a different directory

    Hi,
    I would like to call and use an object from a JSP page. The java object is in one directory, the jsp is in another. When I call my object, I get a JSP error that says it can't find the object and lists the directory name as part of the file.
    For example, here are my two files:
    /java/MyObject.class
    /web/page.jsp
    When I make the call to new MyObject(), I get an error message saying _web.MyObject cannot be found.  Any ideas on this?
    Thanks!

    Okay, I figured it out. In case anyone else needs it, here is what I needed to do.
    1) I created my object in a package. The JSP page was looking for the object in _dir directory because a package wasn't specified.  I created a subdirectory in one of the directories in my classpath and named it the same thing that the package was named.
    2) Import the package
    3) Make sure all methods in the classes are public, since only public methods can be accessed from outside the package.
    Thanks for the help, it got me going in the right direction.

  • Problem for getting the real path using one servlet and one jsp page

    I have one tomcat machine and several virtual domains. Eahc virtual domain has one realpath in the disc.
    I am using one servlet and one jsp page for using this servlet.
    my purpose is to load, using the servlet , the real path for the domains (eahc domain has its path).
    for this i make this:
    the servlet code is this:
    package utils.ticker;
    import java.io.*;
    import java.io.File;
    import java.io.IOException;
    import java.net.*;
    import java.util.*;
    import java.text.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    public class Edicion extends HttpServlet{
    public Edicion() {
    public String cc(){
    ServletContext myContext= getServletContext();
    String abspath = myContext.getRealPath("/");
    //here i want to return the real path
    return abspath;
    public static void main(String args[]){
    and the jsp page is:
    <%@ page import="utils.ticker.*" %>
    <jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
    <html><head><body>
    <%
    tick.cc();
    %>
    </body></head></html>
    But this produces one error, NullPointerException and dont shows me the real path.
    Can anyone help me?
    thanks

    i have put this into one sevlet:
    package utils.ticker;
    import javax.servlet.ServletContext;
    public class Edicion{
    private ServletContext myContext;
    public Edicion(ServletContext myContext) {
    this.myContext = myContext;
    public String getCC(){
    return myContext.getRealPath("/");
    and in the jsp page this:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*"%>
    <%@ page import="utils.ticker.*" %>
    <jsp:useBean id="tick" class="utils.ticker.Edicion" scope="session"/>
    <html><head><body>
    <%=tick.getCC()%>
    </body></head></html>
    but appear this error in the tomcat.
    Can you, please, help me. i am trying to solve this during one week and i am desesperate.
    Thanks.
    ERROR:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    javax.servlet.ServletException: class utils.ticker.Edicion : java.lang.InstantiationException: utils.ticker.Edicion
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
         at org.apache.jsp.pruebas_jsp._jspService(pruebas_jsp.java:72)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
         at java.lang.Thread.run(Thread.java:536)
    Apache Tomcat/4.1.18

  • How to use ShowValue within a UIX/JSP page to display an active link?

    I am storing URL's in the DB and want to display them as active links on a UIX/JSP page. I thought that I had this working some time ago, but now it no longer works.
    Using <bc4juix:RenderValue datasource="ds1" dataitem="myTextField" /> will display "http://www.otn.oracle.com" as an inactive link using UIX/XML which is expected.
    Using <jbo:ShowValue datasource="ds1" dataitem="myTextField" /> will display an active link using if using BC4J/JSP, which is expected.
    However, I have not been able to do this using a UIX/JSP page.
    Is it possible to use ShowValue within a UIX/JSP page to display an active link?
    Thanks,
    Bill G

    Hi Juan,
    I've done the following and it does not work for me;
    --- snip ---
    <uix:form name="form1" method="GET">
    <bc4juix:Table datasource="ds1" >
    <uix:columnHeaderStamp>
    <uix:styledText textBinding="LABEL"/>
    </uix:columnHeaderStamp>
    <%--
    <jbo:AttributeIterate id="dsAttributes" datasource="ds1" hideattributes="UixShowHide">
    <bc4juix:RenderValue datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    </jbo:AttributeIterate>
    --%>
    <bc4juix:RenderValue datasource="ds1" dataitem="FacilityDesc" />
    <bc4juix:RenderValue datasource="ds1" dataitem="LocationId" />
    <bc4juix:RenderValue datasource="ds1" dataitem="LocationDesc" />
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <uix:rawText>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
    </uix:rawText>
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <uix:contents>
    <uix:rawText>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>
    </uix:rawText>
    </uix:contents>
    --- snip ---
    Bill G...

  • How can i use my own Fonts in iCloud Pages?

    How can i use my own Fonts in iCloud Pages?

    Baluk wrote:
    And WebHosted Fonts like GoogleFonts?
    No.
    To tell Apple you want such features added, go to
    http://www.apple.com/feedback

  • Using Swing Components in JSP

    Hi,
    I regret that I do not have a very specific problem here. However, I am wondering if there is a way to display Swing components, such as a panel, on a web page using JSP. If so, are there any tutorials on such a practice? Or would something like this be included in a general tutorial?
    Thanks,
    Dan

    You'll have to use a JApplet.

  • How can i understand swing components?

    hi
    i am tonmoy. i have some question about swing component
    i,e JTextField,JListBox JTable etc.
    1. i have made a class name StyledDOcument extends
    DefaultStyledDocument so i can access any public method of
    DefaultStyledDocument. but my problem is that i cannot understand
    which method is implicitly called and whcih are not.
    for example InsertString(int offs, String str, AttributeSet a)
    is internally called because if i dont override it or call it using
    super.insertstring(), it will be called internally everytime i press
    char from keybord.
    so i think there are many method of swing components that are called
    internally but by reading java doc i can't understand
    which method is internally called and which are not.
    so plese answer my questions in details.
    thank you

    Tutorials, Teachers, and books are all good ways to learn these things.

  • How can I use a applet in a JSP file?

    hi
    I failed to use applet in a jsp file.My workspace is a BC4J type. I put the applet's source file in business component project.the jsp is in JSP project.
    The jsp file calls applet by <jsp:plugin></jsp:plugin> style.
    The error is can't find the applet class.
    why? Thank someone for give me help.

    Actually using jsp applet tags does not mean that it is taking care of that the classes are available. It simply renders the Applet tag tothe JSP page. If e.g. teh codebase is specified as /java/, then there should be a mapping to the Java class location with thename of /java/. If codebase is not provided, then the Java class must be in the classpath of the JSp servlet.
    Frank

  • How to use Swing Components in  JavaFX

    Hi All,
    I am new to JavaFx. I am trying to use java swing components in javafx.
    I found a sample program in net and tried it. But it shows compile time error.
    Code:
    MySwingComponent .fx
    import javafx.ext.swing.SwingComponent;
    import javax.swing.JComponent;
    import javax.swing.JButton;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    * @author nandha
    class MySwingComponent extends SwingComponent{
    var button: JButton;
    public var text: String on replace {
    button.setText(text);
    public var action: function();
    override protected function createJComponent () : JComponent {
    button = new JButton();
    button.addActionListener(ActionListener {
    public override function actionPerformed(e:ActionEvent){
    action();
    return button;
    The above code shows no error.
    Test SwingButton.fx
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import swingcomponents.MySwingButton;
    * @author nandha
    Stage {
    title: "Swing Button Example"
    scene: Scene {
    width: 250
    height: 80
    content: [
    MySwingButton{  // error message: imcompatible type. found MySwingButton. Required javafx.scene.Node[]
    text: "Click Me!"
    action: function(){
    println("Hello World!");
    This code which used the MySwingButton shows error: imcompatible type. found MySwingButton. Required javafx.scene.Node[] - where i have added the MySwingButton.
    Please help me to fix the error.
    Thanks &Regards,
    Nandha K

    Hi Sasa,
    First thanks for your reply.
    I found the problem and have fixed.
    Problem:
    There is no class MySwingButton in the package swingcomponents. Its MySwingComponent that i should have used, which is a big mistake that i have done. To my surprise i don't know NetBeans didn't show any error message at that line.
    Thanks & Regards,
    Nandha K

Maybe you are looking for

  • Looking for a simple desktop app

    Help please -- there's an app out there that does this simple thing but I can't remember its name or see it in the App Store. What I'd like to do, when watching a video, is blank out the rest of the desktop somehow. (Think I saw a small note in Macwo

  • What is SQL Studio. Do you have any idea ?

    Hi Please review this URL. http://www.sapdb.org/7.4/sap_db_tools.htm - What is SQL Studio. Do you have any idea ? - I installed the same in my desktop ( Win XP). Unable to  establish the connection to the database using my application login/pwd.  Am

  • Impossible to detect an AUTO_INCREMENT column in a table of PostgreSQL DB.

    Hello, I need to detect an AUTO_INCREMENT column in a table of PostgreSQL DB. Note : PostgreSQL uses sequence number to create an AUTO_INCREMENT column. From a ResultSetMetaData, I call the methode isAutoIncrement(int index) which returns true if the

  • "Not passed Windows logo testing" message

    I just download iTunes 8 and partway through the install got a message that said "software has not passed Windows Logo Testing" and that this could compromise my system. The older version of iTunes worked just fine, is there anywhere I can download t

  • Red lights behind the power button

    In reading through some posts last night I got the impression that I should be paying more attention to the lights inside the box, behind the power button, when booting (or I should say attempting to boot) my dual-core G5 PowerMac. My observations th