Tricky table formatting using jstl
I have an array List of elements of size for example50. I need to retrieve the elements as shown above and print them as a two dimensional table as below:
The steps involved as below:
1. I need to check the size of array say Z
2. Divide it by 10 (ceil Z/10) and find the number of columns needed
3. Print the elemnts from the ${List} as follows:
1stelement 11thelement 21stelement 31stelement 41stelement
2ndelement 12thelement 22ndelement 32ndelement 42ndelement
10thelement 20thelement 30thelement 40thelement 50thelement I tried few methods and I feel it as bit trick for me as a beginner. I would appreciate very much if someone could help me! Thanks.
So the requirement is to split the list into 10 rows, and as many columns as are required?
Here is some basic code:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ page import="java.util.*" %>
<html>
<body>
<%
int numToDo = 50;
List listOfNumbers= new ArrayList();
for(int i=0; i<numToDo; i++){
listOfNumbers.add(Integer.valueOf(i));
pageContext.setAttribute("List", listOfNumbers);
int numCols = (int)Math.ceil(listOfNumbers.size() / 10.0);
pageContext.setAttribute("numCols", new Integer(numCols));
%>
<table>
<c:forEach var="entry" items="${List}" varStatus="status">
<c:if test="${status.index % numCols== 0}">
<tr>
</c:if>
<td>${entry}</td>
<c:if test="${status.index % numCols== (numAppsPerLine-1)}">
</tr>
</c:if>
</c:forEach>
</table>
</body>
</html>The issue is how to calculate how many columns correctly.
JSTL/EL doesn't have rounding math operators available, so I did that bit in scriptlet code for a quick/dirty approach.
Apart from that calculation, it is all standard JSTL/EL.
Basically it just keeps track of the index (using the varStatus variable) and starts/ends a table row as necessary.
Cheers,
evnafets
Similar Messages
-
Table format used in the 'sums' table
Hello,
If you ask numbers to insert a table of the type 'sums', then a table is inserted which has a a thick white line above the last row.
I have many tables and I would like to format them like the sum table.
Therefore, I would like to know how I can insert a thick white line above the last row?
Thanks,
SanjayPlease open Numbers then click Help > Numbers User Guide, it contains much useful information. If after doing all that you cannot find your question or an appropriate answer to your question then by all means come back and ask your question. We'll be pleased to assist you.
These discussions are user to user, not Apple employees answering the question. Questions will be answered as a user such as yourself finds time, desires to, or is willing to respond.
Welcome to Numbers discussions, have fun.
Sincerely,
Yvan KOENIG (from FRANCE dimanche 2 novembre 2008 11:28:16) -
Using Pages, I have created a document and inserted a Table for use logging an inventory. When I came to print this document the lines and boarders of the Table feature did not print however the text did print in the table format. How do I get the lines and boarders to print also?
Using Pages, I have created a document and inserted a Table for use logging an inventory. When I came to print this document the lines and boarders of the Table feature did not print however the text did print in the table format. How do I get the lines and boarders to print also?
-
Hi,
I am using get-ADuser in order to extract a few AD attributes of some users. I export the users and their respective attributes to a CSV. However, the output in CSV i get has the following format in each cell for its AD attribute.
@{description=<Value>} or @ { info=<Value>}
I have tried to use Expandproperty switch in order to get rid of it but it does not accept null values and hence if a user has no value for a said attribute, the previous value is copied for that user too. However, without expand property it gives me the
above format in the output.
$Desc = Get-ADUser $Username -Properties description | select description
I would like the cells to contain only values and not this format along.
Also, once I have the CSV with values I would also like to copy the values from CSV in an email in the form of a TABLE. I have been able to copy the content in an email using the following however, this in not in a table format.
$mail = Import-Csv $newlogonfile | Out-String
Please HELP!Yes I am already using Export-Csv but still getting the same kind of format in output :-
$Username = $Event.Properties[5].Value
$Title_var = get-aduser $Username -properties Title | select Title
$Ofc_phone = get-aduser $Username -Properties OfficePhone | select OfficePhone
$Info_var = get-aduser $Username -properties info | select info
$Display_Name = get-aduser $Username -properties DisplayName | select DisplayName
$Mail = Get-ADUser $Username -Properties Mail | select Mail
$Desc = Get-ADUser $Username -Properties description | select description
$Props = @{
User = $Event.Properties[5].Value;
TimeCreated = $Event.TimeCreated;
LogonType = $Event.Properties[8].Value;
DCName = $Event.MachineName;
Workstation_address = $Event.Properties[18].Value;
Title = $Title_var;
OfficePhone = $Ofc_phone;
Info = $Info_var;
DisplayName = $Display_Name;
Description = $Desc;
EMail = $Mail
$LogonRecord = New-Object -TypeName psobject -Property $Props
$Result += $LogonRecord
$Result | Export-Csv -Path $logFile -append -UseCulture -NoTypeInformation # Log it to CSV
OUTPUT has values in this format in the CSV :-
@{info=} @{description=abc} @{DisplayName=} @{Officephone=}
@{Mail=[email protected]} -
How to format a calculated field using JSTL
Hi,
I have one field as following:
<input type="text" class="fixedInput" name="grossRevenue<%=i%>" value="<%=((LineOfBusinessMetrics)lineOfBusinessMetricsList.get(i)).getGrossRevenue().setScale(2,BigDecimal.ROUND_HALF_UP)%>" size="16" onfocus="this.blur()" /></td>
In the above line of code, I have one list called lineOfBusinessMetricsList. From this list, I am fetching the object of LineOfBusinessMetrics, from this object, I am fetching the value of Gross Revenue and casting it to LineOfBusinessMetrics.
Now I am trying to format the Gross Revenue using JSTL tag "fmt" as following:
<td class="grey3"><input type="text" class="fixedInput" name="<c:out value='grossRevenue${i}'/>" value="<fmt:formatNumber type="number" value='${lineOfBusinessMetricsList.grossRevenue}' minFractionDigits="2" maxFractionDigits="2" />" size="16" onfocus="this.blur()" /></td>
The above modified code wth JSTL tag fmt is not working correctly.
Can anyone help me to get this code work.
Thanks in Advance,
VijayYou must submit the page to do it with PL/SQL. If you do not want to submit the page, you must do it with JavaScript.
Thanks,
Tyler -
I want to display the Employee details in table format without using iGrid
Hi all,
Can anybody help me that I want to display the Employee details return by transaction in table format without using iGrid.Hi, view the link below.
http://help.sap.com/saphelp_xmii115/helpdata/en/Advanced_Topics/Customizing_Output/Customizing_Output.htm
Hope this help.
Danilo Santos -
Format of table displayed using h:panelGrid tag
Hi ,
I want to display a table using h:panelGrid as below
Account Information - This is the caption for the table
Account Name : bola
Account Number: 12345
<h:panelGrid columns="2"
cellspacing="0"
styleClass="abc">
<f:facet name="header">
<h:outputText value="Account Name" />
</f:facet>
<h:outputText value="#{controller.accountname}" />
<f:facet name="header">
<h:outputText value="Account Number" />
</f:facet>
<h:outputText value="#{controller.accountnumber}" />
</h:panelGrid>If i code like this i get
Account Name
Bola
I want the generated HTML to be something like this:
table cellspacing="0" class="abc">
<caption class="marTopNone">Account Information</caption>
<tr>
<th>Account Name:</th>
<td>bola</td>
</tr>
<tr>
<th>Account number</th>
<td>1234</td>
</tr>Iam not sure if can acheive this using h:panelGrid tag . Please advise.
Thank you
Edited by: twisai on Oct 21, 2009 8:40 AMHi Balusc,
thanks for the reply . But if i put both the column names in the facet header only one column name is generated as header . The output i get is
Accout Name
bola | 1234
I want data my table to be like
Account Name : bola
Account no: 1234
Please let me know if i can generate table in this format using <h:paneGrid> tag
Thank you so much -
Extract the table formated data using itextsharp in c#
I have one pdf file in which i need to extract table formated data in a specific format by each filed.I tried by using itextsharp but data comes in unspecified format. Can any one help me on this.This is very useful for me.
please find attchement for pdf and their fields
Field Name(as per RRC Records or wildcat): Block A-34(SAN ANDRES)
LEASE NAME: SIGHT FOR SORE EYES
OPERATOR'S NAME: RING ENERGY, INC.
API No:42-003-39809
like wise all fileds.Hello Manideep Lakkakula,
As ITextSharp is a library from here
http://sourceforge.net/projects/itextsharp/ and also PDF is third party product, I'm afraid you have to post on specific forum about ITextSharp library instead of here. C# is just a language forum.
Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
I am trying to use Reader X/ Adobe Export to send a pdf to excel but everytime I send it and then open the excel file the table format and information is all screwy. How can I fix this. I am trying to put together pricing sheets for my workshop. Thanks and I hope someone can help.
_RobYou'll want to ask at Adobe's forum for the ExportPDF.
http://forums.adobe.com/community/exportpdf
Be well... -
Multiple table format through email using powershell
Hi All,
I have a powershell script which executes a SQL Query on three SQL instances and provides the result in table format through email. The output email contains all the result of the query in a single output itself. Please help me, I have provided the code
which I am using
Sample output format which I am getting:
ServerInstance
Databasename EnabledStatus
Instance1 Database1
Enable
Instance1 Database2
Enable
Instance1 Database3
Enable
Instance2 Database1
Enable
Instance2 Database2
Enable
My requirement is I should get two table formatted email like below:
Database status of Instance 1
ServerInstance
Databasename EnabledStatus
Instance1 Database1
Enable
Instance1 Database2
Enable
Instance1 Database3
Enable
Database status of Instance 2
ServerInstance
Databasename EnabledStatus
Instance2 Database1
Enable
Instance2 Database2 Enable
#This PowerShell Scrip is well-suited with PowerShell V3.0
#import SQL Server module
#Import-Module SQLPS -DisableNameChecking
#get all the instances and temporarily store them in a variable
$ServerInstances = Get-Content "C:\SQL_Servers.txt"
$scriptFile = "C:\restoredetails_mountdrive.sql"
$a = "Hi All, <BR> <BR>"
$a = $a + "Below is the TESTING Environment. This is an auto-generated mail.<BR><BR>"
$a = $a + "<style>"
$a = $a + "BODY{background-color:white;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 0px;width:150%;cellspacing=0 ;padding: 10px;border-style: solid;border-color: black;background-color:#43B2B2;font-family: Verdana;font-size:13 }"
$a = $a + "TD{border-width: 0px;width:150%;cellspacing=3 ;padding: 10px;border-style: solid;border-color: black;text-align: left;background-color:white;font-family: Verdana;font-size:11}"
$a = $a + "</style>"
#he database we want to execute it against, regardless of the instance
$DBName = "master"
#iterating through all instances.
$ServerInstances |
ForEach-Object {
#For each instance, we create a new SMO server object
$ServerObject = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $_
#use the Invoke-Sqlcmd cmdlet to execute the query
#we are passing in the pipeline is the instance name, which is $_
$refresh_output1 = $refresh_output1 + (Invoke-Sqlcmd `
-ServerInstance $_ `
-Database $DBName `
-InputFile $scriptFile
#-Query $SQLQuery
[string]$tst = $refresh_output1 |convertTo-Html -Head $a -property InstanceName, DatabaseName,OverallStatus | Out-String
write-output " "
[System.Net.Mail.MailMessage]$message = New-Object System.Net.Mail.MailMessage("emailid.com", "toemailid.com", "Subject", $tst )
[System.Net.Mail.SmtpClient]$client = New-Object System.Net.Mail.SmtpClient("smtpserver",25)
$Message.IsBodyHtml = $true
$client.Timeout = 100
$client.Send($message)Generally it's best to post in the Hey Scripting Guy forum, they are scarily good in there. Someday i hope to give an answer so perfect that not even jrv can improve on it.
Your approach might be possible but it's not the way i'd do it. The ConvertTo-HTML is pretty clever, it works well with arrays of objects. If you were to load each result into a custom PSObject then add that to an array of them for later processing you can
get the table formatting almost for free.
I haven't worked with SQL queries in a bit but this might work, it seems ok when i put token results in for the SQL result.
#This PowerShell Scrip is well-suited with PowerShell V3.0
#import SQL Server module
#Import-Module SQLPS -DisableNameChecking
#get all the instances and temporarily store them in a variable
$ServerInstances = Get-Content "C:\SQL_Servers.txt"
$scriptFile = "C:\restoredetails_mountdrive.sql"
$a = "Hi All, <BR> <BR>"
$a = $a + "Below is the TESTING Environment. This is an auto-generated mail.<BR><BR>"
$a = $a + "<style>"
$a = $a + "BODY{background-color:white;}"
$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
$a = $a + "TH{border-width: 0px;width:150%;cellspacing=0 ;padding: 10px;border-style: solid;border-color: black;background-color:#43B2B2;font-family: Verdana;font-size:13 }"
$a = $a + "TD{border-width: 0px;width:150%;cellspacing=3 ;padding: 10px;border-style: solid;border-color: black;text-align: left;background-color:white;font-family: Verdana;font-size:11}"
$a = $a + "</style>"
#he database we want to execute it against, regardless of the instance
$DBName = "master"
#Create an empty object collection
$objectCollection = @()
#iterating through all instances.
$ServerInstances |
ForEach-Object {
#For each instance, we create a new SMO server object
$ServerObject = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $_
#use the Invoke-Sqlcmd cmdlet to execute the query
#we are passing in the pipeline is the instance name, which is $_
$SQLResult = (Invoke-Sqlcmd `
-ServerInstance $_ `
-Database $DBName `
-InputFile $scriptFile
#-Query $SQLQuery
$objectCollection += New-Object -TypeName PSObject -Property @{
"InstanceName" = $_ ;
"DatabaseName" = $DBName ;
"OverallStatus" = $SQLResult["OverallStatus"];
$objectCollection | ConvertTo-Html -Fragment
[System.Net.Mail.MailMessage]$message = New-Object System.Net.Mail.MailMessage("emailid.com", "toemailid.com", "Subject", $objectCollection)
[System.Net.Mail.SmtpClient]$client = New-Object System.Net.Mail.SmtpClient("smtpserver",25)
$Message.IsBodyHtml = $true
$client.Timeout = 100
$client.Send($message) -
How to use JSTL create a dynamic table according to a database???
How to use JSTL create a dynamic table according to a database in a web page? Who can help me? Thanks.
How to use JSTL create a dynamic table according to a
database in a web page? Who can help me? Thanks.???
Could you rephrase your quesion?
Do you want to display records by reading from a table in DB? -
Exception When trying to Format XML using JSTL
Hi all
I m trying to display content of XML in a .jsp page using JSTL ,
When i try to dispaly the content it is thowing an exception :
org/saxpath/SAXPathException
Can any one please help ....
i m using jstl1.0.6.jar and standard-1.0.6.jar
Code Snppet Used:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<c:set var="someXML">
<name>Sri</name>
</c:set>
<x:parse var="parsedDocument" xml="${someXML}" />
<x:out select="$parsedDocument/name" />
Thanks in AdvanceThank for reply
I had even tried with this code:
<c:set var="someXML">
<person>
<name>Joe</name>
<age>30</age>
</person>
</c:set>
<x:parse varDom="parsedDocument" xml="${someXML}" />
<x:set var="name" select="$parsedDocument/person/name" />
<c:out value="${name}" />
even then i m getting the same exception:
Message: org/saxpath/SAXPathException -
Need to display in a table format
Hi,
From my database i need to get the values for , UserName and Password and display in a table format .
I could get the values from the database using
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from Login");
while(rs.next()){
out.println(" <br> ");
out.println(rs.getString("username");
out.println(rs.getString("password");
}it works fine and displays like below......
user1 pwd1
user2 pwd2
..... ...May i know how to get it in a tabular format as an output
pls provide sample code for it.
I would be thankful to u guys,
Thanks & Regards,
Raghu.From my database i need to get the values for ,
UserName and Password and display in a table format
.Really, really bad idea.
There is never any need, in any implementation to display or even keep actual passwords.
>
May i know how to get it in a tabular format as an
outputAs in a GUI? Then that is a GUI question not a JDBC one.
Something else? Then you need to explain exactly what the destination is and what defines it as 'tabular'. -
How can i convert oracle report in excel format using 8i
hi,
I want to convert oracle report in excel format using 6i reports. please give the solution with emp table.
millons of thanks in advance.You'll have to use the destype DELIMITEDDATA to render your Report in CSV format. Then set the mime type to Excel. I don't know the exact syntax, so please do a search in metalink for "reports excel" for examples and more info.
Regards,
Martin Malmstrom -
Report In Table Format in Email
Dear sir,
i want to send mail to user in format of report of issues in table Format in Body of mail.
Actully i want to send mail daily to user with Pending Issues of user.
HOD allote issue to user with Close target Date .Mail would be fire till tagget date >sysdate .
There can be Multiple issue with user.
so i want to create a list of All pending issue in report in table which are not Closed .
Report should be display with that column
eg. User 0010 has 3 Pending Issue
Issue No-----subject-----Create On-----Target Date
001---------ABC-------27-Mar-2011-------30-Jnn-2011
002--------BHN-------23-Jun-2011---------06-July-2011
003--------JHN--------05-Jun-2011---------02-July-2011
That Report Should be sent to User in mail.
My Code is
DECLARE
l_id number;
to_add varchar2(1000);
to_sub_by varchar2(1000);
from_add varchar2(1000);
l_body varchar2(4000):=:P33_DESCRIPTION;
l_sub varchar2(1000):=:P33_SUBJECT;
I_case varchar2(10):=:P33_CASE_ID;
I_isue_dte date:=:P33_SUBMITTED_ON;
l_regd varchar(100);
CURSOR C1 IS SELECT EMAIL_ID,(SELECT EMAIL_ID FROM USER_MAS WHERE USER_ID =:P33_SUBMITTED_BY_ID) AS D FROM USER_MAS WHERE USER_GR_ID=:P33_ASSIGNED_TO_GROUP_ID AND USER_ID NOT IN(:APP_USER);
BEGIN
if :P33_ASSIGNED_TO_GROUP_ID is not null then
open C1;
LOOP
FETCH C1 INTO to_add,to_sub_by;
EXIT WHEN C1%NOTFOUND;
select email_id,user_name into from_add,l_regd from user_mas where user_id=:app_user;
l_id:=APEX_MAIL.SEND(
p_to => to_add, -- change to your email address
P_cc => to_sub_by,
p_from => from_add,
p_body => 'Issue Information'||''||chr(13)||chr(10)||chr(13)||chr(10)||
'www.farhorizonindia.net:7777/crm'||''||chr(13)||
'Issue Title'||':'||l_sub||CHR(13)||chr(10)||
'Issue Number'||':'||I_case||CHR(13)||
'Issue Open Date'||':'||I_isue_dte||''||chr(13)||chr(10)||CHR(13)||chr(10)||
'Most Recent Comment'||':'||''||chr(13)||chr(10)||
l_body||chr(13)||chr(10)||''||CHR(13)||chr(10)||'Regards'||chr(13)||chr(10)||''||l_regd||CHR(13)||chr(10)||CHR(13)||chr(10)||'Please do not reply to this email.If you wish to update the call.please login to the issue Management.',
P_subj => I_case ||' Issue '||l_sub);
end loop;
close C1;
end if;
COMMIT;
apex_mail.push_queue(
P_SMTP_HOSTNAME => '102.111.0.9',
P_SMTP_PORTNO => 25);
commit;
END;How can i create that format in Body Of sending Email.
Thanks
Vedant
Edited by: Vedant on Jun 30, 2011 3:44 AM
Edited by: Vedant on Jul 5, 2011 9:17 PMLook at using an interactive reports and subscription routine..: http://st-curriculum.oracle.com/obe/db/apex/r40/apexirr/apexirrdev/apexirrdev_ll.htm
Death called while you were out, so I gave him your cell number.
Thank you,
Tony Miller
Webster, TX
Maybe you are looking for
-
How do I add pictures to my contacts on galaxy s5?
Can I add pictures to my contacts on my galaxy s5 from pictures I store in one drive?
-
LiveType .ipr won't import into FCP - File type not recognized
LiveType file is greyed out when trying to import into FCP as a Standard File type. If we change Standard File to All Files we get an error stating, "File Error: 1 file recognized, 0 access denied, 1 unknown." The project and media are on an external
-
Change price of Catalog item in S.Cart
We want to change the price of a Catalog item in the SRM shopping cart ....am on SRM5, SP06 ECS... Is this possible? I know MDM catalog items come into SRM as non editable /grayed out with a Price already chosen....but we want to change it and add a
-
Contacts- icloud sync + deleting duplicates?
I am ripping my hair out. I have lived with duplicate contacts on my iphone for years. Today I started to clear out the duplicates by hand. But as soon as I would delete one duplicate contact on my iphone, I would be brought back to the list of con
-
Recover datafile that has extended beyond OS limit?
We have a Linux server running Oracle 8.1.7 and we have a data file (users01.dbf) that had "autoextend" enabled and has now grown past the upper limit of the underlying filesystem. Oracle will not open the file, as the OS returns an error: "Linux Err