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.

Similar Messages

  • Print statement in JSP page after redirection

    Hi,
    I have written a JSP page and in that i am redirecting it to another page. Now after redirection i am printing a statement on the console. It is getting printed whereas when i am printing the same on the browser i am not able to print that. Please can any one tell me the difference between printing the same on the console and browser.
    My first JSP page(one.jsp)
    <%
         response.sendRedirect("two.jsp");
         out.println("After redirect");
         System.out.println("After out");
    %>
    My second JSP(two.jsp)
    <%
         out.println("In two.jsp");
    %>
    Thanks in advance
    regards
    Prashanth

    The sendRedirect sets a code in the HTTP response being sent to the client (I believe it is a 302 code but I am not sure off hand) and then proceeds to process the rest of the JSP on the server which is why the print statement shows up in the console.
    The out.println writes to the HTTP response output stream. The client gets the response and sees the HTTP Header code telling it to make a new request so it stops processing the response message and sends a new request message which is why the out.println message is not seen in the browser.

  • Problem with printing debug statements in JSP page

    Hi all,
    I am debugging an application with System.out.println() statements - my debug statements in the *.java class printed just fine, but when I do the same thing in my JSP page, nothing gets printed out.
    I am already wrapping my System.out.println() statements inside the <% %> tag.
    Does anyone know what may be causing this? Any help will be greatly appreciated!
    - JL

    Where do you expect to see the output?
    System.out.println will write to the console/logs
    They WON'T write to the JSP page.
    If you check your error/output logs you will probably find the statements there.
    If you want to print things into the JSP page, just use out.println.
    "out" is an implicit reference to the current JSPWriter.
    Cheers,
    evnafets

  • Remembering the radio button state between jsp pages

    How do i maintain the state of radio buttons when i move from one jsp page to another. Thank you for your help.

    Hi
    If the next JSP is a child window,you can take a JSP hidden variable and you can store radio button state in it and can get the same on child window thorugh window.opener.
    And if its not a child window(JSP),then you can maintain the state in session and get it anywhere.

  • Error msg in IF ELSE statement in jsp page, Need help

    Below is my code I am trying to execute, but keep getting an error:
    Compilation error occured:
    Found 1 errors in JSP file:
    D:\\http\\proFolder\\student.jsp:130: Syntax: "}" inserted to complete StatementNoShortIf
    <%if (assess.getNumberValue() > 0) {%>
         <%if ((assess.getTotalCost(appForm)) <= (assess.getNumberValue())) {%>
         <strong><%=assess.getTotalCost(appForm)%></strong>      
            <%}%>
    <%}%>
    <%else {%>
         <%=assess.getTotalCost(appForm)%>
    <%}%>Basically, What I am trying to do is follow this logic:
    IF method getNumberValue() is greater then 0, then execute the second IF statement that
    is, If method getTotalCost() is less then or equal to getNumberValue() then display value of method getTotalCost()
    End Second IF
    End First IF
    Now if the First IF fails ( that is getNumberValue() is not gether then 0)
    then execute the else statement
    Could someone please guide me what I am doing wrong, and what would be the correct way of write the IF else code
    Thanks,

    <%     if (assess.getNumberValue() > 0) {
              if ((assess.getTotalCost(appForm)) <= (assess.getNumberValue())) {
    %>
                   <strong><%=assess.getTotalCost(appForm)%></strong>      
    <%          
    %>
    <%
         else {
    %>
              <%=assess.getTotalCost(appForm)%>
    <%
    %>

  • MySql select statement in jsp page

    Ok,
    I need help with this select statement.
    <%
    // Determine what option is set to.
    if(option == null || "".equals(option) || "Verify1".equals(option)){
      if("Verify1".equals(option)){
      // Retrive query specific to submitted form.
      try {
          Class.forName("org.gjt.mm.mysql.Driver").newInstance();
          conn = DriverManager.getConnection("jdbc:mysql://" + mysql_host + ":3306/" + mysql_database, mysql_login, mysql_password);
          st = conn.createStatement();
          rs= st.executeQuery("SELECT organization FROM tblevent_approval WHERE MAX (keyid))";
          // Get query results.
          while(rs.next()){
            organization = rs.getString("organization");
      finally {
            if(rs != null){
              rs.close();
            if(st != null){
              st.close()
            if(conn != null){
              conn.close();
    %>THE ERROR I AM GETTING
    Syntax error, insert ")" to complete Expression

    This line has the closing bracket inside the closing quote for the statement...
    >       rs= st.executeQuery("SELECT organization FROM tblevent_approval WHERE MAX (keyid))";It should be:
    rs= st.executeQuery("SELECT organization FROM tblevent_approval WHERE MAX (keyid)");A simple typo ;-)
    Hope this helps...

  • 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 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

  • Using return statement in jsp

    Hi all,
    I am using return statement in JSP page after a redirect to stop executing that page. If the data bean is not present then it must go to previous page. When this return statement is executed the previous page is displayed but url in browser remains same. Why it is so ?. Is there any other way to tell a JSP page to stop executing and redirect to another page.
    rgds
    Antony Paul

    Hi Antony,
    do you use the "forward()" method or the "redirect()" method???
    rgds
    Howy

  • *** 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/

  • 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.

  • Can someone help me correct this sql statement in a jsp page?

    ive been getting the java.sql.SQLException: Incorrect syntax error for one of my sql nested statements. i cant seem to find similar egs online, so reckon if anyone here could help, really appreciate it.
    as im putting the nested sql in jsp page, it has to be with lots of " " n crap. very confusing if there are nested.
    heres the sql statement without those "" that i want to use:
    select top 5 * from(
    select top+"'"+offset+"'"+" * from prod where cat=" +"'" cat "'"+"
    )order by prodID desc
    when i put this in my jsp pg, i had to add "" to become:
    String sql = "select top 5 * from("+"select top"+"'"+offset+"'"+" * from prod where cat=" +"'" +cat+ "'"+")order by prodID desc";cat=" +"'" cat "'"+")order by prodID desc";
    all those "" are confusing me to no end, so i cant figure out what should be the correct syntax. the error says the syntax error is near the offset.

    If offset is, say, 10, and cat is, say, "new", then it looks like you're going to produce the SQL:
    select top 5 * from(
      select top '10' * from prod where cat='new'
    )order by prodID descThat looks exactly like incorrect syntax to me... top almost certainly can't handle a string literal as its operand... you almost certainly would want "top 10" instead of "top '10'"...
    If you use PreparedStatement, you don't have to remember what you quote and what you don't and you can have your SQL in a single static final string to boot...

  • Calling a jsp page from an if statement??

    Hi I am going toexplain what I can do already first then explain what I want to do:
    1) I have an html page that has a form. This form requests a userId and password to be entered. Upon submission of this form a java servlet is called
    2) the java servlet checks the initial inputted values of the form. I check to enusre that the user did enter somthing in both fields. I also check to make sure that the user did not enter just spaces.
    3) I return a error message to the user if the input is invalid ( I do this through a series of if statements)
    What I want to happen: Instead of simply return an error message, I would like to jump out of the java if statement and into a jsp page (or another html form I havent decided yet)
    In this seperate page I would like to display the form again with the incorrect areas highlighted. I am just not sure how to transfer control from the if statement to the new jsp page.
    All help is appreciated!
    Thanks

    If you want to transfer control from servlet(.java file) to JSP file or servlet to servlet than use
    public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException
    if(..)
    res.sendRedirect("http://abc.com/foldername/page1.html");
    }else if(..){
    res.sendRedirect("http://abc.com/foldername/page2.jsp");
    }else if(..){
    res.sendRedirect("servlet3");
    }//end if
    }//end doPost

  • Regarding incorporate the two page nations in the same JSP page

    Hi folks,
    i am unable to do two page nations in the same JSP page using paging tag libray,I am getting the follwoing problem while setting the offset value to the Pager.offset.
    I have written the code like this.
    <pg:pager items="<%=size%>" export="sreenyOffset=offset, currentPageNumber=pageNumber;" isOffset="true" scope="request">
         <pg:index export="totalItems=itemCount">
         <% System.out.println("Before currentPageNumber:"+currentPageNumber); %>
         <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" nowrap>
              <tr class="pagenation" >
                   <td width="1%">&nbsp<br><br></td>
                   <td width="40%" align="left"> 
                        <pg:page export="firstItem, lastItem">Displaying results <strong><%= firstItem %>-<%= lastItem %></strong> of <strong><%=      totalItems %></strong> found</pg:page></td>
                             <td width=20%></td>
                        <pg:prev export="pageUrl,firstItem" >
                             <td width="5%" align="right" height="22">
                             <a href="javascript:submitSearchForm(document.organizationForm,'<%= firstItem %>')"><b>Previous</b></a></td>
                        </pg:prev>
                        <pg:pages export="pageUrl,firstItem,pageNumber">
                        <%
                             System.out.println("pageNumber :"+pageNumber+"^currentPageNumber:"+currentPageNumber);
                        %>
                             <% if (pageNumber == currentPageNumber) { %>
                                       <td width="2%" align="right" height="22"><font color=#FFFFFF><%= pageNumber %></font></td>
                             <% } else { %>
                             <td width="2%" align="right" height="22">
                                       <a href="javascript:submitSearchForm(document.organizationForm,'<%= firstItem %>')"><font color=#415481> <%= pageNumber %> <font></a>
                   </td>
                        <% } %>
                        </pg:pages>
                        <pg:next export="pageUrl,firstItem" ifnull="<%= true %>">
                             <% if (pageUrl != null) { %>
                   <td width="5%" align="right" height="22">
                        <a href="javascript:submitSearchForm(document.organizationForm,'<%= firstItem %>')"><b>Next</b></a></td>
                        <% } %>
                        </pg:next>
              </tr>
         </table>
         </pg:index>
              <html:hidden property="offset" value="0"/>
              <html:hidden property="pager.sreenyOffset" value="0"/>
    </pg:pager>
    I need some clarification for following things.
    1)i have given the export like this
    export="sreenyOffset=offset, currentPageNumber=pageNumber;"
         but while setting the offest for pager, i am doing like this
                   <html:hidden property="pager.sreenyOffset" value="0"/>
         can i customize the pager.offset to pager.(someting) like that.
    2)if i use pager.offset for two page nations in the same page pager.offset value is overriding,So i am unable to maintian the page nations.
    3)i can change the offset value into sreenyoffset in the export property of pager tag,if iam able to change the pager.offset value to customized value my problem will solve.
    4)
    can i declare the export property like this.
    <pg:pager items="<%=size%>" export="sreenyOffset=offset, currentPageNumber=pageNumber;" isOffset="true" scope="request">
    Please give me your valuable suggestions,it will be very helpful to me.
    Also give me some suggestions how to do the two page nations in the same page.I am desperately waiting for response.
    Thanks & Regards,
    Sreeny Reddy.

    Hi,
    I was trying the pagination concept in jsp. I am getting a lot of errors. Can u help me for displaying this pagination.i need to display dynamic records according to search criteria. In search criteria, an area is selected and the data related to that area should be displayed from a table in mysql . It has 100+ records each
    with 6 columns, each page should be displaying 10 records, what we call pagination. I was trying this(in java jsp)( should not do in struts, should be done only in jsp) for a long time. By ur faq, i understood u hava already done it. Pls try to help me. Can u pls send me a sample program regarding this?
    I would be very grateful if u help me.
    thanks in advance,
    regards,
    mv.

  • 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

Maybe you are looking for

  • Can we split data in field into 2 fields?

    Have 'city, state' in 1 column, and would like to move the city to the previous column, remove the comma-space and leave the state in the original column. About 50% of the data in the column in question has this error. Any ideas?

  • EPS_GET_DIRECTORY_LISTING in background mode

    Hi gurus, I have created a program to get all files in a directory on a server, I am using the FM EPS_GET_DIRECTORY_LISTING. It's working good in the foreground mode, but it's not the case of the background mode, I got no files. Thanks in advance for

  • Decrypting an ecrypted data field in Oracle Database

    I am trying to decrypt an ecrypted data field (which is in Oracle Database)in Java. Can somebody help me since I am totally new to this. Thanks

  • Multiple selection of rows in webdynpro

    Hi All, How can we achieve the multiple selection of rows in a table in webdynpro and delete the same. If i have a table with 4 rows i have selected 2 rows and i have to delete those 2 rows. Thanks in Advance, Bsreddy.

  • Temporary table - yes or no?

    I need to create a list of reports on the fly. The user will be able to pick from the list (with check boxes) which reports he wants printed. The reports will also be created on the fly. It's a long list of reports (30+) and it is always different. T