0

I have created a JSP page where we use JSF custom tags. This page includes another JSP page where we defined few more input parameters. Please find the code below

Page 1:

<f:subview id="body">
        <h:form id="page1">
            <h:outputText value="<h2>Data</h2>" escape="false" />
            <jsp:include  page="Page2.jsp" flush="true"></jsp:include>
            <h:commandButton id="button" type="submit" action="#doSomethingBean.doSomething}" 
                value="Submit" title="Submit" alt="Submit"/> 
        </h:form>
        </f:subview>

Page2.jsp :

    <f:verbatim>
           <!-- Content box -->
            <ul class="summaryTable"> 
             <li> <span> 
             </f:verbatim>              
                <h:outputText value="Value: "/> <f:verbatim>Check out sir</span></f:verbatim>   
                <h:outputText value="#{User.userName}" escape="false"/>
            <f:verbatim>                
                </li>
                <li> <span>


         </f:verbatim>           

Generated HTML code:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <body>
    <form id="content:body:page1" method="post" action="/DummyApp/DoSomething.jsp" class="contentBox" enctype="application/x-www-form-urlencoded">

          <h2>Data</h2>

        <form id="content:body:page1:body:page2" method="post" action="/DummyApp/DoSomething.jsp" class="contentBox" enctype="application/x-www-form-urlencoded">

        <ul class="summaryTable"> 
             <li> <span> 
             Check out sir</span> Renga

        </form>

    <input id="content:page1:body:button" type="submit" name="content:page1:body:button" value="Submit" onclick="clearFormHiddenParams(this.form.id);" alt="Submit" title="Submit" class="no-arrow" />

    </form>
    </body>
    </html>

If you see the generated HTML code it is unnecessarily embedding the included file in a form tag. Because of this, whenever I click the submit button is throwing a javascirpt error stating Object not found.

I am using JSF 1.1 and WAS 7 server.

Thanks in advance for the help.

Regards, Renga

Jubin Patel
  • 1,959
  • 19
  • 38
Rengasami Ramanujam
  • 1,858
  • 4
  • 19
  • 29
  • First of all `page2.jsp` is full of opened tags (invalid XML), I would start with fixing that. – klimpond Apr 04 '14 at 10:49
  • Secondly, if you can, move away from JSP and get accustomed with facelets. I understand it often depends on other stuff, but JSP really is done and dusted, and for good reason. – Steven De Groote Apr 04 '14 at 14:59

0 Answers0