JavaServer Pages (JSP) and JSTL

Hi!
I need to create a table where the user specifies only the td of the table. I do not know the size that the user will come but if he put 3 columns he needs to create these columns and then write the result
thanks.

Hi! I'm sorry
I just forget to mention the problem,
I am passing the following information to the TagLib.
<mytag:table var="varItem" items="collVO">
<mytag:colum print="Name" itens="${varItem.name}" with="100"></mytag:colum>
<mytag:colum print="End" itens="${varItem.end}" with="100"></mytag:colum>
<mytag:colum print="City" itens="${varItem.city}" with="100"></mytag:colum>
</mytag:table>and I am getting this information again.
private void getTable() throws JspException
Object obterCollVoRequest = ExpressionEvaluatorManager.evaluate("collVo", getCollVO(), java.lang.String.class,this.pageContext);
setCollVO(obterCollVoRequest.toString());
Collection collectionCollVo = (Collection) pageContext.findAttribute(obterCollVoRequest.toString());
setCollection(collectionCollVo);     
}This problem is that he is coming null not know why this error, and I am not aware mounted the table with the above information (Remembering that is dynamic).
Example:
<table>
<tr>
   <td>Nome</td>
   <td>End</td>
   <td>City</td>
</tr>
<tr>
   <td>Roger</td>
   <td>Street A Number 22</td>
   <td>New York</td>
</tr>
<tr>
   <td>Thomas</td>
   <td>Street Clich Number 199</td>
   <td>New York</td>
</tr>
</table>Thank you for your attention!
Edited by: rdfcp on Oct 28, 2008 9:51 AM

Similar Messages

  • API for jsp and jstl

    can any body send URL or help me to download JSP and JSTL API also servlets

    hi,
    Jsp api
    http://tomcat.apache.org/tomcat-5.0-doc/jspapi/index.htmlJstl api
    http://java.sun.com/products/jsp/jstl/1.1/docs/api/index.html

  • Oracle 9i Lite and JavaServer Pages (JSP)

    Hello,
    I was refered to this forum as I have a couple of questions:
    1. If I have an application built on JSPs and Servlets that runs against Oracle 9i and Oracle 9ias, Could I run the same application on Oracle Lite without making any changes to the application? if not, what are the changes I have to consider?
    2. I read that Oracle 8i is the database you use to make the tests, can I use Oracle 9i as well?
    3. I understood that J2EE is supported, do I need a special version/patch to be installed?
    Thanks.

    I also get the POL-3013 error message when trying to connect to the polite database as well as my own db. I can setup the user-dsn and run CREATEDB with no errors. I can even validate the db and no errors are reported. But I cannot use msql to connect to it. It used to work on my previous Win2k-machine with P4 cpu, but will not work with XP and Celeron.

  • Advanced JavaServer Pages - JSP Templates

    Great book but example template code not working..
    I am having trouble getting the template example6.jsp working with the code supplied with the book. The code seems to be buggy when attempting to nest regions within regions.
    Has anybody else had this problem ?
    Problem as below
    javax.servlet.jsp.JspException: regions can be created from a template or another region,but not both at
    tags.regions.RegionDefinitionTag.doStartTag(RegionDefinitionTag.java:18)
    at /example6.jsp._jspService(/example6.jsp.java:89) (JSP page line 5)

    Book source can be downloaded at
    http://www.phptr.com/advjsp/
    the source is contained within a jar, the location within the jar is as follows
    \booksource\4\regions_examples\
    Example6.jsp and Example7.jsp, which contain nested regions, are the two examples which are not working correctly.
    There is also a pdf download of the Templates Chapter 4 on the web page. Well worth a read.
    Thanks for any help.

  • Jsp and jstl

    Hi ,
    I was trying to use jstl to make my jsp's look clean and easliy manageable,but till now i have had no luck in making it work.
    I have added all the tld's and jars required for jstl to my war file and also i made the entry in my web.xml,in my jsp i put
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    and the place where i wanted to put my if statement i wrote this code
    <c:if test=${endVal==0}>
    <c:set var="endVal" value=<%=result.size()%> />
    </c:if>
    I tried with both
    uri="http://java.sun.com/jstl/core"
    uri="http://java.sun.com/jstl/core_rt" but it doesnt seem to be setting that value.plz advise what is wrong.
    Thanks

    thanks panyong-cs !
    Now atleast its tryign to set the value but the error i am getting is
    "cannot resolve symbol
    symbol : method setValue (int)
    location: class org.apache.taglibs.standard.tag.rt.core.SetTag
    _c_rt_set0.setValue(result.size()); "
    resong being that result.size() is an int ....so now how should i set that value....

  • Help with JSP and JSTL tag

    I am trying to accomplish the following
    -display a checkbox if the phrase "platinum" appears in a string
    -display a radio button otherwise
    Here is my code:
    <c:when test="${fn:containsEqualIgnoreCase(${product.description}, 'platinum' })}">
                      <td width="40">
                       </td>
                     <td width="1">
                        <html-el:checkbox property="dishHDProduct"             value="${product.productId}:${product.presentationChannelText}:${product.programmingType}" disabled="true"/>                                                            
                                                                  </td>
                                                             </c:when>
                                                             <c:otherwise test="${fn:containsEqualIgnoreCase("platinum")}">
                                                                  <td width="1">
                                                                       <html-el:radio property="dishHDProduct" value="${product.productId}:${product.presentationChannelText}:${product.programmingType}"/>                                                            
                                                                  </td>
                                                             </c:otherwise>I suspect that I cannot use the <when> <otherwise> stuff with the function JSTL tag, but I may be wrong. I am new to this and open to all suggestions.
    Thanks!

    This is actually the way I ended up solving my own problem:
    <c:choose>
                                                             <c:when test="${product.presentationChannelText == 'PlatinumHD'}">
                                                                  <td width="10">
                                                                  </td>
                                                                  <td width="1">
                                                                       <html-el:checkbox property="dishHDProduct" value="${product.productId}:${product.presentationChannelText}:${product.programmingType}" disabled="true"/>                                                            
                                                                  </td>
                                                             </c:when>
                                                             <c:otherwise>
                                                                  <td width="1">
                                                                       <html-el:radio property="dishHDProduct" value="${product.productId}:${product.presentationChannelText}:${product.programmingType}"/>                                                            
                                                                  </td>
                                                             </c:otherwise>
                                                        </c:choose>Because I am not able to use JSP 2.0 and therefore must use JSTL 1.0

  • Joining jsp and jstl

    first of all, i'm a newbie..sorry for my beginner question.
    <sql:setDataSource var="datasource" driver="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost/test"
                       user="root" password="123"/>
    <sql:query var="ts" dataSource="${datasource}">
      SELECT id FROM t1
    </sql:query>
    <c:forEach items="${ts.rows}" var="row">
        <tr>
            <td><c:out value="${row.id}" /><img src=<${row.path}></td>
        </tr>
    </c:forEach>I want to change the above code and give the image source like this:
    <img src=<###CONTEXTPATH###+${row.path}>how can I do that?

    The contextpath is available by HttpServletRequest#getContextPath().
    But you also can define a <base href> with the contextpath in the <head>. This will be applied to all relative links inside the page.

  • Next page link and data

    Hi all,
    i have around hundred records. i want to display them in 10s ie 10 records in each jsp page. hoto write the code for this request? its something like in this forum we have lots of pages in "JavaServer Pages (JSP) and JSTL" topic. but we can choose by clicking on the page number or by clicking next.
    thanks in advance.

    Put it in an ArrayList and use a paging library e g displaytag or write your own paging where you can put the list in a Result object and the page parameter in the query string, then iterate over the list, fetching only the 10 records you want to display each time:
    localhost/list?page=1
    localhost/list?page=2
    localhost/list?page=3
    If you make use of sql, use limit calculated from the page variable in the http query string.

  • Newbie question: JSP x JSTL (Will JSTL kill JSP?)

    Hi,
    I'm newbie in java development and know I'm learning about jsp and jstl.
    I'm reading some articles about jstl, but my doubt remains...
    Was jstl create to kill jsp in apresentation layer?
    Please, if possible, show me an example that I really need use jsp instead of jstl?
    What kind of things can't I do with jstl?
    Thanks a lot

    Ranieri wrote:
    I'm sorry, my question wasn't very clear.
    When I said JSP, I wanted say Scriptlet...
    My central point is that Scriptlet is very confortable for me at the moment...
    So, I don't see a motive to change:
    <% if (1 == 2) }....
    to
    <c:if test="1 eq 2">...Lots of motive to change.
    Now... you can say that jstl is more easy, Or you can say that JSTL is easier.
    but if a big number of people start to use it, it will increase and will turn another programming language...It sounds like you think this is a new thing. JSTL has been around for a very long time. 2001 vintage. It's already here, dude.
    Besides, it's not a programming language per se. There will be other tag libraries, but those are custom. JSTL as written hasn't changed in years. The standard won't expand.
    So, why create another programming language if we have Scriptlet to do the same?Like I said before, scriptlets were the mistake. They're unreadable, ugly, and encourage putting logic in JSPs. Very bad, indeed.
    %

  • Pass Parameter from main page to include page (subview) and read it ?

    Hello All
    i have an include header.jsp page in main page.jsp ,and i included it by subview.
    i want to pass a parameter ex(screen name) to the subview by using f:param.
    Here is the code in main.jsp:
    <f:subview id="headerSubView">
    <jsp:include page="/commons/header.jsp" flush="true">
    <jsp:param name="screenTitleByJspParam" value="screen2007"/>
    </jsp:include>
    <f:param name="screenTitleByFparam" value="screen2007"/></f:subview>
    Code in header.jsp
    1- <af:outputFormatted value="#{param.screenTitleByJspParam}"/> -- this dose not work
    2- <af:outputFormatted value="#{param.screenTitleByFparam}"/> -- this dose not work (i want this manner)
    So how i can send parameter by ]<f:param and read it by subview uesing adf/jsf tags ?
    Regards
    Mohd.Weshah
    weshah79

    Dear thanassis
    Thanks for you help ,your code is working successfully but my case is the following :
    same your main jsp page but the subview tag in table :
    <%@ page contentType="text/html;charset=windows-1256"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1256"/>
    <title>main</title>
    </head>
    <body>
    <h:form>
    <afh:tableLayout>
    <afh:rowLayout>
    <afh:cellFormat>
    <f:subview id="header">
    <jsp:include page="header.jsp" flush="true">
    <jsp:param name="pageTitle" value="Modify aa record"/>
    </jsp:include>
    <f:subview>
    </afh:cellFormat>
    </afh:rowLayout>
    </afh:tableLayout> </h:form>
    </body>
    </html>
    </f:view>
    try it the parameter dose not work ,but if you want that code work successfully move the subview out of the table.
    Do you know what is the problem ?
    i want give you another hint maybe it is realted to the same problem, which is in my original page the body tag is adf tag ie(<afh:body>) your code dose not work with that tag until i changed the afh:body to html body.
    Regards
    Mohd.Weshah

  • How to access and display a Web Service from a WSDL in JSP or JSTL ?

    Dear All,
    We need to access a Web Service which is hosted as WSDL How to access a WSDL file from JSP or JSTL, parse and display the SOAP response in JSP page.
    Any simple example or URL as reference to an example will be useful for me.
    It seems io tags of jakarta is able to send soap message, but how to display it in JSP.
    Yours,
    Sankar.B

    Dear Sir,
    Yes. I would like to know more about the Forte and how to consume WSDL file from JSTL. The following are my querirs.
    1. How to connect the declared JNDI from a JSP page. i.e: the Datasource - ex: booksDS
    2. We connect the Tomcat server using JNDI as jdbc/scott. But, if I give jdbc/scott in JSTL as datasource={jdbc/scott}, we could not able to connect. We use the following code in a JSP page to connect the DB from a JSP page. (Its quite easy to modify, so we use the connection in a JSP page.)
    3. How to Consume a WSDL url from JSTL. Ex: If there is a URL : http://localhost/ws/MathService.asmx?wsdl OR http://www.xmethods.com/test/BabelFish
    4. How to display the result. We tried via SOAP from io taglib of Jakarta, but gives us an SOAP (it also looks like xml) response. But, how to use the value from that soap response in IE client thru JSTL/JSP.
    5. Whether this JSTL tool will be available with Forte Enterprise/Community Edition. If so EE, whats the price.
    Please Reply Immediatly. We tried, trying, going to try to display a wsdl response, but not able to display in IE thru JSP/JSTL. But, weve tested the www.gotdotnet.com examples of asp.net web services, we are thru. Its quite easy it seems in .NET. But, we feel whether even there is not even one example in JSTL/ Java Web Services Dev. Pack to utilise a web service in full cycle. The example which uve given is thru servlets. We dont use servlets. Cos, its very easy to edit JSP pages, instead of compiling the serv. and using it.
    I hope ull reply for all the above queries, since ur from SUN.
    Expecting your fav. reply.
    Yours,
    Sankar.B

  • JSP 2.0 and JSTL question

    Hi,
    I'd just like to ask if anyone could suggest a good site with tutorias about JSP 2.0 and more specific about requesting and manipulating attributes.
    It is easy to do so by using servlets withn something like:
    ArrayList mylist = (ArrayList)request.getAttribute("mylist");
    and use it with an iterator.
    ...but I'd like to learn how I can request and manipulate ArrayLists in JSP using JSTL.
    thanks in advance,
    mike

    All you should need are the <%@ taglib %> and the jar files in your web-inf/lib directory.
    Nothing is required in web.xml for it to work.
    Make sure you are using the JSTL 1.1 taglib URIs though: http://java.sun.com/jsp/jstl/core.
    They look a lot like the old ones, but include /jsp now as well.
    Does the EL evaluate inside a tag? eg <c:out value="${application.servletContextName}"/>
    Couple of things to try
    EL evaluation may be disabled: Put this at the top of your page:
    <%@ page isELIgnored=false %>
    Check your web.xml for something like this (disables EL in pages)
    <jsp-property-group>
    <url-pattern>*.jsp</url-pattern>
    <el-ignored>true</el-ignored>
    </jsp-property-group>
    What version of the DTD are you using for web.xml? According to the JSP spec, if it is less than 2.3, and you haven't specified handling of the EL, it is ignored.
    Relevant bits of the JSP2.0 spec: JSP3.3.2, JSP 1.10.1
    Can you post some code which isn't working?
    Cheers,
    evnafets

  • How to send object arraylist from servlet to jsp and display using jstl

    Hi All....
    I have a simple application and problem with it.
    Once user logged in to system the user will redirect to LoginServlet.java controller.
    Then in LoginServlet I want to redirect user to another page called book_details.jsp.
    this is my login servlet.
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              // TODO Auto-generated method stub
              PrintWriter out = response.getWriter();
              ArrayList<BankAccountDTO> account_list = new ArrayList();
              ResultSet resultSet = null;
              LowFairAirDB airDB = null;
              try{
                   airDB = new LowFairAirDB();
                   String query = "SELECT account_id, type, description, balance, credit_line, begin_balance, begin_balance_time_stamp FROM bank_account";
                   airDB.sqlSelect(query);
                   resultSet = airDB.getResultSet();
                   while(resultSet.next()){
                        account_list.add(new BankAccountDTO(resultSet.getInt(1),
                                                                     resultSet.getInt(4),
                                                                     resultSet.getInt(5),
                                                                     resultSet.getInt(6),
                                                                     resultSet.getString(2),
                                                                     resultSet.getString(3),
                                                                     resultSet.getString(7)));
              }catch(Exception ex){
              }finally{
                   try{resultSet.close();}catch(Exception ex){}
                   airDB.sqlClose();
         }I set bank account values to BankAccountDTO.java objects and add them to the arrayList.
    Next I want to send this objects arrayList to books_details.jsp and wanna display each objects values using JSTL.
    I still finding a way to go through this.
    1. Can anyone say how can I do it?
    2. Is there any other method to do the same thing without using JSTL?
    thanks in advance,
    Dil.

    Naishe wrote:
    In your servlet,
    request.setAttribute("account_list", account_list);
    requestDispatcher.findForward("/your/display/jsp");
    Good. I would only follow the Java naming conventions. E.g. accountList or accounts instead of the ugly PHP/C conventions.
    In the JSP,
    lst = (List< BankAccountDTO >)request.setAttribute("account_list");
    for(BankAccountDTO b: lst){
    populate your HTML tags or whatever
    Wrong. 1) You need getAttribute() and 2) you should not use scriptlets. Use JSTL c:forEach, e.g.<table>
        <c:forEach items="${accounts}" var="account">
            <tr>
                <td>${account.id}</td>
                <td>${account.type}</td>
                <td>${account.description}</td>
            </tr>
        </c:forEach>
    </table>To the topicstarter: for future JSP/JSTL related questions please use JSP/JSTL forum.
    Here it is: [http://forums.sun.com/forum.jspa?forumID=45].

  • Code to set and destroy session variables in Java Server Pages(JSP)

    code to set and destroy session variables in Java Server Pages(JSP)
    we have use following statement to set session variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session variable
    session.setAttribute("userClient","");
    and
    the session.invalidate() is not working
    Plz. solve this probem

    code to set and destroy session variables in Java
    Server Pages(JSP)
    we have use following statement to set session
    variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session
    variable
    session.setAttribute("userClient","");Perhaps if you tried using
    session.setAttribute("userClient", null);
    or
    session.removeAttribute("userClient");
    and
    the session.invalidate() is not workingNot working how?
    >
    Plz. solve this probem

  • Programming JSP using JDeveloper 10.1.3 and JSTL

    Hello,
    I new in JDeveloper. I am creating a web proyect and I am programming a JSP. This JSP includes JSTL 1.1 Core, exactly the next line:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    When I compile my proyect, obtain the next error:
    Error: java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
    I ensured that this class (javax.servlet.jsp.tagext.TagAttributeInfo) has no that constructor (String, String, boolean) but when I consult the Sun documentation for that class, it is said that the class contain the constructor.
    My proyect include the next libraries defined in JDeveloper:
    · J2EE
    · JSTL 1.1
    · Strut Runtime
    · JSTL 1.1 tags
    Please, what should I do to do my proyect work?

    Constructor javax.servlet.jsp.tagext.TagAttributeInfo (String, String, boolean)
    is not defined. The JSP 2.0 constructor is
    TagAttributeInfo(java.lang.String name,
    boolean required,
    java.lang.String type,
    boolean reqTime,
    boolean fragment)
    Another constructor is
    TagAttributeInfo(java.lang.String name,
    boolean required,
    java.lang.String type,
    boolean reqTime)

Maybe you are looking for