How to display differnt time fields in a single column?

Hello Sir,
I am trying to display the records which show the table with 3 columns filename,Date,status using jsp.
I am fetching the records from the DB and displaying them using jsp ,connection,resultset, <table> etc.
what i wanted to display is just 3 colms(filename,date,status)
here based on the status it should display the date,becaz table contains different date fieldcolumn for each status value.
here is my code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Content Dash Board</title>
</head>
<body>
<%@ page import="java.sql.*" %>
<%@ page import="java.text.*" %>
<% Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();%>
<%
int current = 1;
if(request.getParameter("current") != null) {
current = Integer.parseInt(request.getParameter("current"));
int skip = 5;
String action = "";
if(request.getParameter("action") != null) {
action = request.getParameter("action");
if ( action.equals("next") ) {
current += skip;
if ( action.equals("prev") ) {
current -= skip;
%>
<p> </p>
<p> </p>
<p>    </p>
<HTML>
<HEAD>
<TITLE>Content Dash Board </TITLE>
</HEAD>
<FORM NAME="form1" ACTION="dashboard.jsp" METHOD="POST">
<p> </p>
<%
Connection conn = DriverManager.getConnection
("jdbc:microsoft:sqlserver://localhost:1433;databaseName=trax;selectMethod=cursor","sa","iso*help");
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet resultset =
stmt.executeQuery("select * from ContentBatches");
resultset.last();
int rows = resultset.getRow();
if ( current >= rows ) current = rows-skip;
if ( current < 0 ) current = 1;
resultset.absolute(current);
%>
<TABLE BORDER="1">
<TR>
<TH bgcolor=#C6C3C6>File/BatchName</TH>
<TH bgcolor=#C6C3C6>Date</TH>
<TH bgcolor=#C6C3C6>Status</TH>
</TR>
<%
int i=0;
boolean next = false;
java.text.SimpleDateFormat fmt= new java.text.SimpleDateFormat("EEE, MMM d, yyyy K:mm a ");
DecimalFormat df = new DecimalFormat( "###,###,###,000,000" );
String filename=null;
String status=null;
do{
i++;
filename=resultset.getString(2);
status=resultset.getString(8);
%>
<TR>
<TD> <%= filename %> </TD>
<%
     if(status.equals("Received"))
          out.println("status is:"+status+"time stamp is :"+fmt.format(resultset.getTimestamp(7)));
%>
          <TD><%= fmt.format(resultset.getTimestamp(7)) %></TD>
<%
     else if(status.equals("Validated"))
%>
          <TD><%= fmt.format(resultset.getTimestamp(5)) %> </TD>
<%
     else if(status.equals("Published"))
%>
          <TD><%= fmt.format(resultset.getTimestamp(4)) %> </TD>
<%
     else if(status.equals("Uploaded"))
%>
          <TD><%= fmt.format(resultset.getTimestamp(6)) %> </TD>
<%
     else
%>     
          <TD>No data for this option</TD>
<%
%>
<TD> <%= status%></TD>
<td><a href="edit.jsp?BatchId=<%=resultset.getString(2)%>&DateTimeStampPublished=<%=resultset.getString(4)%>&Status=<%=resultset.getString(8)%>">Edit</a></td>
</TR>
<%
while((next=resultset.next()) && i<skip);
%>
</TABLE>
<p>
<BR>
<INPUT TYPE="HIDDEN" NAME="current" VALUE="<%=current%>">
<INPUT TYPE="HIDDEN" NAME="action" VALUE="next">
<%
if(next) {
%>                                         
<INPUT TYPE="BUTTON" VALUE="Next Record" ONCLICK="moveNext()">
<%
if(current > 0) {
%>
<INPUT TYPE="BUTTON" VALUE="Previous Record" ONCLICK="movePrevious()">
<%
%>
</p>
</FORM>
<SCRIPT LANGUAGE="JavaScript">
function moveNext()
form1.action.value = 'next';
form1.submit()
function movePrevious()
form1.action.value = 'prev';
form1.submit()
</SCRIPT>
</body>
</html>

i am very new to jsp sir, i haven't worked on servlet
, how do i implement the same code in servlet
could you provide me the steps , putting jar files
and all ?I'm not here to tutor you. You can read this:
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html
Servlets aren't difficult, and actually JSPs are nothing but servlets with a different syntax either.

Similar Messages

  • How to display the multiple rows in a single column ?

    Hi,
    I have the Query like this :
    SELECT MS.SUBJECT, MS.MESSAGEDESC, MS.MSGDATE, MAT.ATTACHMENT
    FROM MESSAGES MS, MSESAGEATTACHEMTASSO MAA, (select pga.programid,
    act.accountname,
    row_number() over(partition by pga.programid order by act.accountname) rn
    from accounttypes act, programpursesasso pga
    where act.accounttypeid = pga.accounttypeid ) MSGATTACHMENTS
    WHERE MS.MESSAGEID = MAA.MESSAGEID
    AND MAA.MSGATTACHMENTID = MAT.MSGATTACHMENTID
    AND MS.MESSAGEID = 1;
    If i have multiple messageAttachments for single message ., i want to display them in a single row.,
    like :
    subject messagedesc msgdate attachment1 attachment2 .....attachmentn
    test test 10/10/2007 test test test
    can any one help me out ., how can i do this using simple sql query ?

    Hi,
    Thanks for the Reply .,
    I have the 2 table like :
    DESC MESSAGES;
    Name Type Nullable Default Comments
    MESSAGEID NUMBER(16)
    EMAILFROM VARCHAR2(50) Y
    EMAILTO VARCHAR2(50) Y
    SUBJECT VARCHAR2(500) Y
    MESSAGEDESC VARCHAR2(2000) Y
    MSGDATE DATE Y
    MSGSTATUS NUMBER(1) Y
    MSGDELETESTATUS NUMBER(1) Y
    SQL> DESC MESSAGES;
    Name Type Nullable Default Comments
    MESSAGEID NUMBER(16)
    EMAILFROM VARCHAR2(50) Y
    EMAILTO VARCHAR2(50) Y
    SUBJECT VARCHAR2(500) Y
    MESSAGEDESC VARCHAR2(2000) Y
    MSGDATE DATE Y
    MSGSTATUS NUMBER(1) Y
    MSGDELETESTATUS NUMBER(1) Y
    SQL> DESC MSGATTACHMENTS;
    Name Type Nullable Default Comments
    MSGATTACHMENTID NUMBER(16)
    ATTACHMENT CLOB
    ATTACHMENTDATE DATE Y
    SQL> DESC MSESAGEATTACHEMTASSO;
    Name Type Nullable Default Comments
    MSGATTCHID NUMBER(16)
    MESSAGEID NUMBER(16) Y
    MSGATTACHMENTID NUMBER(16) Y
    What I need Is :
    If One Msg is having multiple attachement , then i want to display all the attachment in a single row along with MsgSubject, MsgDate, MsgDesc like
    I want to dipaly the MsgSubject, MsgDesc, MsgDate, Attachment1
    MsgSubject MsgDate Msgdesc Attachment1 Attachment2 Attachment3 ...etc

  • How to display a Sum field for a formula column?

    Hi,
    I need to display a sum for a formula column at the end of report. for example: my formu_col=col_1-col_2
    col_1 col_2 formu_col
    3 1 2
    6 5 1
    total:sum(col_1) sum(col_2) sum(formu_col)
    now i have sum(col_1) and sum(col_2), but i don't have sum(formu_col)
    thanks

    Hi
    You may add a summary column in the same data group that you have sum(col_1) and sum(col_2). In that properties of the new column point the source as formu_col.
    Hope this helps.
    Fouwaaz

  • How to display the time 00:00:00 as blank?

    Dear Friends,
    I have created a new field GDF_9000_CREATED_AT in the normal screen (dynpro), the format is TIMS, however, when there is no value for it, is always display like "00:00:00" on the screen.
    So how to display the time 00:00:00 as blank in the normal screen (dynpro) when there is no value for it?
    Thanks a lot!!

    In screen PBO module:
            LOOP AT SCREEN.
              if screen-name EQ 'my_time' AND my_time EQ time_zero.
                screen-invisible = 'X'.
                screen-active = 0.
                MODIFY SCREEN.
              endif.
            ENDLOOP.
    I don't try this, but i think is true...
    Edited by: Marco Modenese on May 7, 2009 10:36 AM
    Edited by: Marco Modenese on May 7, 2009 10:36 AM

  • How to display the time length of video (current time/ total time) ?

    Hi,everyone. I would like to ask how to display the time length of the video which show only in system example: it show the current time and total time? using AS 3.0.
    It there any information or solution to solve it? .
    I appreciate it any of you able to answer it. ^^
    Thank you.

    Hi,
    Actually I have this requirement for MAC OS 10.5. With the code you provided, I got the output as "6289375". When I changed the URL to point to my file (file:///Users/VPKVL/Desktop/MyRecord/tempAudio.wav), I am getting the below mentioned Exception:
    Exception in thread "main" javax.sound.sampled.LineUnavailableException: Failed to allocate clip data: Requested buffer too large.
         at com.sun.media.sound.MixerClip.implOpen(MixerClip.java:561)
         at com.sun.media.sound.MixerClip.open(MixerClip.java:165)
         at com.sun.media.sound.MixerClip.open(MixerClip.java:256)
         at TestWavLength.main(TestWavLength.java:13)The "tempAudio.wav" file is created by using java sound API. I am using the SSB USB Headphone Set to record the audio with the following settings for AudioFormat object:
    AudioFormat audioFormat = new AudioFormat(
              AudioFormat.Encoding.PCM_SIGNED, // the audio encoding
                                                            // technique
              48000.0F,// sampleRate the number of samples per second
              16, // sampleSizeInBits the number of bits in each sample
              2, // channels the number of channels (1 for mono, 2 for
                            // stereo, and so on)
              4, // frameSize the number of bytes in each frame
              48000.0F,// frameRate the number of frames per second
              false); // bigEndian indicates whether the data for a single
                            // sample is stored in big-endian byte order
                            // (false means little-endian)Can you please suggest where I am going wrong ?

  • How to display the time & battery % in home screen

    How to display the time &amp; battery % in home screen

    Try resetting your device.
    Hold down the Home and Sleep/Power Buttons until the Apple Logo shows up.
    Ignore the red slider if it appears.
    This will reboot the phone, no data should be lost.

  • How to get accumulated time field not actual time

    Hello-
    I have a field in a table as "time" however the time data is actually accumulated time over a period of a month not an actual time.  So for example.  We re reporting on Inbound and Outbound phone call duration per employee so we have:
    Inbound Duration:  71:45:52 (this is accumlated time, meaning 71 hrs, 45 min, 52 seconds) but when it is displayed in excel or crystal it shows as:
    1/2/1900 11:45:52 PM in excel.  I
    f you look at the format in excel it should be correct set in the number tab like:  custom [h]:mm:ss
    In the actual cell itself it shows the 71:45:52 but in the display that is where it shows the other 1/2/1900 11:45:52 PM
    11:45:52 in crystal since it's just a time field in the table
    Does anyone know how to correct this on either excel side or crystal?  We have our data in excel which we import into a table to use crystal reports on.
    thanks

    My formulas were assuming the data was coming in as a datetime value, as it was in your original post.  (Jason was typing his reply while I was typing mine...)  So, the formula with accumulation is (BASIC SYNTAX - make sure the formula editor has this selected, not Crystal Syntax):
    global secAccum as number
    dim sec as number
    dim min as number
    dim hr as number
    sec = DateDiff("s", CDateTime(1900,1,1,0,0,0), {csr_phones.duration})
    secAccum = secAccum + sec
    min = int(sec / 60)
    hr = int(min / 60)
    sec = sec - (min * 60)
    min = min - (hr * 60)
    formula = cstr(hr, "0") + ":" + cstr(min, "00") + ":" + cstr(sec,"00")
    And to show the accumulated seconds:
    WhilePrintingRecords
    global secAccum as number
    dim sec as number
    dim min as number
    dim hr as number
    sec = secAccum
    min = int(sec / 60)
    hr = int(min / 60)
    sec = sec - (min * 60)
    min = min - (hr * 60)
    formula = cstr(hr, "0") + ":" + cstr(min, "00") + ":" + cstr(sec,"00")
    HTH,
    Carl

  • COGI : how to display the time of  a goods movement?

    Hello,
    through COGI, I get the good movements with error per material.
    When I open the errors list for a material, I get the posting date for each good movements but not the time! 
    Could you please let me know how to do for displaying error time or posting time in this screen?
    Thank you for your help!
    François

    Deleted

  • How to show a time field in a form portlet

    Hi,
    I am not familiar with PL/SQL and I was wondering how I could show a time field on a form portlet.
    I have a date column in my database that stores the time and date together, but I do not know how to separate them into date and time fields. I also do not know how to concatenate them when a user inserts a new record, or how to query on a date alone.
    At present, the user has to type the date and time following this format mask hh:mi am DD/Mon/RR
    I also have a problem with one of my hidden id fields. I have set the default to a sequence.nextval (#qtc_app.seq_visitor.nextval) and then hidden it since
    it is irrelevant to my users. However, I can no longer use the query function since the sequence is always generating a new value. How would I only generate
    a new sequence no. when a user inserts a record??
    Thank you!
    cheers, Kim

    Hi,
    Each colunm in the form has a format mask associated with it. For the date column make the format mask like this DD-MON-RR HH.MI. This will show the date along with the hours and minutes.
    Thanks,
    Sharmila

  • How to display system time

    in sql we use sysdate in dual to display the system date like wise how to display the system time since i am a beginner i need ur help please.

    In Oracle Date Data Type save time information, all you need to do is using to_char function or NLS_DATE_FORMAT to display it,
    SELECT TO_CHAR(sysdate, 'DD-MON-YYYY HH24:MI:SS') FROM DUAL;
    or
    alter session set NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
    select sysdate from dual;

  • How to display the time in Swing jtable

    I need to display the time in jTable.
    The time is a date field in ORACLE database (connected via
    Oracle Thin drivers).
    Im totally stuck. Please help.
    TIA.

    Thanks for your reply.
    My problem is that I have to display time. This time is a DATE field
    in ORACLE database.
    Im using FORTE (UI). What the jTable display is the DATE (1900-01-01) which is not what I want. I want the time to appear in the jTable (hh.mm.ss a).
    What I did was to use the TO_CHAR function of ORACLE to format the
    date to display the correct time in the VIEW before mapping this view
    to be used as a MODEL by the jTable.
    It works now.
    Much appreciate all your help. Thanks.

  • How to display different Time Statement forms in ITS service PZ04

    Hi all,
    I am working on a underlyinge R/3 4.7 system and are working with standalone ITS and ESS 50.4. I am posting this question to find out if any of you has experience with my problem.
    The business wishes to use the ITS transation PZ04 standard and wish to be able to display different Time Statement forms in the transaction through customized variants for the report(RPTEDT00) that the PZ04 transaction executes. In the IMG it is posted that one variant has to be created called HRESS_TEDT00 and this works, but restricts the PZ04 transaction to always be called with this variant and therebye the same Time Statement form every time.
    I then by debugging found that the underlying ABAP code processed from SAP standard has a variable VARIANT that is hardcode to = HRESS_TEDT00.
    The question is: Is there anyway to setup the PZ04 transaction so that it can be dynamic decided which variant should be used, f.ex. from persons subarea from infotype 0001?
    Looking forward to here if anybody can help.
    Regards,
    Allan Brauer

    hi allan,
    cud u plz help me how to sort out this problem actually in mu company the same scenario is here need to be display pe51 form instead of standard hrforms.....
    plz help me how will i replace this "hrforms with pe51"..

  • How to display/create Local field in SAP query

    HI All,
    I'm new to abap query. I have to include a local field in the existing query. I know through SQ01->Edit->Local field we can display the Local fields, but the options under Local Fields menu option are disable even in change mode of Query.
    So, later through SDN found that, I have to Switch On the short names menu option. Even the sub-options in Short Names are disabled.
    Can any body please let me know how can we display the local fields to the change the formula and how can we create the new local fields in the existing qeury.
    Hope I'm able to explain my issue clearly.
    Thanks in advance.

    You can create the local fields in the "Select Field" screen. (Third screen after "Title, Format" and "Select Field Group") This option is disabled on the other screens.<br />
    <br />
    <i>Reference : <a class="jive-link-external" href="http://help.sap.com/saphelp_NW70EHP1/helpdata/en/d2/cb4186455611d189710000e8322d00/frameset.htm" target="_newWindow">Defining Local Fields</a> in <a class="jive-link-external" href="http://help.sap.com/saphelp_NW70EHP1/helpdata/en/d2/cb3efb455611d189710000e8322d00/frameset.htm" target="_newWindow">SAP Query</a>.</i><br />
    <br />
    Regards,<br />
    Raymond

  • How to display 10 times ' linktoaction '  text in view ?

    HI,
    Experts,
    I want to display 10 times " LinktoAction " ui element in a view for that how to write the code and in which method we have to write the code.
    thanks in advance,
    Shabeer ahmed.

    hi,
    To display LinkToAction :
    One option would be to create 10 LinktoAction UI in the layout. All would have differeent actions available to which you can write the logic as per required.
    If you want to dynamically add LinkToAction on a button event or so , then you can use RowRepeater UI and inside this place LinkToAction. On every action of button , add one more LinkToACtion. This would be good if you dont know the number of UI at design time but as you know that you want 10 LinkToAction, create UI and make them invisible by default . When required , make the LinkToAction Visible.
    Refer SAP Online help on LinkToAction UI : http://help.sap.com/saphelp_nw2004s/helpdata/en/0f/e8884118aa1709e10000000a155106/content.htm

  • How to display "Metadata Only" field in Update Form

    Hi,
    I have added the below configuration in Config.cfg file to make Primary File non mandatory,
    AllowPrimaryMetaFile=true
    suppressAlternateFile=true
    createPrimaryMetaFile=true
    After restarting the server it displayed "Metadata only" fileld upon selecting Primary File became non mandatory, but while updating the Content this field is not getting displayed, rather it is displaying Original File field and Primary File became mandatory.
    Could you please let me know how to make Primary File non mandatory (otherwise displaying "Metadata only") in Update form. Appreciate your help on this. Thank you.
    Thanks,
    Ashok

    Hi Srinath,
    Thank you for responding, here we need to make Primary File non mandatory by displaying "Metadata only" field. we achieved this in Check In form, we need the same in Update Form.
    From the Kyle blog, he specified that option to completely hide Primary File but our requirement is making non mandatory by introducing metadata only field.
    Thanks,
    Ashok

Maybe you are looking for