Put comments in jsp page

hello,
i write a jsp page and i want to put trace to see values during the execution. in java cde, i write "System.out.print();". is there something like that for jsp ? i don't want to write in the console but in my page.
if anyone has a solution...

If you what to hide comments in your jsp page:
<%
   String myValue = "aValue";
%>
<!-- <%= myValue %> -->Then, if you take a look at your source, you'll see your info.
Patrick

Similar Messages

  • Putting pictures from jsp pages

    hi, i have been assigned a job to do in jsp....this is the first time i am dealing with jsp....
    my problem is to display images from jsp pages, images will come from the url
    http://media.XXXXXXXX.com/books/ISBN#.jpg, where # is the isbn no.
    here is the code which i am using...
    <c:if test="${result.isbn != null}">
                        <div class="search-result-attributes">Image:$(http://media.XXXXXXXXXXX.com/books/ISBN#.jpg) </div>
                   </c:if>any idea....how can i make a variable of #, to display books with different ISBNs.
    Also, the # can be calculated by "result.isbn"
    any help guys....???
    Edited by: ping.sumit on Jun 24, 2008 8:03 PM

    any idea....how can i make a variable of #, to display books with different ISBNs.
    Also, the # can be calculated by "result.isbn"I don't understand what you're talking about.
    At least I can tell you that HTML offers you the <img> tag for displaying images. E.g.
    <img src="${result.isbn}.jpg" />

  • How to put Tool Tip in JSP page

    Hello.
    How can i put Tool Tip in JSP page and also html page.

    title="value"
    put this in all the tags whereever it is required

  • Regarding comment statement in JSP Page

    Hai to All,
    I have written one small jsp page which checks the given name and display the entered name. This is the code which i have written. Its working fine.
    <html>
    <%
    String name = request.getParameter("txtName");
    out.println("THe Name is"+name);
    out.println("<br><br><br>");
    if(name.equals("Balaji"))
    %>
    <input type=Label value="Welcome Balaji">
    <%
    else
         if(name.equals("Kumaran"))
         %>
         <input type=Label value="Welcome Kumaran">
         <%
              else if(name.equals("Kandhan"))
              %>
              <input type=label value="Welcome Kandhan">
              <%
         else{
              %>
              <input type=label value="Welcome!!! Welcome !!!!">
              <%
              %>
    <h3> Code Ends Here</h3>
    </html>
    But if want to comment an else if block like this it shows some error like else without if.... delete else token. can someone please help me.
    <html>
    <%
    String name = request.getParameter("txtName");
    out.println("THe Name is"+name);
    out.println("<br><br><br>");
    if(name.equals("Balaji"))
    %>
    <input type=Label value="Welcome Balaji">
    <%
    else
         if(name.equals("Kumaran"))
         %>
         <input type=Label value="Welcome Kumaran">
         <%
         /*     else if(name.equals("Kandhan"))
              %>
              <!--
              <input type=label value="Welcome Kandhan">
              -->
              <%
         else{
         %>
         <input type=label value="Welcome!!! Welcome !!!!">
         <%
         %>
    <h3> Code Ends Here</h3>
    </html>

    <!--
    <input type=label value="Welcome Kandhan">
    -->That is an HTML comment, not a Java comment. So it gets sent to the client with Java code that looks like this (sorta):
    out.println("<!--");
    out.println("<input ...>");
    out.println("-->");So that means, between the end of the previous if statement there is some java code (the out.printlns) before you get to the else, which isn't allowed.

  • How to put Download Links on a Jsp Page?

    Hi,
    I am a student and I am working as an intern. This is my question:
    My boss wants me to put some download links(pdf and flash files) on to a jsp page. when a user clicks on the link, all the user info (i.e. name, filename, download time etc) should be stored in a database and then a pop up should appear asking user where you want to download the file.
    I have done most of the part but there is a problem. when a user "left click" on the link then it opens the PDF file in the browser. but if the user "right click and select save target as" then it brings up the box. My boss dont need the user to VIEW the file by left clicking it. I mean on both clicks a pop-up box should appear.
    one more thing to note is that, the PDF are not on the same server. I mean they do not have the same context path.
    Here is what I am doing:
    on the link page:
    sample
    on the other page (which stores information):
    // ... this is downloadfile.jsp
    response.setContentType("application/force-download");               
    String filename = request.getParameter("file");          
    String path = "http://www.domain.com/pdf/" + filename;
    bean.addDownloadDetails(session.getAttribute("email").toString(), filename, request.getRemoteAddr());  // save info in database
    response.sendRedirect(path);
    // ...any ideas or help is appreciated.
    Thanks.

    Straight to the question in the topic title: just use <a> links. But you already found that out. In the future please invent clear topic title covering the actual problem :)
    I have done most of the part but there is a problem. when a user "left click" on the link then it opens the PDF file in the browser. but if the user "right click and select save target as" then it brings up the box. My boss dont need the user to VIEW the file by left clicking it. I mean on both clicks a pop-up box should appear.Change the content disposition to "attachment" instead of "inline".
    one more thing to note is that, the PDF are not on the same server. I mean they do not have the same context path.
    Here is what I am doing:
    // ... this is downloadfile.jsp
    response.setContentType("application/force-download");               
    String filename = request.getParameter("file");          
    String path = "http://www.domain.com/pdf/" + filename;
    bean.addDownloadDetails(session.getAttribute("email").toString(), filename, request.getRemoteAddr());  // save info in database
    response.sendRedirect(path);
    // ...any ideas or help is appreciated.
    Thanks.Better obtain its InputStream by java.net.URLConnection and write it to the OutputStream of the HttpServletResponse. A redirect would create a brand new request, hereby dropping the current request and the response (so setting the content type makes really no sense).
    You can find some pointers in this FileServlet example: [http://balusc.blogspot.com/2007/07/fileservlet.html].

  • *** Email sent everytime when Comments are saved in Task List JSP Page ***

    Hi BPEL Gurus,
    I have a very critical production issue.
    Whenever a user enters or updates Comment in Task List JSP Page, an email is sent each & every time
    when he clicks on the update button for Comments.
    I tried removing the <action> sub-tag for 'ASSIGNES' under <notification> tag of SomeName.task file.
    The above works fine, but now this creates a different problem.
    No Email is send to the Assignee when the Human Task is assigned to him.
    As a work-around I created an Email activity just before calling the Human Task.
    In this case, the email is send properly to the Assignee just before the Task is assigned to him.
    But now suppose if that Human Task is a Sequential List of Approvers instead of Single Approver.
    No email is send to all the users belonging to that Sequential List of Approvers.
    Please see my below code for sending email to all users belonging to Sequential List of Approvers :-
    <copy>
    <from expression="ids:getUserProperty(bpws:getVariableData('inputVariable','payload','/ns1:TerminationRequest/ns1:DivisionalApprovals'),'mail')"/>
    <to variable="varNotificationReq" part="EmailPayload" query="/EmailPayload/ns3:To"/>
    </copy>
    The above code fails & no email is send to any users belonging to that Sequential List of Approvers.
    Could you all BPEL GEEKS provide me with a proper solution.
    PLEASE DO HELP.
    Thanks & Regards,
    Gopal D. Kalsekar
    Senior Software Developer
    Business Solutions (eGroup)
    M.H. Alshaya Co. W.L.L.
    www.alshaya.com
    P :- (965) 2224 3598
    F :- (965) 2224 2488
    E :- [email protected]

    The default email solutions in planning are using workflow or task lists, though the task lists are based on due dates.
    If you wanted a solution where an email is sent out when a task list is complete, then one route could be to have a business rule attached to a task list and then the business rule uses a custom CDF to send out email notication.
    If you are interested in sending emails from business rules then I did write a blog on the subject a while back.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Disabling the comments in the xl sheet when it is read from a JSP page

    Hi everyone,
    I am currently working on a jsp page which will load the data from the xcel sheet and update the information into the db.The code works fine unless the excel sheet doesnt have any comments mentioned in any of its colums.When we have comments, i am not able to read the data from those columns and the execution stops there..
    Is there any options to avoid or disable the comments in an excel, similar to disbaling images in the excel sheet.
    I am currently using the jxl jar for this purpose.
    If anyone can give a solution for this, it will be of immense help to me..

    What version of Numbers?
    Assuming 3.2 (the newer version):
    when you print (using the menu item "File > Print...") use the content scale controls in the print dialog

  • On click of lov new jsp page which has only text area for adding comment

    hi all ,
    please help me to do this task. on click of lov new jsp page should be opend which has only text area for adding comment and upon clicking submit on the jsp page the value entered on the textarea should fall on the text field of lov.
    with regards
    prabhakaran.p

    The only reason I see for such a requirement is "Notes" require more space for entering a detailed note and would be inconvenient to write it in small single-line text input box. But, still in this case, getting the entered text back to the page and displaying it will have the same inconvenience of reading it from that field. And, I still think that removing one amongst the two (text field or image link) would be good, design wise.
    Anyway, did u try the following:
    1. Add a flow layout to the table bean
    2. Add text input and image item to the flow layout.
    3. Attach the notes page as the destination uri for the image.
    Did u start the working on it, let us know how far did u reach so that we can guide you through from that point.

  • Bug or by Design? Commented-out ADF components still appear on .JSP page

    I normally use all .jspx pages, but for a couple of pages I'm using a .jsp page because I need to include <f:verbatim> HTML code.
    I'm noticing an odd occurrence where ADF component statements contained within comments still appear on the .jsp page (this does not occur with .jspx pages, and, regular comments w/o ADF components do not appear.) For example the following still shows up on the rendered page?:
    <!-- <af:panelLabelAndMessage label="#{bindings.View1mlm.label}">
    <af:outputText value="#{bindings.View1mlm.inputValue}">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.View1mlm.format}"/>
    </af:outputText>
    </af:panelLabelAndMessage> -->
    This statement is not contained with the verbatim tag which appears later. I've also re-saved, re-compiled, etc. to make sure I wasn't using an older version of the page.
    Is this a bug or something I'm not aware of related to <!-- comments containing af: components --> within a .jsp page?

    The different comments jsp are:
    <!-- This is an HTML comment -->
    <%-- This is a jsp comment --%>
    The difference is the HTML comment is send to the browser, but the browser should not render comments to the user.
    The jsp comments are not send to the browser, since they are stripped off by the compiler.
    This reminds me of one project, where we used the write HTML comments on the jsp-pages like
    <!-- This sucks, please correct before next release -->. Luckily, the QAs corrected us before going live. ;o))

  • Put a JSP page always on top

    Hello everyone!
    I'm trying to develop a jsp page that should stay on top of other windows, in other words, it should have a "always on top" property set to true.
    If anyone knows how to do this I would apreciate any help cause this is an urgent matter that I need to solve.
    Thanks in advance.
    Best regards

    Hello Everyone!
    The answer to my doubt is this:
    Use this function ShowModelessDialog refered on
    http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/showmodelessdialog.asp
    Thanks a lot anyway

  • Help needed urgently to get the values from the jsp page.

    hi,
    I am badly stuck into this problem.Please help me and find a solution.
    I am using ms-access and jsp.
    my database structure is as given below:
    m_emp_no | from_date | to_date | approver| status |
    1002 | 22/9/2008 | 23/9/2008|1003 |pending
    1004 | 29/9/2008 | 30/9/2008|1003 |pending
    2044 | 15/9/2008 | 16/9/2008|3076 |pending
    now this is exactly a leave apply scenario where a page is displayed and the user has to fill in the details to apply leave.then the approver has to approve that leaves so even, he should get the details in his account.
    for example here 1003 has to approve leaves for 1002 & 1004.i am able to fetch data from database for the particular approver here is the coding:
    <html>
    <body>
    <h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
    Approval Requests</font></span></b></u></h2>
    <form method="POST" name="f1" action="update.jsp">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
    PreparedStatement p=null;
    p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
    ResultSet r=p.executeQuery();
    while(r.next())
    %>  <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
        <tr>
          <td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
        </tr>
      </table>
      <table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
        <tr>
          <td width="100%" height="165" valign="top">
            <p align="left"><b>User ID</b>        :
    <input type="text" name="id" value="<%=r.getString(1)%>"  size="4   
         <b>status</b>:<%=r.getString(5)%</p>
    <p><b>Leave From</b> : <%=r.getString(2)%></p>
    <p><b>Leave From</b> : <%=r.getString(3)%></p>
    <p><b>Approve</b> : <select  size="1" name="approved">
            <option value="Approved">Approved</option>
            <option value="Cancelled">Cancelled</option>        </select></p>
    <%
    con.close();
    %>
      <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
              <tr>
                <td width="100%" bgcolor="#999966">
                  <p align="center"><input type="reset" value="Clear" name="B1"> 
                  <input type="submit" value="Submit" name="B2"></td>
              </tr>
            </table>
            </td>
        </tr>
      </table>
    </form>
    </body>
    </html>{code}
    this will display both the rows but when i try to retrieve the values into update.jsp using the code given below it gives me only one value which is the first 1002.
    {code}approved=(String)request.getParameter("approved");
    id=(String)request.getParameter("id");{code}
    but i need both the values to be inserted into the update.jsp only then the approver will be able to approve the leaves individually with respect to the m_emp_no.
    please help me out.
    thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    My comments below are all between (((((( and ))))))
    <html>
    <body>
    <h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
    Approval Requests</font></span></b></u></h2>
    <form method="POST" name="f1" action="update.jsp">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
    PreparedStatement p=null;
    p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
    ResultSet r=p.executeQuery();
    while(r.next())
    %> <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
    </tr>
    </table>
    <table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" height="165" valign="top">
    <p align="left"><b>User ID</b> :
    <input type="text" name="id" value="<%=r.getString(1)%>" size="4   
    ((((((( in the statement above, name="id" should be changed to something like name="id"<%=ii%>
    Where ii is a counter that tells you how many times you have gone through the loop so far.
    The reason for this is that each textfield you generate must have a unique name rather than all have the same name
    such as 'id'. This change will give them names such as id0, id1, id2. Then when you submit the page, you can uniquely
    identify each input textfield.))))))
    <b>status</b>:<%=r.getString(5)%</p>
    <p><b>Leave From</b> : <%=r.getString(2)%></p>
    <p><b>Leave From</b> : <%=r.getString(3)%></p>
    <p><b>Approve</b> : <select size="1" name="approved">
    (((( the above select also has to have a unique name for each time through the loop. Change it to name="approved"<%=ii%>
    <option value="Approved">Approved</option>
    <option value="Cancelled">Cancelled</option> </select></p>
    <%
    con.close();
    %>
    <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" bgcolor="#999966">
    <p align="center"><input type="reset" value="Clear" name="B1">
    <input type="submit" value="Submit" name="B2"></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    (((((((note you would be better off long term to put your business logic in a servlet and dispatch to the JSP page which will only have the responsiblity to display the data.
    Also, connection pooling is better than the above.

  • Importing Custom Classes into a JSP page

    Hello,
    I have created custom package com.srjgroup.report. It sits in C:\workspace\src\com\srjgroup\report directory. I have java files as well as compiled classes there. No jar files there.
    did amend classpath to point to this directory.
    In my JSP page I have the import statement as following
    import="java.sql.*, java.util.*, java.text.SimpleDateFormat, com.srjgroup.report.*"It imports all the packages without any errors. However, when I try to use one of the classes in the package, I get error
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 3 in the jsp file: /SQLServer.jsp
    Generated servlet error:
    SRJReports cannot be resolved to a type
    SRJReports is one of the classes that I am trying to use in that package. When I comment out all references to the class, everything is fine.
    So, to fix this I moved the entire package to
    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\lib direcory, preserving the hierarhy. So, now my custom package is located here:
    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\lib\com\srjgroup\report again there are no jar files, only java and classes here. Still, no go.
    What am I doing wrong ?

    Put the class in
    C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes\com\srjgroup\report
    One more thing, there is no subdirectory in lib directory. You may look at the example within tomcat for reference. I start from there.

  • Calling Java code inside JSP page and sending toString on object to Servlet

    Hi.
    I am trying to setup a way to make testing my application easier. Using a web-based method will work best. Here is what I am trying to accomplish:
    - Have a web page that will prompt the user to enter data, fill in text fields, make choices, etc. When done, they press the Submit button. I don't need to keep info between sessions. Just open browser, execute, view results, close browser, repeat.
    - I then want to take this data and use some Java Classes I have to create a Java object.
    - I then want to send the toString() results of this Java object to a known Java servlet. The result of the servlet's actions should be displayed as a response on the screen.
    This is what I currently have (Ignore the
    's - I don't know why they are showing up - its not important):
    Web page:
    <html>
    <head><title>TestGroup</title></head>
    <body>
    <form name=f method=post action=http://localhost:100/Servlet>
    Name: <br>
    Group: <input name=group type=text><br>
    <br>
    <input type=submit value=Submit>
    <input type=reset value=Reset>
    </form>
    </body>
    </html>The Java code in the JSP (where to put it?):
    <%
    Group g = new Group();
    g.setGroupName(request.getParameter("group"));
    String output = g.toString(); // I want this to go to the Servlet.
    %>But, now I am stuck as to how to piece these together. I have some JSP experience, but not quite like this.
    As I said, when the user presses the Submit button, I want to perform the Java code above, and have the results of the toString method sent to the Servlet, plus clear all other parameters (so they are not sent to the servlet).
    Does anyone have any advice/comments? I am open to alternative designs too, this is just the simplest one I could think of. If another JSP page is needed, that's fine too.
    Thanks.

    Hi.
    I am trying to setup a way to make testing my application easier. Using a web-based method will work best. Here is what I am trying to accomplish:
    - Have a web page that will prompt the user to enter data, fill in text fields, make choices, etc. When done, they press the Submit button. I don't need to keep info between sessions. Just open browser, execute, view results, close browser, repeat.
    - I then want to take this data and use some Java Classes I have to create a Java object.
    - I then want to send the toString() results of this Java object to a known Java servlet. The result of the servlet's actions should be displayed as a response on the screen.
    This is what I currently have (Ignore the
    's - I don't know why they are showing up - its not important):
    Web page:
    <html>
    <head><title>TestGroup</title></head>
    <body>
    <form name=f method=post action=http://localhost:100/Servlet>
    Name: <br>
    Group: <input name=group type=text><br>
    <br>
    <input type=submit value=Submit>
    <input type=reset value=Reset>
    </form>
    </body>
    </html>The Java code in the JSP (where to put it?):
    <%
    Group g = new Group();
    g.setGroupName(request.getParameter("group"));
    String output = g.toString(); // I want this to go to the Servlet.
    %>But, now I am stuck as to how to piece these together. I have some JSP experience, but not quite like this.
    As I said, when the user presses the Submit button, I want to perform the Java code above, and have the results of the toString method sent to the Servlet, plus clear all other parameters (so they are not sent to the servlet).
    Does anyone have any advice/comments? I am open to alternative designs too, this is just the simplest one I could think of. If another JSP page is needed, that's fine too.
    Thanks.

  • Simplification of a complex jsp page

    Hallo everybody,
    I'd like to discuss the following issue here:
    There is a huge jsp-file, with many struts logic tags, such that there is some business logic on presentation tier. This one jsp contains a large set of UI controls, which are used differently for a wide range of presentation cases: there are many conditions like [if we have the case 1, then this field is read-only; else if we have the case 2, then this and that fields are read-only] or [if we have not the case 3, then show this control, in the case 3 not] and so on.
    Any changes in such jsp are impossible, because it will take a month from anyone to understand where should he put a new stuff. I have to simplify this jsp-page. My idea: to separate all possible presentation cases in such a way, that there is a Struts Action and a corresponding separate jsp page for each case (or one Action for a small group of tightly related cases with separate page for each case). An Action contains a business logic, such that there are (almost) no struts logic tags on a jsp page, which defines rather strict appearance of UI controls. Some controls will be duplicated on different pages for different cases (e.g. each page will have the text field "Description"), but it will be clear, how does it all work in any particular case.
    Is it correct, what I propose, or may be there is some kind of a pattern, how to refactor in such situation?
    Thanks in advance for your comments!
    Andrew

    Can you not use jsp includes to split the page down into a number of smaller ones, each focussing on a different task, or create a tag library?
    Then you would only need to look at the file / tag that fulfilled the function you wanted to edit.

  • 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

Maybe you are looking for

  • The difference between N80 and N80IE ?

    What is the difference between M80 and N80ie?

  • Wiki: Using multiple hard drives, LVM & encryption

    I have lately found myself with the issue of having multiple hard drives and wanting to do LVM stuff & encryption with while retaining maximum flexibility. After scanning through wikis, manpages and forum entries I came up with a solution for myself.

  • Wipe my machine

    I need to wipe my Macbook Air, however I know by doing this I will loose my iTunes software which in turn means I have to wipe my iPhone.  How do i wipe my computer without either having to wipe my phone or if there isn't a  way to do this how do i b

  • Gantt Chart Related Problem

    Project Link: PPPM How to solve these problems. Problem 1: I have to scroll both the Gantt Chart and Task List scroll simultaneously. When i scroll Gantt Chart , then at the same time Task List and vice versa. Problem 2: How to stop Gantt Chart heade

  • Safari and Firefox Crashes all the time at launching

    Here is the report, i reinstalled firefox and safari, firefox is working but very unstable, and safari still out of order at launching i get a message : the problem may have been caused by the libfreetype.dylib plug-in. but while searching in spotlig