You cannot combine JSP and JSTL to my knowledge. If you want to use
JSTL with JSF, use facelelets and remove all JSP code (<%%>). I would
recommend not using JSTL (or JSP) code for JSF pages, they don't play
that well together. Facelets does support some of the JSTL
functionality, but the author (Jacob) recommends that you do not use
JSTL if at all possible.

The best thing for conditional rendering (if logic) is to use the
rendered attribute and when grouping components use the panelGroup
component. If looping, the Tomahawk dataList control is very useful.

On 7/25/06, Jorge Vásquez <[EMAIL PROTECTED]> wrote:




Regards to all,

I am migrating a pure JSP+Servlet Application to JSF and I have encountered
some really particular behaviours.  I decided to use a mixture of JSF + JSTL
+ Pure HTML in order to make the migration less painful but I am considering
migrating everything to pure JSF due to the strange things that are
happening.

For instance, in the following code fragment:






<c:choose>

                    <c:when
test="${sessionScope.appStateBean.currentTool == 0}">

                             <td><img id=qrLeft
src="<%=request.getContextPath()%>/pages/images/timages/tab_left_gray.gif"
Title="" border="0"></td>

                             <td id=qrMiddle
background="<%=request.getContextPath()%>/pages/images/timages/tab_middle_gray.gif">

                                   <img
src="<%=request.getContextPath()%>/pages/images/timages/blank.gif" width="2"
height="1" Title="">

                                   <NOBR>

                                   <h:commandLink
immediate="true" action="#{appStateBean.changeTab}" styleClass="blue">

                                    <h:outputText value="Search"/>

                                    <f:param name="tab" value="0" />

                              </h:commandLink>

                              </NOBR>

                              <img
src="<%=request.getContextPath()%>/pages/images/timages/blank.gif" width="2"
height="1" Title="">

                        </td>

                        <td><img id=qrRight
src="<%=request.getContextPath()%>/pages/images/timages/tab_right_gray.gif"
Title="" border="0"></td>

                        <td width=5></td>

                    </c:when>

                    <c:otherwise>

                             <td><img id=qrLeft
src="<%=request.getContextPath()%>/pages/images/timages/tab_left.gif""
Title="" border="0"></td>

                             <td id=qrMiddle
background="<%=request.getContextPath()%>/pages/images/timages/tab_middle.gif">

                                   <img
src="<%=request.getContextPath()%>/pages/images/timages/blank.gif" width="2"
height="1" Title="">

                                   <NOBR>

                                   <h:commandLink
immediate="true" action="#{appStateBean.changeTab}" styleClass="white">

                                    <h:outputText value="Search"/>

                                    <f:param name="tab" value="0" />

                              </h:commandLink>

                              </NOBR>

                              <img
src="<%=request.getContextPath()%>/pages/images/timages/blank.gif" width="2"
height="1" Title="">

                        </td>

                        <td><img id=qrRight
src="<%=request.getContextPath()%>/pages/images/timages/tab_right.gif"
Title="" border="0"></td>

                        <td width=5></td>

                    </c:otherwise>

                  </c:choose>








The commandLink doesn´t gets rendered at all, I don´t know if there are some
issues when a commandLink gets inside a conditional JSTL tag?



Another curious issue is the following line:






              <td valign=middle
class=welcome>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a:internationalizedText
textId="Search" groupId="topmenu"/>

                  <h:outputText
value="#{authenticationBean.userId}"/>(<h:outputText
value="#{authenticationBean.serverAddress}"/>:<h:outputText
value="#{authenticationBean.serverPort}"/>)

               </td>






The output text appears in the html code next to the form as follows



<form id="topMenu:topMenuForm" name="topMenu:topMenuForm" method="post"
action="/aleroclJSF/pages/tools/search/mainSearch.jsf"
enctype="application/x-www-form-urlencoded">SearchSUPER192.168.1.1182102AboutLogoffHelp…………………







I am almost decided to change the style and use pure JSF but I am not quite
sure how to accomplish conditionals with JSF EL, for instance is it possible
to compare managedBeans' values with nulls, or constants?  Can anyone give
me some examples of sophisticated conditionals using JSF EL with the
rendered option?





Thanks to all,

JV




Reply via email to