Jsp:include doesn't work in JSF (Trinidad)

Hallo,
first: i'm a newbe in JSF - so sorry for stupid questions.
I would like to include a page with some trinidad-tags in my jsf-page (into the body).
But running the application the included page isn't shown. Looking to the generated html-code the included code is shown between the head- and body-tag -> not rendered as html-tag but still as trinidad-tags.
I do not understand why :(
I tried to integrate my jsp:inlcude with <f:subview> and also with <h:panelGroup> but without different results. Also I've tried to use <jsp:directive.include> but nothing different happens.
Does anybody know what I'm doing wrong?
Thanks for help

The way I include another faces file is to use the following syntax:
<body>
<jsp:include page="/header.jsp"/>
the header.jsp file is a file that contains JSF components, but its included using the jsp extension since you already within the mist of a request.
And in the included file, you MUST have everything surround with a subview tag with an ID attribute...
<f:subview id="headerView">
</f:subView>
And lastly, something to always remember...everything in your included page must be contained within JSF components. You cannot have straight html, it must be surrounded with verbatim tags. The reason being when the page is included, the components from the page are included into the main pages component tree. The HTML from those components is output and then any regular html markup in the page is output AFTER the components output.

Similar Messages

  • Jsp:include doesn't work with Tomcat & IIS

    Hi, Guys,
    I installed IIS4.0 and Tomcat in my windows NT system. http://localhost/examples/jsp/index.html works fine.
    When I load http://localhost:8080/about.jsp, it's also working fine. But when I load http://localhost/about.jsp, it will ignore the part which the line is display as
    <%String topName = "/servlet/topServlet";%>
    <jsp:include page="<%=topName%>" flush="true"/>
    The other part will work just as a html file. And I didn't get any error message.
    Would can tell me how to figure out this problem. Thank in advanced very much!

    Oh, God, why not tell me earlier!!!!!! I do use tomcat 3.1 and it just support servlet. I have no way out but modify all my jsp:include to encoding into a servlet page. I almost re-do all my work. But anyway, thank you! Next time I will know.

  • CommandButton doesn't work in JSF fragment?

    Hi all,
    Why commandButton doesn't work in JSF fragment? while I set partialSubmit as true!
    As following:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:h="http://java.sun.com/jsf/html">
    <af:inputText label="Your Name" id="it1"/>
    <af:inputDate label="BirthDate" id="id1"/>
    <af:commandButton partialSubmit="true" text="Calculate Age" id="cb1"/>
    <af:outputText id="ot1"/>
    </jsp:root>
    Thanks in advance :)))

    The full jsff code is:
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:h="http://java.sun.com/jsf/html">
    <af:inputText label="Your Name" id="it1" binding="#{fragment_bean.it1}"/>
    <af:inputDate label="BirthDate" id="id1" binding="#{fragment_bean.id1}"/>
    <af:commandButton partialSubmit="true" text="Calculate Age" id="cb1"
    binding="#{fragment_bean.cb1}"
    action="#{fragment_bean.cb1_action}"/>
    <af:outputText id="ot1" partialTriggers="cb1" value="test"
    binding="#{fragment_bean.ot1}"/>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:fragment_bean-->
    </jsp:root>
    Java Bean is generated using "Auto Bind" feature in Jdeveloper 11.1.1.3.0:
    public class fragment_bean {
    private RichOutputText ot1;
    private RichCommandButton cb1;
    private RichInputDate id1;
    private RichInputText it1;
    public fragment_bean() {
    public void setOt1(RichOutputText ot1) {
    this.ot1 = ot1;
    public RichOutputText getOt1() {
    return ot1;
    public void setCb1(RichCommandButton cb1) {
    this.cb1 = cb1;
    public RichCommandButton getCb1() {
    return cb1;
    public void setId1(RichInputDate id1) {
    this.id1 = id1;
    public RichInputDate getId1() {
    return id1;
    public void setIt1(RichInputText it1) {
    this.it1 = it1;
    public RichInputText getIt1() {
    return it1;
    public String cb1_action() {
    // Add event code here...
    System.out.println("Hi test !!!");
    return null;
    }

  • JSP include directive not working with Tomcat 5.0

    Hi.
    I'm developing a small JSF webapp under Tomcat 5.0. My idea was to use the include directive to display a navigation panel on every JSP page.
    I took the code straight from the Java Web Services Tutorial; the resulting page looks like this:
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
           version="2.0">
    <jsp:directive.page contentType="text/html;charset=iso-8859-1"/>
    <%@ include file="/jsp/panelpage_header.inc" %>
         <h:outputText value="Welcome!"/>
    <%@ include file="/jsp/panelpage_footer.inc" %>
    </jsp:root>However, when I try to load the page, a compilation error occurrs:
    org.apache.jasper.JasperException: /trias/welcome2.jsp(11,2) The content of elements must consist of well-formed character data or markup.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    ...I checked the path to the included files, and it seems to be okay. The files themselves contain the JSF tags for the view, html-head, html-body etc. The compiler doesn't even care if the files exist or not because it aborts immediately when it reaches the first include-statement.
    Did anyone see this kind of error before?

    Ok, the solution with jsp:directive.include works,
    if header.inc and footer.inc themselves are well
    formed too. If I understood the concept right this is
    because header and footer are processed during
    request time and therefore interpreted as
    'standalone' pages.This isn't true. The include directive (<jsp:directive.include>) is run a Compile Time. The code is inserted directly into the surrounding JSP (unlike <jsp:include> which forwards the request at runtime). The finished JSP, after the include, is then processed and needs to be well-formed XML.
    >
    But: What can I do when these two files define a tag
    that should enclose my current page (for example,
    header opens a panelGrid-Tag, and footer closes it).
    For this case I thought the use of the
    @include-directive would be neccessary to combine the
    three pages during compilation. By this the resulting
    page would be well-formed although header and footer
    are not.It should be, as long as you are using <jsp:directive.include>, and the rest of the included pages are also well formed (no <% %> tags, nothing else out of place...).
    Honestly, I haven't done much work with JSP documents, so I haven't run into this problem. But I do believe everything I said is correct.
    What I would do is double check the correctness of the rest of the included pages and see if your error isn't something else.

  • Jsp:include does not work in 8.1 SP3?

    Hi all,
              I need to include a local file (external to the app) in jsp code. The external file includes an image map which changes very so often. So in order to avoid doing a build everytime, I thought about keeping the image map in a file which can be "included" in the jsp file, making it very dynamic to a change.
              So I have a servlet which will read this file and output the contents to response.getWriter(), which will be included in calling jsp code.
              But the jsp file does not seem to call the servlet at all.
              Here is the code in the jsp file:
              <%
              String sFileUrl = "/Prj/RenderReport?file=OrgChart.html";
              %>
              <jsp:include page="<%=sFileUrl%>" />
              What am I doing wrong? Is this not possible at all?
              Thank you all in advance.

    hi pjoshi,
              <jsp:include page="hello.jsp" /> tag is working fine in weblogic 8.1 sp3.
              I think it might be syntax error in your jsp page.
              This is the syntax to including dynamic files in jsp using <jsp:include page="" />tag as given below.
              <jsp:include page="{relativeURL | <%= expression %>}" flush="true" />
              go through the below link and you will find exact information how to include dynamic files in jsp using <jsp:include page=""/>
              http://java.sun.com/products/jsp/syntax/1.1/syntaxref1112.html
              --Anilkumar kari                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • #include Doesn't work in AE CS4

    Anyone have a work around for the "#include" javascript in CS4. Used an external file to drive some text in my comp in CS3, but the same script doesn't work in CS4. I even downloaded a comp from the
    Graymachine.com
    website to check and it didn't work either.
    I'm on a MAC, by the way.

    The problem is that whatever is in the file has to be valid JavaScript syntax. I think it would be tricky to get that to work with a bunch of spreadsheet data.
    Dan

  • Upload file jsp code doesn't work? How can I debug

    Hi Everyone,
    I have the following jsp code that simply adds a new product to the backend database when 'Continue' button is pressed.
    if( "Continue".equals(fp.getParameter("Submit")) ) {
         fp.setParameters(prodForm);
         prodForm.setCreateBy(currentUser.getUserID());
         prodForm.save();
         String filename = fp.getFilename("file");
              if( filename != null ) {
              // a file was uploaded
              // set the path to save it
              fp.setFilePath(PHYSICAL_PATH + "uploads\\");
              // we will change the filename to make sure it is unique
              // need to keep the file type
              String fileType = "";
              try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
              catch( Exception e ) { fileType = ""; }
              fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
              prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
              prodForm.save();
         db.close();
         response.sendRedirect("index.jsp");
         return;
    }The code works fine but the upload doesn't work. This is the upload part of the above code:
    String filename = fp.getFilename("file");
              if( filename != null ) {
              // a file was uploaded
              // set the path to save it
              fp.setFilePath(PHYSICAL_PATH + "uploads\\");
              // we will change the filename to make sure it is unique
              // need to keep the file type
              String fileType = "";
              try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
              catch( Exception e ) { fileType = ""; }
              fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
              prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
              prodForm.save();
         db.close();
         response.sendRedirect("index.jsp");So if the file browser, <input type="file" name="file">, has a file, then it saves the file in the upload folder and saves the filename in the database. But it doesn't work, it doesn't save the file in the upload folder nor it saves the filename in the database. I am new to java and jsp so could you tell me what error checking or deguging I can do in jsp to spot the problem.
    Thanks,
    Zub

    where u write the code to upload the file
    to server end?

  • jsp:setProperty doesn't work with short properties

    Hi,
              Setting bean properties doesn't work with properties that are of type short.
              Any ideas what's going on? I'm using WLS 6.1SP1 on W2K.
              --John
              <jsp:useBean id="test" scope="session" class="test.Test" />
              <jsp:setProperty name="test" property="*" />
              -- Test.java
              package test;
              * @author john
              public class Test {
              /** Creates new Test */
              public Test() {
              public short getShort() {
              return 0;
              public void setShort(short val) {
              Produces the following error while attempting to compile the jsp:
              Compilation of
              'C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              warCleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java'
              failed:
              C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              setShort(short) in test.Test cannot be applied to ()
              probably occurred due to an error in /test.jsp line 7:
              <jsp:setProperty name="test" property="*" />
              C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java uses or
              overrides a deprecated API.
              Full compiler error(s):
              C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              setShort(short) in test.Test cannot be applied to (<null>)
              test.setShort(null); //[ /test.jsp; Line: 7]
              ^
              Note:
              C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java uses or
              overrides a deprecated API.
              Note: Recompile with -deprecation for details.
              1 error
              Fri Nov 09 00:24:58 PST 2001
              [test.war]
              

    It looks like a bug in JSP generator. If you look and the .java
              created by 6.1 it doesn't make any sence:
              String _propertyValue = request.getParameter("short");
              if (_propertyValue != null && !_propertyValue.equals(""))
              test.setShort(null);
              (needless to say that this works correctly in Resin).
              John Hampton <[email protected]> wrote:
              > Thanks for reply,
              > Changing getShort and setShort to getId and setId makes no difference. I
              > still get the error described below:
              > C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp_
              > war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              > setId(short) in test.Test cannot be applied to (<null>)
              > test.setId(null); //[ /test.jsp; Line: 7]
              > John
              > "Jignesh" <[email protected]> wrote in message
              > news:[email protected]...
              >>
              >> hi,
              >> i think you have not given the property name properly.
              >> give some other name than short becuase short is the keyword (data-type)in
              > java.
              >> bye,
              >> Jignesh
              >>
              >>
              >> "John Hampton" <[email protected]> wrote:
              >> >Hi,
              >> >
              >> >Setting bean properties doesn't work with properties that are of type
              >> >short.
              >> >Any ideas what's going on? I'm using WLS 6.1SP1 on W2K.
              >> >
              >> >--John
              >> >
              >> ><jsp:useBean id="test" scope="session" class="test.Test" />
              >> ><jsp:setProperty name="test" property="*" />
              >> >
              >> >-- Test.java
              >> >package test;
              >> >
              >> >/**
              >> > *
              >> > * @author john
              >> > */
              >> >public class Test {
              >> >
              >> > /** Creates new Test */
              >> > public Test() {
              >> > }
              >> >
              >> > public short getShort() {
              >> > return 0;
              >> > }
              >> >
              >> > public void setShort(short val) {
              >> > }
              >> >}
              >> >
              >> >Produces the following error while attempting to compile the jsp:
              >> >
              >> >Compilation of
              >>
              >>'C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tm
              > p
              >> >warCleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java'
              >> >failed:
              >>
              >>---------------------------------------------------------------------------
              > -
              >> >----
              >>
              >>C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              > _
              >> >war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              >> >setShort(short) in test.Test cannot be applied to ()
              >> >probably occurred due to an error in /test.jsp line 7:
              >> ><jsp:setProperty name="test" property="*" />
              >> >
              >>
              >>C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              > _
              >> >war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java
              >> >uses or
              >> >overrides a deprecated API.
              >> >
              >>
              >>---------------------------------------------------------------------------
              > -
              >> >----
              >> >Full compiler error(s):
              >>
              >>C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              > _
              >> >war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java:104:
              >> >setShort(short) in test.Test cannot be applied to (<null>)
              >> > test.setShort(null); //[ /test.jsp; Line: 7]
              >> > ^
              >> >Note:
              >>
              >>C:\bea\wlserver6.1\config\cleanoffer\applications\.wlnotdelete\WEB-INF\_tmp
              > _
              >> >war_CleanOffer Server_CleanOffer Server_test\jsp_servlet\__test.java
              >> >uses or
              >> >overrides a deprecated API.
              >> >Note: Recompile with -deprecation for details.
              >> >1 error
              >> >
              >> >
              >>
              >>---------------------------------------------------------------------------
              > -
              >> >----
              >> >Fri Nov 09 00:24:58 PST 2001
              >> >
              >> >
              >> >
              >> >
              >> >begin 666 test.war
              >> >M4$L#!!0`" `(`,@`:2L````````````````4``0`345402U)3D8O34%.249%
              >> >M4U0N34;^R@``X^4"`%!+!PBLA:(4! ````(```!02P,$% `(``@`R !I*P``
              >> >M``````````````\```!714(M24Y&+W=E8BYX;6RE4DMOVS ,/L^ _P/GTP9,
              >> >M4NH=M@YIBC3I@ )M&G3IAIX*1V9B!;)D6'0>WY2GDT6# /FD&1WX,4V]?+
              >> >M4L,<:Z>LN4HN>"L!--+FRDRODN?1=_8UN>[$4?L]8W$$)]^/QL"P&6LEX5Y)
              >> >M- YA8,G_Q5$<C0H$:0VA(0=V`E0H!Q.E$;(:P37C&4H"LKZ 9Y3BZ.<F%?A0
              >> >M\"$T)=M2\I'#BVV@S%9@+$'C?0_JN)18$2@31]*6E5:9D0@+1<7:::O!H>O3
              >> >M5:M-LCT,7B6;9TIGXQ"4XJ@@JKX)L5@LN&L,]Y)B-]UCK:;*9!IZ-E\S!T@W
              >> >MF!G'(93OC"+EJWV<H[85UCNO'2^.=L0P_H.2M74K1UBZ3YXL.0QM37X#SAM4
              >> >M*T\J""XN+[^PM-5J!4X<G2%UM8:GT.O@"1W6<\QY'#'6";'#2_8?>Z.7X2TL
              >> >M<,RRJMH\Z_#YYOZN!PD3XGP8(?JC/OS",70KOU29A620\E2(VT&R$4FVRYKY
              >> >M%>ZW-4L114ZY$UO#U_0UY1Y(UHG:6[2SD6@[=.'5F3^=B9IV#D>WKY JT3;4
              >> >M.;['SZTWK>)\[P$_4O<1M$^*+-P/T\J%_G='Z(F9,CDN^<Q5;SU/^O]!H*!2
              >> >M_[?"7P3^!'?3M<5A[;\!4$L'"/]33>'A`0``! 0``%!+`P04``@`" #(`&DK
              >> >M````````````````" ```'1E<W0N:G-P-4X[#L(P#-US"A.I"P/>D1LAQ,14
              >> >MB5X@M!84M4E4&XG>GJ:!R<_OIT?5*?D'0Q>#<M!V25Q;Y8_B4Z?15LY0!OFP
              >> >M[QWIH".[ZZV!9HT1EI]P4PW=8[\X8^@EZ?@6/K,/,/2Y4=2"=#'7"XL,,5CH
              >> >M1B]2Q$.[.="5K+ V\VJ>=8'@)_XW0/JQM=T7=W+F$@/O=H9PQ81E`F&9_050
              >> >M2P<(E)0WZYL```#@````4$L#!!0`" `(`,@`:2L````````````````?````
              >> >M5T5"+4E.1B]C;&%S<V5S+W1E<W0O5&5S="YC;&%S<TV/OT[#,!#&OTO2IDT+
              >> >M_4.I6-D*`C(@)A +$E,$0ZKN3K!:5R&1$K=/Q<*$Q, #\%"(LQ-%]7!W_MU]
              >> >MW]F_?]\_<'&-><#IQ,?,QRFA^Z!RI1\)[N)B1?">BC=)&$4JER^[]T262Y%D
              >> >M3*91D8IL)4IE[@WT]$95A$&D9:7#)8=[0F\M=;PI2FT]8P95"[Q%;+:X>Y$1
              >> >MB'M!7.S*5#XK8]<W#C=;L1=#>.@P:'T)8\/#3.3K\#79RE3C' [_Q!P79 0<
              >> >MNWR[Y4R<.Y=?H$\N'/@<`\[ F <GZ'$UK(?0YPZX'EAB#*X:`\?]:-5=2V8'
              >> >M2J=5'N&X4=Y9CL.UM?#,"N=ULQ&::L0/,LLF=G[Z#U!+!PA>>AD-#@$``*4!
              >> >M``!02P$"% `4``@`" #(`&DKK(6B% 0````"````% `$````````````````
              >> >M````345402U)3D8O34%.249%4U0N34;^R@``4$L!`A0`% `(``@`R !I*_]3
              >> >M3>'A`0``! 0```\`````````````````2@```%=%0BU)3D8O=V5B+GAM;%!+
              >> >M`0(4`!0`" `(`,@`:2N4E#?KFP```. ````(`````````````````&@"``!T
              >> >M97-T+FIS<%!+`0(4`!0`" `(`,@`:2M>>AD-#@$``*4!```?````````````
              >> >M`````#D#``!714(M24Y&+V-L87-S97,O=&5S="]497-T+F-L87-S4$L%!@``
              >> >0```$``0`!@$``)0$````````
              >> >`
              >> >end
              >> >
              >>
              Dimitri
              

  • jsp:include is not working on weblogic

    I have a problem I write the following code
    html>
    <head>
    <script LANGUAGE="javascript" SRC="js/tab.js"></script>
    <LINK href="stylesheets/global.css" type=text/css rel=stylesheet>
    <title>JobSpinner Status</title>
    </head>
    <body class="bodymargin" onload="setpage(1)">
    <jsp:include flush="true" page="JobSpinnerTab.jsp"></jsp:include>
    <form id="loginForm" action="/jobspinner/JobStatus.faces" method="post">
    <input type="hidden" name="loginForm" value="loginForm" />
    <nobr>
    It is working fine on four to five PC we have checked .
    But the problem is that it is not working on a particular weblogic Server 8.1 SP2 .
    Can someone help me .
    Regs
    Amit Verma

    Are other JSP tags working on the page?
    eg
    Server info = <%= application.getServerInfo() %> <br>
    Servlet engine version = <%=  application.getMajorVersion() %>.<%= application.getMinorVersion() %><br>
    Java version = <%= System.getProperty("java.vm.version") %><br>
    Java home = <%= System.getProperty("java.home") %><br>Your page might be being interpreted as HTML rather than passed through the JSP engine.

  • Include doesn't work for 5.1

     

    I have also run into this issue. While changing to a relative
              path works in the case shown below, it does not change the fact
              that jspc worked with full paths (from the document root) in
              4.5.1 and that this functionality is broken in 5.1. Are there
              any plans to fix this?
              I have tried variations of the -docRoot and -contextPath
              parameters for jspc, but there seems to be no way to make
              it work properly.
              thanks,
              Steve
              Winston Koh wrote:
              >
              > try <%@ include file="FooInclude.jsp" %>
              > since its relative to the current directory of Foo.jsp
              >
              > thanx
              >
              > Winston
              >
              > liyang zhou <[email protected]> wrote in message
              > news:[email protected]...
              > > Hi all:
              > > I am upgrading weblogic 451 to weblogic510 and run into the
              > > following
              > > problem. I have the following files
              > > /public_html/jsp/common/Foo.jsp
              > > /public_html/jsp/common/FooInclude.jsp
              > >
              > > Foo.jsp has something like
              > > <%@ include file=/jsp/common/FooInclude.jsp" %>
              > > ...
              > >
              > > When I compile, I do
              > > cd /public_html
              > > java weblogic.jspc -classpath ... -package ... -d ... -keepgenerated
              > > -options jsp/common/Foo.jsp
              > >
              > > I have _Foo.java generated with OK with following message
              > > // cannot include file '/jsp/common/FooInclude.jsp' ...
              > >
              > > If I compile the same thing under weblogic 451, it works.
              > >
              > > I have tried all options flags for weblogic.jspc(rootdoc,
              > > contextPath....), non seems to make the
              > > include work.
              > >
              > > I did a java weblogic.jspc -version and here is the result
              > >
              > > weblogic.jspc version 5.1.0 04/03/2000 17:13:23 #66825
              > >
              > > I am running solaris 2.7 with jdk1.1.7B
              > >
              > > Any ideas?
              > >
              > > thanks
              > > liyang
              > >
              > > [email protected]
              > >
              

  • JSP actionListener doesn't work

    I am new to JSP and all this web application stuff. (Sorry if I am in the wrong forum).
    I have created a jsp "webpage" with a few textfields and a button. I want the jsp to send the information from the textfields to a mySQL table via JDBC Connection. The connection works(I have tested it in my init() meyhode and it worked), but if I add an action Event (with NetBeans and Sun Studio Creater) to the button, and I press the button nothing happens.
    I have tried to put diffrent code into the methode, like change the text of a lable or give a popup frame, but if I press the button nothing happens.
    Here is the listener for the button, it has been added to the button:
        private static final String DRIVER = "com.mysql.jdbc.Driver";
        private static final String DATABASE_URL = "jdbc:mysql://localhost/P";
        private static final String USER = "jhtp7";
        private static final String PASS = "jhtp7";
        private static Connection connection = null;
        private static PreparedStatement insert = null;
        private int __placeholder;
        private void _init() throws Exception {               //the init methode
             Class.forName(DRIVER);
             connection =DriverManager.getConnection(DATABASE_URL, USER, PASS);
            insert = connection.prepareStatement("insert into pp (Number, Name) values (?, ?)");
    public String button3_action() {         //the action event for the button
            try{ 
            insert.setInt(1,4);
            insert.setString(2, "fghfghfghfghfgh");
            insert.executeUpdate();
            }catch (SQLException ee){
            return null;
        }Can anyone tell me what I have done wrong, or how to write a normal ActionListener(like in normal java) and add it to the button???

    You can't. The code that is produced by JSP is HTML, not Swing and not AWT. Which means you can't use the Java Event Dispatching to work with the GUI.
    You will need to put the input into an HTML <form> with an action to a servlet. You will need to submit the form using an <input type="submit"> and you will need a servlet that processes the incoming parameters and makes the JDBC call. Read the [JEE 5 Tutorial|http://java.sun.com/javaee/5/docs/tutorial/doc/], particularly the first few chapters, and learn HTML.

  • My JSP Report doesn't work !!! Help me !!!

    What's up friends! I holp that so good!
    My question is very simple, I've been building a JSP Report with JDev and Report Builder, but when I has tryed to run the report from inside JDev, the IE has started with the LOADING... page and nothing happened.
    I have Oracle9iDS and Oracle91AS installed on the same machine, I started the HTTP Server and Oracle9i Report Service before run the report.
    I've been reading a lot of documents but I don't know what I need to do.
    What is missing to configure to work well?
    Please, help me!!!

    You need to create a JSP report from JDev's new object gallery from 'File -> new... -> Reports Objects', so that the project settings can be prepared to run JSP report.
    If you want to run JSP report on a standalone Reports server, put 'server=<server_name>' in 'parameters' attribute of <rw:report> JSP tag.
    You can also use rwservlet's in-process Reports server, by not specifying 'server=...' in 'parameters' attribute. No standalone Reports server is needed. Make sure JVM is set to'hotspot' in JDev's project settings -> runner.
    When running JSP in JDev, it uses JDev's embedded oc4j web server.
    Regards,

  • Javascript error with f:subview and jsp:include

    Hi,
    I have tried to include one jsp page with jsf components into another jsp page with jsf components. But somehow I get a Javascript error.
    I have of course included the jsp:include into an f:subview like this:
    <f:subview id="tree" rendered="#{tabsBacker.treeRendered}">
    <jsp:include page="mission.jsp" />
    </f:subview>In mission.jsp, all non-jsf tags are surrounded by f:verbatim tags (otherwise, JBoss would complain anyway).
    The Javascript error says: "elements.form1:_link_hidden_ is null".
    "form1" is the name of the form in my jsp page which includes the other one.
    As soon as I remove the jsp:include thing, everything works fine. The include happens in a t:panelTabbedPane, and (probably as a result of the javascript error), the tab where the included page should be shown, can't be displayed. I can click on the tab, the page is reloaded, but nothing else happens.
    The error occurs in IE and in Firefox.
    Can anyone help me to solve this problem??
    Kind regards,
    Wiebke

    It's just a jsp fragment file. Here's the start of the jspf included above:
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx" %>
    <f:subview id="browseForm">
    <table class="box" width="100%">
         <tr>
              <td><h:outputText value="#{labels.someValue}" styleClass="smalltitle"/></td>
         </tr>And so on. This was just done to stop the jsp files becoming too long, I think. So the subview tag is included in the jspf file rather than around the jsp file as you have it.
    Illu

  • Calling custom tags in jsp  with jsp:include

    Hi,
    I have a large jsp file , which uses jstl fmt tags for labels.
    Since the size of jsp was too big iand i was unable to compile it because of 64 kb class size limit,
    I removed the tag lib defination from the jsp file and put it in another jsp file. and used jsp:include to include this file inside the first jsp.
    It is compiling successfully but labels r not showing up.
    but when i use <%@include to include second jsp in the first one i get the labels properly.
    I cannot use <%@include as this starts giving me compilation error related with jsp class file size beyond 64 kb.
    Pls suggest why jsp:include is not working.
    thanks,
    Pramod

    Hi Anil,
    Ur suggestion was good but could not solve my problem.
    I have put a small sample code to illustrate the problem.
    labeldemo.jsp:
    <%-- <%@ include file="WDCComInitLabelsjunk.jsp" %> --%>
    <jsp:include page="WDCComInitLabelsjunk.jsp" flush="true" />
    <table width="100%" cellpadding="3" cellspacing="0" border="0" class="tablebg">
                                  <tr class="headtd">
                                       <td colspan="4"><span class="headtext"><fmt:message key="Cash_Management"/> </td>
                                  </tr>
                                  <tr> hi </tr>
                             </table>
                             </fmt:bundle>
    WDCComInitLabelsjunk.jsp:
    <%@ page language="java" %>
    <%@ page contentType="text/html"%>
    <%@ page import="com.tcs.wdc.core.*" %>
    <%@ page import="com.tcs.wdc.core.login.*" %>
    <%@ page import="com.tcs.wdc.core.service.navigation.*" %>
    <%-- Include tag library --%>
    <%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
    <%-- Get language from IDCUserSession & set it in session --%>
    <%
    /*SessionManager sm = new SessionManager(session);
    IDCUserSession ius = sm.getIDCUserSession();*/
    session.setAttribute("language","nl_NL");
    %>
    <%-- Set the locale for the language obtained --%>
    <fmt:setLocale value="${language}" />
    <fmt:bundle basename="labels" />
    If i uncomment the <%@ include file="WDCComInitLabelsjunk.jsp" %> tag in the code above it is working fine ,
    but it is not working with <jsp:include page="WDCComInitLabelsjunk.jsp" flush="true" />
    pls suggest.
    Thanks,
    Pramod

  • GWT generated file doesn't work when included in jsp

    Hi all,
    I'm trying to use GWT in my Spring application. I want to include
    the .html file generated by GWT in my .jsp. When I run my application,
    and view the source of page, I saw that the HTML is included, but it
    seems that the gwt:module can't be loaded.
    The meta tag in html is:
    <meta name='gwt:module' content='com.mycompany.dmc.gwt.MyApplication'>Note that jsp and html files are in the same directory.
    When I call the html file from browser, it works fine, but included in
    the jsp it doesn't.
    Any suggestions are appreciated.
    Thanks in advance.

    Hi,
    You can put a copy of your master page within the template site, use that for the site's master page, and then save the site as a template then check whether it works.
    Here is a similar thread for your reference:
    http://sharepoint.stackexchange.com/questions/30699/featureactivated-not-called-for-site-template
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

Maybe you are looking for

  • Win 7 pro / Deskjet 1280

    I'm trying to install a Deskjet 1280 on my new  Windows 7 pro  pc .... cannot find a driver for it..

  • LMS 4.0.1 fails on updating switch sw (3750ME, 2960S)

    Hi, Newly installed LMS 4.0.1 fails when upgrading switch software. From sw distribution job logs, it looks like that LMS does not recognize switch properly. This happens with 3750 Metro and 2960S switches (at least those I've tested). Attached file

  • Imovie, i can't see my project files and events, and won't make new ones!?

    When opening imovie (11) i cant see eny off my events or project files and i cant make new ones or import files. But i still se my events and project if i go to User-Film-Imovie Projects/Events...!? Message was edited by: Seb K S

  • Meaning of business place and section code

    Dear Friends, Can anybody tel me the meaning of business place and section code. Regds Rahul Jain

  • Error code: -8006 Resource error

    When I try to log on in Data transfer appears this message Error code: -8006 Resource error Can you tell me what can I do? A friend told me that we need delete a carpet, but he doesnt remember the location Can you help me with this I will apreciate y