Need Suggestion on including JSTL Tags with JSF

Hi..All....
I need some suggestions.. i Started doing a project in JSF.. i am new to JSF...
I Developed some part of the project in Struts.. but now.. our clinet says... The Application Has to go
with JSF.so.. started redesigning again....
Can i use JSTL...where ever i want....when i am developing a JSF Application...
Please suggest..me...
Thanks.. for the Help..
Arthi

I am freely mixing jstl and jsf in my project using:
JSTL RI 1.2
JSF RI 1.2
Tomcat 6
i am mixing c:forEach and h: tags successfully, which i needed for some javascript functionality that i could not do with data table. but stick to JSF wherever possible!

Similar Messages

  • Use jstl tags in jsf page

    I have h:dataTable in each row of which i'd like to output row data as text, inputfield or link depending on row data type
                        <h:dataTable id="pnlHistory" value="#{UserOrdersBean.orderLineWrappers}" var="wrapper" rendered="#{UserOrdersBean.isBasicUser}"
                                     columnClasses="history_col1, history_col2, history_col3, history_col4, history_col5" width="100%" cellpadding="5" >
                            <h:column>
                                <f:facet name="header">
                                    <h:commandLink action="doRefresh" actionListener="#{UserOrdersBean.doSort}">
                                        <h:outputText value="#{msg.userorders_itemName}">
                                            <f:param value="orderLineWrappers"/>
                                            <f:param value="itemName"/>
                                        </h:outputText>
                                    </h:commandLink>
                                </f:facet>
                                <h:outputText value="#{wrapper.itemName}" styleClass="itemdescription"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:commandLink action="doRefresh" actionListener="#{UserOrdersBean.doSort}">
                                        <h:outputText value="#{msg.userorders_data}">
                                            <f:param value="orderLineWrappers"/>
                                            <f:param value="data"/>
                                        </h:outputText>
                                    </h:commandLink>
                                </f:facet>
                                <c_rt:choose>
                                    <c_rt:when test="#{wrapper.type==0}">
                                        <h:outputText value="#{wrapper.data}" styleClass="basic_thin"/>
                                    </c_rt:when>
                                    <c_rt:when test="#{wrapper.type==1}">
                                        <h:inputText value="#{wrapper.data}" styleClass="basic_thin" style="width:160px"/>
                                    </c_rt:when>
                                    <c_rt:when test="#{wrapper.type==2}">
                                        <h:outputLink value="#{wrapper.data}">
                                            <h:outputText value="#{msg.userorders_link}" styleClass="basic_thin"/>
                                        </h:outputLink>
                                    </c_rt:when>
                                </c_rt:choose>
                            </h:column>
                         </h:dataTable>trying to use jstl tags but unsuccessfull. Is it ever possible user jstl tags in jsf tags like listed above

    Replace the c:choose block by<h:outputText value="#{wrapper.data}" styleClass="basic_thin" rendered="#{wrapper.type == 0}" />
    <h:inputText value="#{wrapper.data}" styleClass="basic_thin" style="width:160px" rendered="#{wrapper.type == 1}" />
    <h:outputLink value="#{wrapper.data}" rendered="#{wrapper.type == 2}">
        <h:outputText value="#{msg.userorders_link}" styleClass="basic_thin"/>
    </h:outputLink>

  • Combing jstl/xml tags with jsf - can't pass parameter

    I'm using the jstl/xml tags to parse portions of an xml document. For some value of an attribute I want to render a search link, many of these links may be rendered on a page and I need to track which one has actually been selected using the id of the generating xml element.
    This is what I've tried, both using h:commandLink and a f:param and t:commandLink (tomahawk) and a t:updateActionListener.
    It doesn't seem to be possible to expose the resolved value of the xpath ="@id" in any way that either the tomahawk or core jsf tags can see.
    <x:when select="$control[@type='SEARCH']">
    <input type="text" id='<x:out select="@id"/>' disabled="true">
    <x:set var="selectedId" select="@id"/>
    <h:commandLink action="#{pack.search}" value="#{msg['actionPack.label.search']}" styleClass="linkNoUnderline">
    <f:param value="${selectedID}" name="selectedID"/>
    </h:commandLink>
    <%--<t:commandLink action="#{pack.search}" value="#{msg['actionPack.label.search']}" styleClass="linkNoUnderline">
    <t:updateActionListener property="#{pack.searchingId}" value="${searchId}"/>
    </t:commandLink>--%>
    </x:when>

    The JSF and JSTL tags don't really play well together.
    Particularly conditional and looping tags.
    My suggestion would be - if you're using JSF, don't use JSTL.
    You are right in that the JSF tags don't bother with the xpath expression.
    Would it be possible to shift the xml logic into an action/bean somewhere, and just present the jsp page with a list of relevant objects?
    If I understand you are trying to determine which link was clicked on a page? In the JSF action "pack.search"?
    What method of iterating are you using? an x:forEachLoop? A datatable?

  • Genereting JSTL tags with an XSLT transformation question

    Hi there!
    I have some XML datas to display in a jsp file.
    XML content is of this type:
    <message>
    <title>A message</title>
    </message>
    The most elegent way to present them is to transform XML via xslt into xhtml.
    (that way I can externally change with ease the message formatting output without changing the jsp)
    For that, I use the cool tag
    <x:transform>
    on each xml file i want to display (with x:foreEach)
    The output produced for each xml file is:
    <div class="message">
    <h2>A message</h2>
    </div>
    My problem is now that I want to include custom tags in the generated content!
    For exemple:
    <div class="message">
    <h2>A message<c:out ...></h2>
    </div>
    My question is:
    how can I make that xslt generated tag to be executed???
    Since it is the product of an xslt transformation ,I suppose it won't be executed at all...
    Advices greatly appreciated! :)

    I'm not sure I understand what you mean when you say "how can I make that xslt generated tag to be executed???"
    You've got your XML input and the XSL-T stylesheet that will transform the XML input into an XHTML stream containing JSTL tags.
    I'm assuming that you're going to ask a servlet to pass the XML input to the XSL transformer and get the XHTML output stream. Once you have that, the servlet will write the XHTML to the HTTP response output stream, where it'll be rendered by the browser.
    I think the key is to make sure that you tell the browser that response type is a JSP (that's the only document type in which it makes sense to put JSTL tags). When the browser gets that JSP, it'll treat it like any other: generate .java code, compile that to a .class file, and then render.
    I'm not sure about efficiency, but it sure is an elegant solution. - MOD

  • Can I use c:out JSTL tag with int values?

    I am attempting to c:out an int variable in my JSP using a JSTL core tag. First is it possible to do c:out an int? Second, if it is...can anyone see anything wrong with my code?
    This is the error log I am getting:
    <Oct 7, 2008 10:20:29 AM MDT> <Error> <HTTP> <BEA-101017> <[ServletContext(id=20
    462449,name=rconnect,context-path=/rconnect)] Root cause of ServletException.
    javax.servlet.jsp.JspException: ServletException in '/WEB-INF/pages/signup/summa
    ry.jsp': An error occurred while evaluating custom action attribute "value" with
    value "${orderForm.numOtaModulesSelected}": Unable to find a value for "numOtaM
    odulesSelected" in object of class "com.echostar.rconnect.struts.formbeans.Order
    FormBean" using operator "." (null)
    This is the code:
    <c:out value="${orderForm.numOtaModulesSelected}" />where numOtaModulesSelected is defined as a private member variable of the OrderFormBean
    I have included the taglib.
    Thanks to anyone who can help

    Your OrderFormBean class needs to implement a getNumOtaModulesSelected method for that to work. The expression language won't let you get at fields, you need to access it via JavaBeans properties.

  • JSP 2.0 tags with JSF

    Hi! I'm trying to mix jsf template with JSP 2.0 tag.
    I almost did it, but still have some trouble.
    MyForm.jspf:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib prefix="tmpl" tagdir="/WEB-INF/tags" %>
    <tmpl:date bean="${MyForm}" property="date" />
    date.tag
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ attribute name="bean" type="java.lang.Object" %>
    <%@ attribute name="property" %>
    <c:set var="form" value="${bean}" scope="session"/>
    <c:set var="property" value="${property}" scope="session"/>
    <f:subview id="time">
    <h:inputText id="date" value="#{form[property]}">
    <f:convertDateTime pattern="dd/MM/yyyy" />
    </h:inputText>
    because I have to use JSP EL (${MyForm}) to pass a parameter to the tag the managed bean is not initialized, submit fails for the first time, but works after the bean being initialized.
    Again setting "property" to session scope otherwise it doesn't work, so I will have this during the session... I am lost in JSP EL/JSF EL context relation.
    Does anyone use it???
    Sincerely,
    D.

    I made a little improvement, but still have some questions...
    MyForm.jspf:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib prefix="tmpl" tagdir="/WEB-INF/tags" %>
    <tmpl:date bean="ResidentAttentionForm" property="date" />
    date.tag:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ attribute name="bean" %>
    <%@ attribute name="property" %>
    <c:set var="bean" value="${bean}" scope="request"/>
    <jsp:scriptlet>
    javax.faces.context.FacesContext.getCurrentInstance().getApplication().getVariableResolver().resolveVariable(javax.faces.context.FacesContext.getCurrentInstance(), (String)request.getAttribute("bean"));
    </jsp:scriptlet>
    <c:set var="form" value="${sessionScope[bean]}" scope="session"/>
    <c:set var="property" value="${property}" scope="session"/>
    <f:subview id="time">
    <h:inputText id="date" value="#{form[property]}">
    <f:convertDateTime pattern="dd/MM/yyyy" />
    </h:inputText>
    The problem here:
    1. how can I access from JSF EL to the tag attribute without passing it to the request??? (I've seen the question in the forum, but not the answer...)
    2. Is there a way to initialize a bean with dynamic name (<c: set var="${name}"?
    3. When we will have jsf 1.2 done? ;-) I know they said "with J2EE5", but it also has been said "J2EE5 - summer 2005" and now everyone is talking about 2006 (?). Why can't they make jsr for jsp 2.1 and jsf 1.2 before J2EE5?.
    Sincerely,
    D.

  • Need suggestions for a new printer with OS 10.9.5

    I have a 2010 HP 6500 A Plus printer that has worked well with my iMac circa 2010. Printer is not feeding paper. It won't scan. Are there suggestions for a new compatible printer for OS 10.9.5.?

    Hey Debbisita,
    Thanks for the question. It sounds like you are experiencing issues with your Printer and OS X. Before opting to purchase a new printer, you can try these troubleshooting steps to completely isolate the issue:
    Troubleshooting printer issues in OS X - Apple Support
    http://support.apple.com/ts3147
    Follow these steps until the issue is addressed:
    Make sure that the printer is powered on, has ink / toner, and that there are no alerts on the printer’s control panel. Note: If you cannot clear an alert on the printer's control panel, stop here and check the printer's documentation or contact the manufacturer for support.
    Ensure the printer is properly connected to a USB port on the Mac or AirPort base station / Time Capsule. If the printer is a network-capable printer, make sure that it is properly connected to your home network.
    Use Software Update to find and install the latest available updates. If an update is installed, see if the issue persists.
    Open the Print & Scan pane or Print & Fax (Snow Leopard) pane in System Preferences.
    Delete the affected printer, then add the printer again.
    If the issue persists, try these additional steps:
    Reset the printing system, then add the printer again.
    If the issue still persists, reset the printing system again.  Download and install your printer's drivers. Then, add the printer again.
    Contact the printer vendor or visit their website for further assistance.
    Thanks,
    Matt M.

  • Need for help in select tag with jsp

    i have a select tag about shoeing countriesin a register form and according to the selection of country i want to shoe the names of its cities .............i guess it has something to so with js and i have a little experience in it
    ..........................................if somebody have the answer i'll b thankfull 4 this

    <%@page import="java.sql.*"%>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>register</title>
         <SCRIPT LANGUAGE="JavaScript">
         function checkForm(form){
                        var len = form.elements.length;
                   for (var i = 0; i < len; i++)
                                       if ((form.elements.value == null || form.elements[i].value == ""))
                                                 alert("Please enter your " + form.elements[i].name + ".");
                                                 form.elements[i].focus();
                                                 return false;
                                       return true;
         </SCRIPT>
         <script>
                   function subForm()
                        frm=document.forms.register;
                        frm.action="register.jsp";
                        frm.submit();
         </script>
    </head>
    <body>     
              <H3>WELCOM IN REGISTER PAGE </H3>
              <table align="center" border="0"width="100%">
                   <form name="register" method="post"action="reg.jsp">
                        <tr>
                             <th>
                             Country
                             </th>
                             <td>     
                             <select name="country" onChange="subForm()" >
                             <option value="-1">choose</option>
                                  <%!private Statement stmt;%>
                                  <%!private ResultSet rs;%>
                                  <%!private String h;%>
                                  <%!private int s;
                             private int s2;
                                  private String b;%>
                                  <%
                                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                  Connection conn = DriverManager.getConnection("jdbc:odbc:data", "", "");
                                  stmt=conn.createStatement();%>
                                  <%
                             b= request.getParameter("country");
                             rs = stmt.executeQuery(" select* FROM Country");
                             Integer int3=java.lang.Integer.valueOf(b).intValue();
                             s2=int3;
                             if(s2!=-1)
                                  while(rs.next())
                                  %>
                             <option value="<%=rs.getInt(1)%>">
                             <%=rs.getString("Country_name")%>
    </option>
                                  <% }     %>
                                       <%
         h=request.getParameter("country");
    Integer int1=java.lang.Integer.valueOf(h).intValue();
    s=int1;
    }else{
                             rs = stmt.executeQuery(" select* FROM Country where country_id='"+s2+"'");
                        if(rs.next())
                                  %>
                             <option value="<%=rs.getInt(1)%>">
                             <%=rs.getString("Country_name")%>
    </option>
                                  <% }     %>
                                  <% }     %>
                                       </select>     
                             </td>
                   </tr>
                   <tr>
                             <th>
                                  City
                                  <br>
                             </th>
                             <td>
                             <select name="city">
                                  <option value="-1">choose</option>
    <%
                                  rs = stmt.executeQuery(" select* FROM City where Country_id='"+s+"'");
                                  while(rs.next())
                                  %>
                             <option value="<%=rs.getInt(1)%>"><%=rs.getString("City_name")%></option>)
                             <%
                             out.println(request.getParameter("City"));
                             %>
                             </select>     
                             </td>
                             </tr>
                             <tr>
                                  <th>First Name</th>
                                  <td><input type="text"name="firstName" size="30"></td>
                        </tr>
                             <tr>
                                  <th>Last Name</th>
                                  <td> <input type="text"name="lastName" size="30"></td>
                             </tr>
                             <tr>
                                  <th> Email </th>
                                  <td><input type="text"name="email" size="30"></td>
                             </tr>
                             <tr>
                                  <th> UserName </th>
                                  <td><input type="text"name="userName" size="30"></td>
                             </tr>
                             <tr>
                                  <th> Password </th>
                                  <td> <input type="Password"name="password" size="30"></td>
                             </tr>
                             <tr>
                                  <th><input type="submit" VALUE="Submit Data" onClick="return checkForm(this.form);"></th>
                                  <th></th>
                             </tr>
                             <tr>
                                  <th><input type="reset" VALUE="Reset Form"></th>
                                  <th></th>
                             </tr>           
                             </table>
                   </form>
    </body>
    </html>

  • Including NetUI tags with jspf files

    Hello
    I'm trying to clean up my jsp code by putting some of it into .jspf
    files. But apparently this include means that my netUI tags are rendered
    at text and not interpretated.
    Is this how it should be?, can one only put pure HTML into .jspf files?
    Oliver Billing

    Hey Vimala
    Found out why it dosent work. Its because I use the danish letters ???
    Example:
    <td><netui:label
    value="{pageFlow.st?vne.DRFSt?vne.overst?vne.navn}"></netui:label></td>
    The above is rendered as text when included in a jspf file.
    <netui:label value="{pageFlow.ekvipage.hest.navn}"></netui:label>
    The above works (same file)
    So its actually a bug :-)
    Oliver Billing
    [email protected] skrev:
    Hey Vimala
    I'm using <%@ include file="/header.jspf"%> and it dosent work. I'm
    using workshop 8.1
    Oliver Billing
    Vimala Ranganathan skrev:
    Hi Oliver
    How are you including the jspf file into the jsp's?
    If you use <jsp:include> tag then it will not be executed.
    Do NOT do this way:
    <jsp:include page="/jspf/sample.jspf"/>
    However, in this way it should works fine:
    <%@include file="/jspf/sample.jspf"%>
    Can you please try and check if this works?
    Thanks
    Vimala
    Some more technical info:
    There is a fundamental difference between the include directive <%@ include %> and <jsp:include >
    The <%@ include %> tag includes the file at translation/compile time. It is like copying and pasting the contents of the "fragment" into the main JSP. It is then translated, compiled and run.
    The <jsp:include> tag includes the result of running that page at execution time. ie it is as if you made a web request to that URL, and pasted the response you got back into the response of the including page.
    What does this mean in your case?
    1 - a .jspf file will not be evaluated by <jsp:include>. If you make a request for the jspf file directly, it will send you the source, because it doesn't invoke the JSP servlet on jspf files.
    Solution: change the file to sample.jsp, and it should include ok or use @include

  • Display Tag use with JSF Data Tables

    Has Anyone got to work the Display tag with JSF
    I have got soo far to display the table by using Display tag with JSF dataTables but unable to have a link or command button to navigate
    Theirs a online hack available for the same .....But i am unable to get to run it
    Has anybody got the solution for the same

    Hi ,
    I am trying to do the same but I have no success.
    My code is
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:jsp="http://java.sun.com/JSP/Page"
         xmlns:c="urn:jsptld:http://java.sun.com/jstl/core"
         xmlns:display="urn:jsptld:http://displaytag.sf.net">
    <jsp:directive.page contentType="text/html; charset=UTF-8" />
    <jsp:directive.page import="fi.tavutaito.hibernate.User,java.util.*,org.displaytag.tags.TableTag" />
         <h:dataTable value="#{sessionScope.users}" var="user" style=""/>
         <display:table name="sessionScope.users" class="" id="user">
              <display:column property="username"/>
              </display:table>
    </html>
    where users is a List Obj in the session. In output I receive just this page.
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="urn:jsptld:http://java.sun.com/jstl/core" xmlns:display="urn:jsptld:http://displaytag.sf.net">
    <jsp:directive.page contentType="text/html; charset=UTF-8"></jsp:directive.page>
    <jsp:directive.page import="fi.tavutaito.hibernate.User,java.util.*,org.displaytag.tags.TableTag"></jsp:directive.page><table style="">
    <tbody>
    <tr>
    </tr>
    <tr>
    </tr>
    </tbody>
    </table>
         <display:table name="sessionScope.users" id="user">
              <display:column property="username"></display:column>
              </display:table>
    </html>
    It seems to that display tags are not parsed...
    Do zou have an idea?
    Thanks a lot in advance
    beppoz

  • JSTL tags

    Where can I find the list of all JSTL tags with description about their functionality?..

    What, couldn't wait for a reply to your other post?
    Documentation can be found on this very website!
    http://java.sun.com/products/jsp/jstl/reference/api/index.html
    I would recommend you get hold of the Specification documents. They are very readable, and make an excellent reference. I constantly refer to them.
    On the above link,
    Maintenance Release = JSTL1.1
    Final Release = JSTL1.0
    If you are using JSTL1.1/JSP2.0, then the JSP2.0 specification is the source for all things related to the Expression Language (EL)
    http://java.sun.com/products/jsp/reference/api/index.html
    Cheers,
    evnafets

  • Are not interpreted JSTL tags in a JSP page including in a servlet.

    Hi people,
    I have a project where una page (index.jsp) includes a servlet (MyServlet), that consult a persistence class and get a List of objects (Users),      
    then the servlet passes the List to a Request object and includes another JSP page (showUsers.jsp). And this is conceptually correct, but don´t works, the JSTL tags are not interpreted in showUsers.jsp.
    This is my code...
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <c:out value="Show me some things index.jsp"/>
    <div style="border-color:red; border:solid; padding-left:60px">
          <jsp:include flush="true" page="pepe/MyServlet"/>
    </div>
    </body>
    </html>...and the Servlet...
    public class MyServlet extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
              UserManager um = new UserManager();
              List users = um.getUsers(); //This use Hibernate to return a Users List
              request.setAttribute("users", (ArrayList) um.getUsers());
              request.getRequestDispatcher("/showUsers.jsp").forward(request, response);
    }...Finally, we have the showUsers.jsp file....
    <c:out value="Show me some thing showUsers.jsp"/>
    <table>
         <tr>
              <th>ID</th>
              <th>Name</th>
              <th>e-Mail</th>
              <th>Type</th>
         </tr>
         <tr>
              <c:foreach items="${requestScope.users}" var="user">
                   <td><c:out value="${user.id}" /></td>
                   <td><c:out value="${user.name}" /></td>
                   <td><c:out value="${user.email}" /></td>
                   <td><c:out value="${user.type}" /></td>
              </c:foreach>
         </tr>
    </table>This i get as result page...
    ID       Name       e-Mail       TypeFinally, this is the code of showUsers.jsp...
    <c:out value="Show me some thing showUsers.jsp"/>
    <table>
         <tr>
              <th>ID</th>
              <th>Name</th>
              <th>e-Mail</th>
              <th>Type</th>
         </tr>
         <tr>
              <c:foreach items="[src.User@18f729c, src.User@ad97f5, src.User@d38976, src.User@1e5c339, src.User@17414c8, src.User@7a17]" var="user">
                   <td><c:out value="" /></td>
                   <td><c:out value="" /></td>
                   <td><c:out value="" /></td>
                   <td><c:out value="" /></td>
              </c:foreach>
         </tr>
    </table>Somebody can help me?
    Many thanks,
    Gonzalo

    Thanks you all guys,
    I appreciate very much your help. In response to everyone ...
    BalusC wrote:
    Is JSTL taglib declared in top of that JSP page? I don't see it back in the posted code snippet. In this example I stuck...
    request.getRequestDispatcher("/showUsers.jsp").forward(request, response);By mistake, but this is just a test, the original line of my servlet is...
    request.getRequestDispatcher("/showUsers.jsp").include(request, response);As you can see, both (the servlet and the showUser.jsp file) are included in the index.jsp file. So the header...
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>...in the index.jsp file should works (I hope so).
    njb7ty wrote:
    I assume in your web.xml, you have ''pepe/MyServlet' defined as a servlet tag and servlet map tag? Without that, I don't think your JSP will find the servlet. I'm >not sure you need it in web.xml since I never call a servlet from a JSP page.
    I suggest putting System.out.println() throughout your servlet code and out.println() in your JSP pages to see exactly what is called and when.
    As a general rule, JSP files are to display data only, and submit back to a servlet. The servlet does all the business logic and dispatches to the appropriate >JSP page. The JSP shouldn't have any business logic. Including the servlet looks kinda like including business logic. Actually, in a MVC design, your >presentation, control, busines, and database layers have their own isolated responsibilities.
    I suggest the servlet put data as one java bean in request scope via request.setAttribute() and dispatch to the JSP page. The JSP page gets the data via ><useBean> tag. The JSTL gets the variables from the useBean tag and uses the data from there to display it. Really, this is my web.xml file...
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">
         <servlet>
              <servlet-name>MyServlet</servlet-name>
              <servlet-class>src.MyServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>MyServlet</servlet-name>
              <url-pattern>/pepe/MyServlet/*</url-pattern>
         </servlet-mapping>
    </web-app>Regarding putting System.out.println() and out.println(), i did it and thats works.
    Respect of your last comment, I am not a expert in MVC, but I understand that the view layer can make calls to the Controller layer, I am wrong?
    evnafets wrote:
    It's not. However thats not code, but the generated HTML.
    As Balusc pointed out it's the result of running this JSP page without importing the tag library at the top.
    Because the tag library is not declared, it treats the <c:forEach> and other tags as template text, and basically ignores them.
    It then evaluates the ${items} attribute as an expression in template text, calling toString() on it.
    Cheers,
    evnafets      The file showUsers.jsp are included into the index.jsp page, that's have the header taglib. Could this works?
    BalusC wrote:
    njb7ty wrote:
    By the way, I dont think this is the correct format for the foreach tag:
    <c:foreach items="[src.User@18f729c, src.User@ad97f5, src.User@d38976, src.User@1e5c339, src.User@17414c8, src.User@7a17]" var="user">You're right friend.
    And that's my problem. Any ideas?
    Thanks everyone,
    Gonzalo

  • Problems with JSF and included subviews

    Hi everybody,
    I' ve got a problem with JSF and included subviews which makes me going
    crazy. I've got no clue why my web-pages are represent wrongly. The only
    tip I've got is that it must be connected with the kind I do include my JSF-pages.
    When I use <%@file="sub.jsp"%> my pages are are represent right. When I use <jsp:include page="Sub.jsp" /> or <c:import url="Sub.jsp" /> ( mark: the usage of flush="true" or flush="false" doesn't matter )
    my pages are represent wrongly.
    The usage of tags like f:facet or f:verbatim were also included but didn't point to an solution.
    I searched the whole Sun Developer Forum and some other web-sites for any solution for my problem but the given hints and clues didn't help. Now I'm trying to post my problem directly in Sun's Forum in hope to get help.
    My environment is the following:
    JAVA JDK 1.5 Update 4
    Tomcat 5.5.9
    JSLT 1.1
    Sun JSF 1.1
    Win 2K
    Here's my code:
    Main.jsp
    <%@ page language="java"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%
              String path = request.getContextPath();
              String basePath = request.getScheme() + "://" + request.getServerName()
                        + ":" + request.getServerPort() + path + "/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
         <base href="<%=basePath%>">
         <meta http-equiv="pragma" content="no-cache">
         <meta http-equiv="cache-control" content="no-cache">
         <meta http-equiv="expires" content="0">   
         <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
         <meta http-equiv="description" content="This is my page">
         <link rel="stylesheet" href="stil.jsp" type="text/css" />
    </head>
    <body>
         <f:view>
              <h:form>
                   <div class="table">
                        <div class="tr">
                             <h:outputText styleClass="tdleft" value="value 1"/>
                             <h:outputText styleClass="tdinfo" value="value 2"/>
                        </div>
                        <div class="tr">
                             <h:outputText styleClass="tdleft" value="value 3"/>
                             <h:outputText styleClass="tdinfo" value="value 4"/>
                        </div>
                   </div>
              </h:form>     
              <jsp:include page="Sub.jsp" />
         </f:view>
    </body>
    </html>Sub.jsp
    <%@ page language="java"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <f:subview id="subview">
         <h:form>
              <div class="table">
                   <div class="tr">
                             <h:outputText styleClass="tdleft" value="value 11"/>
                             <h:outputText styleClass="tdinfo" value="value 22"/>
                   </div>
                   <div class="tr">
                        <h:outputText styleClass="tdleft" value="value 33"/>
                        <h:outputText styleClass="tdinfo" value="value 44"/>
                   </div>
              </div>
         </h:form>
    </f:subview>stil.jsp
    <%@page contentType="text/css"%>
    <%
        String  schwarz     = "#000000",
                grau1       = "#707070",
                grau2       = "#c0c0c0",
                grau3       = "#e0e0e0",
                grau4       = "#e8e8e8",
                grau5       = "#fdfdfd",
                blau        = "#0000dd",
                tuerkis     = "#00cfff";
        String  liniendicke = "1px",
                linienart   = "solid";
        String allgemeineTextFarbe           = schwarz;
        String allgemeineHintergrundFarbe    = grau3;
        String infoTextFarbe                 = blau;
        String fieldsetRandFarbe             = blau;
        String fieldsetRandDicke             = liniendicke;
        String fieldsetRandArt               = linienart;
        String hrLinienFarbe                 = blau;
        String hrLinienDicke                 = liniendicke;
        String hrLinienArt                   = linienart;
        String inputAktivHintergrundFarbe    = grau5;
        String inputReadonlyHintergrundFarbe = grau4;
        String inputPassivHintergrundFarbe   = grau4;
        String inputPassivFarbe              = schwarz;
        String inputRandFarbe1               = grau1;
        String inputRandFarbe2               = grau5;
        String inputRandDicke                = liniendicke;
        String inputRandArt                  = linienart;
        String inputButtonHintergrundFarbe   = grau3;
        String legendenFarbe                 = blau;
        String linkFarbe                     = blau;
        String linkAktivFarbe                = tuerkis;
        String linkBesuchtFarbe              = blau;
        String linkFocusFarbe                = tuerkis;
        String objectGitterFarbe             = grau5;
        String objectGitterDicke             = liniendicke;
        String objectGitterArt               = linienart;
        String tabellenGitterFarbe           = grau5;
        String tabellenGitterDicke           = liniendicke;
        String tabellenGitterArt             = linienart;
    %>
    <%-- ----------------------------------------------- --%>
    <%-- Textdarstellung mittels der Display-Eigenschaft --%>
    <%-- in den Tags div und span                        --%>
    <%-- ----------------------------------------------- --%>
    *.table {
        display:table;
        border-collapse:collapse;
    *.tbody {
        display:table-row-group;
    *.tr {
        display:table-row;
    *.td,*.tdright,*.tdleft,*.tdinfo,*.th {
        display:table-cell;
        padding:3px;
        vertical-align:middle;
    *.td,*.th {
        text-align:center;
    *.tdright {
        text-align:right;
    *.tdleft {
        text-align:left;
    *.tdinfo {
        color:<%=infoTextFarbe%>;
        text-align:right;
    *.th {
        color:<%=infoTextFarbe%>;
        font-weight:bold;
    }thanks in advance
    benjamin

    Hello Zhong Li,
    many thanks for your post, but it didn't work.
    My problem is that the JSF-Components im my included or imported
    JSP-Pages does not accept any kind of style or styleClass for
    designing. The components take over the informations for colors
    but not for alignment.
    When I take a look at the generated JAVA-Source in $TOMCAT/WORK/WEBAPP for my sub.jsp ( sub.java )
    it seems that the resulting HTML-page would be presented correctly.
    But later when I start the application via Firefox or Mozilla the html-sourcecode is totally wrong.
    In my example I create a simple grid with 2 rows and 2 columns.
    Both columns contains JSF-Outtext-Components and are included with div-tags.
    The generated Sub.java shows that the text would be setted in the div-tags. Unfortunately the html-sourcecode represented by my browser shows that jsf-text is not setted in the tags but in the <h:form> tags. The div-tags are neither rounded by <h:form> nor containing the JSF-OutText-Components.
    Any clue?
    Many thanks Benjamin
    Here is the html-code from Firefox:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
         <base href="http://polaris21:8080/webtest/">
         <meta http-equiv="pragma" content="no-cache">
         <meta http-equiv="cache-control" content="no-cache">
         <meta http-equiv="expires" content="0">   
         <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
         <meta http-equiv="description" content="This is my page">
         <link rel="stylesheet" href="stil.jsp" type="text/css" />
    </head>
    <body>
         <form id="_id0" method="post" action="/webtest/Main.faces" enctype="application/x-www-form-urlencoded">
              <div class="table">
                   <div class="tr">
                        <span class="tdleft">value 1</span>
                        <span class="tdinfo">value 2</span>
                   </div>
                   <div class="tr">
                        <span class="tdleft">value 3</span>
                        <span class="tdinfo">value 4</span>
                   </div>
              </div>
              <input type="hidden" name="_id0" value="_id0" />
         </form>     
          <form id="SUB:_id5" method="post" action="/webtest/Main.faces" enctype="application/x-www-form-urlencoded">
               <span class="tdleft">value 11</span>
              <span class="tdinfo">value 22</span>
              <span class="tdleft">value 33</span>
              <span class="tdinfo">value 44</span>
              <input type="hidden" name="SUB:_id5" value="SUB:_id5" />
         </form>
         <div class="table">
              <div class="tr">
              </div>
              <div class="tr">
              </div>
         </div>
    </body>
    </html>

  • Horizontal line with jsf tag

    Hi,
    i need following pattern:
    text (horizontal line)
    text (horizontal line)
    and so on....
    i use
    <h:outputText value="Text"/><h:outputText value="___" style="vertical-align:super;"/>it works, but now i need the line thicker.
    can i expand this code with some css?
    or is there any other solution with jsf-tag?

    Use the CSS border property. This has not much to do with JSF, but just with basic HTML/CSS knowledge.

  • I need help on Spring web flow Integation with JSF  in Weblogic Portal 10.3

    Hi
    I am using JSF1.2(portlet) with weblogic portal 10.3
    I am trying to integrate JSF with Spring web flow...
    I went through JSF white paper(weblogic-portal-jsf-whitepaper.pdf) ...there it is saying that ..as navigation controller, we can use spring web flow...
    Please suggest me how do I integrate JSF with spring web flow in Weblogic portal env...and
    what are steps I need to follow…
    Thanks
    Kumar

    No, there isn't problem show in log. I don't know why... Please suggest me or help me.
    Thanks in advance!
    Best Regards,
    Coy.

Maybe you are looking for

  • How can I create a new work center

    I try to create a new work center.I found a transaction 'OP42' . But I can't set a personal number and name.where should I write them, or should I use any other transaction?? Thanks...

  • Can't log in after recovery from time machine

    We had to replace the disk on my daughter's MacBook Pro. We restored her data from Time Machine on an external drive. After completion the system brought up the login screen. In addition to her account, there's one for me and one for my wife. All of

  • Vendor Payment with Payment terms

    Dear all, I have a query. If we are posting a payment to a vendor and vendor is say within a payment terms limit which wont allow more than 5 % discount. But if i want to make the payment as a one time requirement, without changing the payment terms

  • Windows 193 error when installing coldfusion 8,9

    Hi, I am installing coldfusion 9 or 8 in mysystem and repeatedly getting the windows 193 error during installation. I have already installed java too and this problem is still present. kindly suggest me a solution for this problem. regards, shafi

  • Error 103 using Flash CS5.5 Air for iOS Settings exporter

    This is currently discussed in another thread but I think this is a issue with AIR, maybe after I installed the new AIR version 2.6 and CS5.5 . Anyone have a solution to this.? http://forums.adobe.com/thread/853878