Java/Template called by JSP Suggestion

Hi, I have a java class called it "A.java" (for the look and feel) that contains the template for the front end(JSP).
Then, the jsp call the "A.java", asking for appropriate template for this page, and the "A.java" returning a string (appended string) containing a bunch of html code.
for examples, inside "A.java"
public String template (String content, String title)
String a = "<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">";
a+= title;
a += "<table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr>" + content;
a += "<td colspan="2" align="left" valign="top"> <font size="1" face="Impact"> <font size="7">";
return a;
My questions is, is there any better way to return that whole html code in some other way, instead of returning the string appended w/ long html code?
Any Idea will be appreciated, THANKS

Hint...
Usually, I jsp:include a header.html file at the top and a footer.html file at the bottom.
Anything in between is the JSP...
Sometimes my header.html starts a table, row, cell <td> ...
then the footer.html file finishis it </td>, row, table, etc... The entire JSP output is contained in the cell. Easy to re-use.

Similar Messages

  • Checking textbox through java class which is called  in jsp

    I have created a text box in html and if the string entered by user is a alphabet it will not show any message ,else it should display a error message..These checking validations of textbox is done in java and called in jsp;
    a.html
    <font size="4">Enter the search keyword:</font><input type="text" name="key" ><br>
    and also submit button is there which goes to main.jsp
    main.jsp
    <%@page import="gaveshan.checking;"%>
    <%
    checking ch=new checking();
    String trans=request.getParameter("key");
    out.println(ch.ParseClean(trans));
    session.setAttribute( "trans", trans );
    %>
    checking.java
    package gaveshan;
    import java.awt.event.*;
    public class checking
    {  public String ParseClean(String str)
    if(str.length()==100||str.length()==0)
    return "Enter String Properly";
    for(int i=0;i<str.length();i++)
    if(!(str.charAt(i)>65&&str.charAt(i)<122))
    return "Enter String Properly";
    it is not givng any message when user enters the input in textbox
    it is not showing any error

    Using javascript.
    var lwr = 'abcdefghijklmnopqrstuvwxyz';
    var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    function isValid(parm) {
    for (i=0; i<parm.length; i++) {
    if (val.indexOf(parm.charAt(i),0) == -1) return false;
    return true;
    }- vignesh

  • How to call java script function from JSP ?

    how to call java script function from JSP ?

    i have function created by java script lets say x and i want to call this function from jsp scriplet tag which is at the same page ..thanks

  • How to Call a JSP from Java Script

    Hi,
    I want to call a jsp from Java Script.
    I am having IntelliJ IDEA 4.5 (IDE) and weblogic server.
    should i do anything on web.xml,weblogic.xml
    I have written one jsp, Java script.
    I want to call a jsp from Java script

    function submitf(){
    document.xyz.action ='ReportSave.jsp';
    document.xyz.method='POST';
    document.xyz.submit();
    <form name='xyz'>
    <input type='text' name='text1'>
    <input type='text' name='text2'>
    <input type='button' name='xx' value='submit' onclick= submitf()>
    </form>
    Is this what u want???
    Regards,
    RAHUL

  • How to call a jsp function on a java script event 'onchange'

    hi all,
    i m in trouble, iwant to call a jsp function on occurance
    of a javascript event onchange
    actully i want to refresh my one text field at every change
    in a select option of a form
    plz tel me any othr method if i m wrong.
    thnx in adv.

    as the form submition is a POST operation u can use some
    if{} else{} construct to handle this. u can check the value of some POST variable to identify whether its the first loading or refresh. got it
    regards
    aleens

  • Using java to call a text file

    I am new to java and was wondering if there is a way of using java to call a text file on my server and use it to create a webpage using a template. Namely to click a link to a poem, and have the java automatically create a page from a text file of the poetry. I need to know if this is even possible, what I would need to look into, (IE: which software or applet to look for), and if there are any sites that anyone knows about that I could learn how to do this. currently I am having to create a page for every poem posted on my site, which takes a great deal of time, and I would like to speed the process up a bit if it is possible. Any suggestions would be greatly appreciated.

    Why a text file? I don't think it is a best practice of doing that. Just use a database, keep your poem collections there, and set up a jsp page that seek the database, and then display it on another jsp page. I guess you can find similar application in the sample projects provided by JSC.

  • Java.lang.ClassCastException in JSP

    Hi All,
    We are facing "java.lang.ClassCastException" in JSP page. Below are JSP code, printStackTrace and compiled JSP (from Application Server) file.
    We are using Struts 1.2.7, JDK 1.4.2 and Oracle 10g OC4J.
    JSP Code:
    <nested:iterate property="coverage">
    <tr>
    <td class="text" align="left" valign="top" width="198" height="2">
    <html:hidden name="coverage" property="coverageType" indexed="true"/>
    <bean:write name="coverage" property="coverageDescription"/>
    </nested:iterate>
    printStackTrace:
    08/03/26 15:48:07 java.lang.ClassCastException
    08/03/26 15:48:07 at jsp.quickquote._Coverages._jspService(_Coverages.java:244)
    08/03/26 15:48:07 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:569)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:305)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121)
    08/03/26 15:48:07 at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
    08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
    08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
    08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
    08/03/26 15:48:07 at jsp.template._mainLayout._jspService(_mainLayout.java:93)
    08/03/26 15:48:07 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:302)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
    08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
    08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    08/03/26 15:48:07 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    08/03/26 15:48:07 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    08/03/26 15:48:07 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    08/03/26 15:48:07 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    08/03/26 15:48:07 at java.lang.Thread.run(Thread.java:534)
    Error is coming in compiled JSP:
    org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_12=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property");
    In Struts Action we have used below code
    CoverageModel[] cs = (CoverageModel[])coverageCol.toArray(new CoverageModel[0]);
    f.set("coverage", cs);
    We are facing above exception after 6/8 hours of Application restart. . Some time we not facing above exception till 48hrs.
    5 users accessing application day time.
    e.g.
    If we restart server @ 1 PM then try to login with new browser session at 7 PM or 9 PM, we are facing "java.lang.ClassCastException" on JSP page.
    If we restart Applcation Server then code is working fine. After restart, we not get null pointer class cast exception for next 6/8 hour.
    Please let me know if anybody has any suggestion/solution.
    Thanks and Regards,
    Kailas

    Hi All,
    We are facing "java.lang.ClassCastException" in JSP page. Below are JSP code, printStackTrace and compiled JSP (from Application Server) file.
    We are using Struts 1.2.7, JDK 1.4.2 and Oracle 10g OC4J.
    JSP Code:
    <nested:iterate property="coverage">
    <tr>
    <td class="text" align="left" valign="top" width="198" height="2">
    <html:hidden name="coverage" property="coverageType" indexed="true"/>
    <bean:write name="coverage" property="coverageDescription"/>
    </nested:iterate>
    printStackTrace:
    08/03/26 15:48:07 java.lang.ClassCastException
    08/03/26 15:48:07 at jsp.quickquote._Coverages._jspService(_Coverages.java:244)
    08/03/26 15:48:07 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:569)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:305)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121)
    08/03/26 15:48:07 at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
    08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
    08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
    08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
    08/03/26 15:48:07 at jsp.template._mainLayout._jspService(_mainLayout.java:93)
    08/03/26 15:48:07 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:302)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
    08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
    08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
    08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
    08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    08/03/26 15:48:07 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    08/03/26 15:48:07 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    08/03/26 15:48:07 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    08/03/26 15:48:07 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    08/03/26 15:48:07 at java.lang.Thread.run(Thread.java:534)
    Error is coming in compiled JSP:
    org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_12=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property");
    In Struts Action we have used below code
    CoverageModel[] cs = (CoverageModel[])coverageCol.toArray(new CoverageModel[0]);
    f.set("coverage", cs);
    We are facing above exception after 6/8 hours of Application restart. . Some time we not facing above exception till 48hrs.
    5 users accessing application day time.
    e.g.
    If we restart server @ 1 PM then try to login with new browser session at 7 PM or 9 PM, we are facing "java.lang.ClassCastException" on JSP page.
    If we restart Applcation Server then code is working fine. After restart, we not get null pointer class cast exception for next 6/8 hour.
    Please let me know if anybody has any suggestion/solution.
    Thanks and Regards,
    Kailas

  • Calling a JSP Report From HTML parameter form

    Hi,
    I m trying to run a JSP Report from a HTML parameter Form. The JSP reports requires a parameter named userid in the URL with a valid value for database connection.
    eg. URL "http://win2kdb.oracle9iis.com:7778/repdemo/examples/Tools/fm_crdinf.jsp?userid=sysapps/system@trt1". We have created a variable on the server named "parmformjsp" with a value "sysapps/system@trt1". Now i use this variable in the URL as follows, eg. "http://win2kdb.oracle9iis.com:7778/repdemo/examples/Tools/fm_crdinf.jsp?parmformjsp".
    When i use this URL to call another JSP report from a JSP report it works fine, but the same does not work when calling a JSP report from a HTML form.
    the code for HTML parameter form calling a report is as follows,
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Parameter Form</title>
    </head>
    <body>
    <p>Parameter Form</p>
    <form name="form1" method="GET"
    action="http://win2kdb.oracle9iis.com:7778/repdemo/examples/Tools/fm_custrns.jsp?parmformjsp">
    <p>From Date<input type="text" name="p_fmdate" size="20"></p>
    <p>To Date<input type="text" name="p_todate" size="20"></p>
    <p> </p>
    <p><input type="submit" ><input type="reset" value="Reset" name="B2"></p>
    </form>
    <p> </p>
    </body>
    </html>
    If i create an input parameter named "userid" with a valid database connection value, remove the ?parmformjsp part from the action URL then it works fine. How can i call the JSP report using the parmformjsp variable name instead of using the "userid" clause in the URL.Can anyone suggest any workaround....
    Thanks & Best Regards,
    Unmesh

    do it like this...
    DECLARE
    pl_id ParamList := Get_Parameter_List('tmpdata');
    BEGIN
    IF NOT Id_Null(pl_id) THEN
      Destroy_Parameter_List( pl_id );
    END IF;
    pl_id := Create_Parameter_List('tmpdata');
    Add_Parameter(pl_id, 'ROUTE_CARD_CONTROL', TEXT_PARAMETER, :ROUTE_CARD.ROUTE_CARD_CONTROL);
    Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
    Run_Product(REPORTS, 'D:\STL_FINAL\CHPREPORTS_FINAL\ROUTE_CARD.REP', SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
    END; what exactly happens when you call the report. if its showing the blank page... may be you are not passing the right parameter name. cross-check that your parameter name in the report is 'ROUTE_CARD_CONTROL'.

  • How to access a JAVA Script variable in JSP Code

    How to access a JAVA Script variable in JSP Code. I have been unable todo this.
    Plz Suggest a way.
    Thanks
    Soumya

    try to do this code
    String s=request.getParameter("javascriptvariablename");

  • Opening a Java Window from a jsp page on the client side

    Hi all,
    Thanks in advance to all who could help me for this problem.
    I've written some jsp pages. In one of them, I open a new Java Window,
    which is a simple Java Frame. If I test this directly on the Tomcat
    server, everything works well.
    But when I call the jsp page through a web browser of a distant client
    (normal use), and when I want to see the java window, no window pops
    up. It appears that the Java Window pops up on the server, and not on
    the client side, which is what I wanted.
    Could someone tell me how to make the Java frames appear on the client
    side ? (Is it linked to the code or to the configuration of Tomcat ?)
    Thanks in advance,
    Alexis.

    JSP always run on the server. On the client you only see the results.
    But you can use applets on the client side: http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html

  • Java Applet call javascript problem

    Hi I have a web page as follow and embedded a applet. The applet call the java script, and instead of showing an alarm, the browser show the javascript code. Is that strange ? Any suggestion for this problem.
    HTML:
    ================================================================
    <HTML>
         <HEAD>
         function ShowEmbd()
              alert("Test Applet call Javascript");
         </SCRIPT>
         </HEAD>
         <BODY>
         <FORM NAME="AppletEmbdStart">
              <OBJECT classid="clsid:48B2DD7B-6B52-4DB0-97C9-ECB940113B47" id="CIVON_DEmbdObj" width="0" height="0"></OBJECT>
              <APPLET code="MyApplet.class" width="0" height="0"></APPLET>
         </FORM>
         </BODY>
    </HTML>MyApplet.java
    =========================================================================
    import netscape.javascript.*;
    public class MyApplet extends javax.swing.JApplet
         private JSObject m_win = null;
         private JSObject m_doc = null;
         public void init()
              getJSWin().call("ShowEmbd", null);
         private getJSDoc()
              if(m_doc == bull)
                   m_doc = (JSObject) getJSWin().getMember("document");
              return m_doc;
         private JSObject getJSWin()
              if (m_win == null)
                   m_win = netscape.javascript.JSObject.getWindow(this);
              return m_win;
    }The page was load and it should call the applet MyApplet. The MyApplet should do the init() method and call the Javascript "ShowEmbd()", BUT, instead of show alert from ShowEmbd(), the browser show the code of ShowEmbd() itself ...... It did not run the javascript and shows the alert ??
    The browser shows a message from status bar "The applet not initial" ???? why ???
    Can anyone help ?!

    On first look:
    I am not sure about the Object Tag, but the Applet Tag requires the MAYSCRIPT attribute before Java can call Javascript.

  • Call a JSP from applet and display the results in the browser

    Hello All,
    I have written an applet which performs some functionality at the clinets browser. When the applets method finishes exectution, I would like to call
    a jsp. The results of the JSP should be displayed like a normal page in the browser.
    I tried creating a HttpURLConnection and calling the jsp but two things happened
    1. The jsp call failed because the applet doesn't have a valid session id.
    2. even if I disable the valid user check at the jsp, the results of the jsp are returned as a set of bytes to the applet. They are not displayed in the browser window.
    Then I tried applet.getAppletContext().showDocument()... However with this api I cannot do a POST operation on the JSP with some input data because this takes only a URL as an input parameter.
    Please help me in this problem and I will be very gratefull to you.
    1. applet uses the same session id as the browser so that when applet makes a request to the jsp it does not get user invalid exception.
    2. the results of the jsp are displayed on the browser and not given to the applet.
    Thank you so much for your help.
    regards,
    Abhishek.

    I hope this can help you
    I made a package calls fun
    and a clsss calls JspTestingFun
    package fun;
    public class JspTestingFun{
      private String sample = "welcome to jsp";
      //Access sample property
      public String getSample() {
        return sample;
      //Access sample property
      public void setSample(String newValue) {
        if (newValue!=null) {
          sample = newValue;
    }then I make a jsp file
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
    <%@ page import =  "fun.JspTestingFun"%>
    <html>
    <head>
    <title>
    jspTest
    </title>
    </head>
    <jsp:useBean id="mytest" scope="session" class="fun.JspTestingFun" />
    <jsp:setProperty name="mytest" property="*" />
    <body bgcolor="#ffffff">
    <%
    mytest.getSample();
    %>
    <h1>
    Just for testing
    </h1>
    <form method="post">
    <br>Enter anything   :  <input name="sample"><br>
    <br><br>
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" value="Reset">
    <br>
    this what we get<jsp:getProperty name="mytest" property="sample" />
    </form>
    </body>
    </html> 

  • Invoke Java 3d from a JSP?

    Hi,
    I have a sample java code that invokes a Canvas3d and then invokes a 3D object.
    Our project goal is to create an online application-- A JSP page which will invoke the java 3d object.
    I am working on Oracle JDeveloper and OC4J server.
    Currently , the application runs thru a .java file.
    I want to know if it is technically possible to create a jsp page and transfer the 3d object generated by this java file onto the JSP?
    I tried renaming the main method of the java file to say testMain (made it static method).
    Then thru the JSP , i tried to call this testMain method.
    It doesnt work.
    thanks

    HI
    I was able to add a canvas3D to a webbrowser via an applet. I suppose you can always invoke an applet from a JSP.
    Venkat

  • Java, Stored Procedure/Function,  JSP

    Hello All,
    Is there any one who can help.
    I would like to return a record set from a stored function and display the results with a JSP program.
    The same function is currently being used to retrieve data for a related process, but that process uses a procedure to call the function and the results are written to a database table. This works fine.
    This time I would like to create a record set and display the results on screen, but I am having problems.
    ResultSet rsTimecard = null;
    Connection conn = sqlMgr.getConnection();
    CallableStatement cs = conn.prepareCall("{ ? = call TA_WEBDBA_HOURS_USE_PKG.aftimecard_jocas_records(to_date('01-OCT-2004', 'DD-MON-YYYY'), to_date('30-OCT-2004', 'DD-MON-YYYY')) }");
    cs.registerOutParameter(1, Types.OTHER); // This is line 99. Types.OTHER is the Invalid column type that the system is complaining about.
    cs.execute();
    rsTimecard = (ResultSet) cs.getObject(1);
    <table width="100%">
    <%
    while(rsTimecard.next())
    %>
    <tr>
    <td colspan="1" width="10%"> 
    </td>
    <td colspan="1" width="10%">
    <%=rsTimecard.getString(1)%>
    </td>
    I get:
    Application Error
    The following error occurred: Invalid column type
    java.sql.SQLException: Invalid column type
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:294)
    at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:5992)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:250)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:389)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:446)
    at com.evermind.sql.FilterCallableStatement.registerOutParameter(FilterCallableStatement.java:373)
    at aftimecard.jsp._PSRptView._jspService(PSRptView.jsp:99)
    at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:139)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:778)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:534)

    Rufus,
    Have you seen the Refcursor Sample? I believe it will help you.
    http://tinyurl.com/5r6hm
    Good Luck,
    Avi.

  • In .java add elements to .jsp

    Hello!
    I'm just beginning and can't understand one thing:
    When I create JSPDynPage, system create JSP and JAVA file - it's clear. Then I add elements to form in JSP, for example, Layout.
    Can I add, for example, row into that Layout in .java file?
        .JSP:
    <hbj:form>
             <hbj:formLayout
                 id="myLayout"
                 width="100%">
                 <hbj:formLayoutRow
                         id="Row1">
                         <hbj:formLayoutCell
                                 id="Cell11"
                                 align="LEFT"
                                 width="100%">                
                                 <hbj:textView
                                     id="welcome_message"
                                     text="May the force be with you unknown user"
                                     design="HEADER1" />
                           </hbj:formLayoutCell>
                   </hbj:formLayoutRow>                      
               </hbj:formLayout>            
        </hbj:form>
    .JAVA:
    public void doProcessBeforeOutput() throws PageException {
             this.setJspName("myjsp.jsp");
          Form Reg_Form = null;
          FormLayout RF_All  = new FormLayout();
          Tray Left_Tray1 = new Tray("TrayRules1");
           Reg_Form = (Form)this.getForm();
           RF_All = (FormLayout) this.getComponentByName("myLayout");
           for (int i = 1; i <= 3; i++ ) {     RF_All.addRow(); }
           Left_Tray1.setTitle("Sample Title");
           Left_Tray1.setWidth("100%");
           TextView Left_Tray1_text = new TextView("Left_Tray1_text");
           Left_Tray1_text.setText("Sample Text");
           Left_Tray1_text.setEncode(false);
           Left_Tray1_text.setWrapping(true);
           Left_Tray1.addComponent(Left_Tray1_text);
           RF_All.addComponent(2,1, Left_Tray1);
           Reg_Form.addComponent(RF_All);
    That code don't display Tray in page...

    Paul,
    I suggest you  not to add the your business logic in that auto generated file.
    Instead you can have seperate java file or any Bean.
    Since you are writing the logic for layout you can add the code in the jsp file
    itself.
    If you are using HTMLB Then keep the auto generated code in the jsp otherwise remove the code and keep the file as jsp meaning you use the html, javascript,
    jsp code in the .jsp file itself.
    you can add the java code in the jsp
    <% String strName = "SAP"; %>
    <sc ript>
    al ert("<%=strName%>");
    </sc ript>
    Ram

Maybe you are looking for