aspose file tools*
The moose likes JSF and the fly likes I need a colspan Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "I need a colspan" Watch "I need a colspan" New topic
Author

I need a colspan

Raphael Germano Boschiero
Greenhorn

Joined: Dec 29, 2005
Posts: 22
hi friends , i need somenthing similar to colspan in PanelGrid ....

Thanks

Raphael Germano Boschiero
raphaelboschiero@gmail.com
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Not gonna happen. That attribute is not supported in any JSF components since you don't actually specify any individual TD or TR elements.


GenRocket - Experts at Building Test Data
Raphael Germano Boschiero
Greenhorn

Joined: Dec 29, 2005
Posts: 22
thankļæ½s

Raphael
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Yea, don't you just love how everything in JSF if their way or the highway? There are better frameworks out there.
David Hergert
Greenhorn

Joined: Jan 21, 2006
Posts: 4
Originally posted by Gregg Bolinger:
Yea, don't you just love how everything in JSF if their way or the highway? There are better frameworks out there.

What else do you suggest? From your blog it looks like you are an advocate of JSF.

Isn't it a possibility to extending something to get that functionality. Either by extending some component or extending a renderer or something? I am sure its possible and not entirely difficult. I am still new at this, but from the looks of it, alot is possible.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

I appreciated JSF a lot more when I was learning it. Now that the newness (buzz) has worn off, I see it's faults. Not that nothing is flawless. Don't get me wrong. I don't think anything is "perfect". I just think that since JSF there have been some better and improved frameworks come about. Maybe even due to JSF.

Web layout design is a VERY important factor in web frameworks. JSF seemed to ignore this. That is the major issue. Yes, there are workarounds so any suggestions you want to make are sure to be appreciated by the original poster.
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
Gentlemen stop whining and give the gentleman his answer will ya.

The following jsf uses panels and classes to set column widths as requested>

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>Example to JSF column width</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
.colStyle1 { width: 360px;
background: red;
}
.colStyle2 { width: 260px;
background: green;
}
.colStyle3 { width: 160px;
background: blue;
}
</style>

</head>

<body>
<f:view>

<h anelGrid columns="3" columnClasses="colStyle1,colStyle2,colStyle3">
<h anelGroup>
<h utputText value="TEST1"></h utputText>
<h:inputText></h:inputText>
</h anelGroup>
<h utputText value="TEST2"></h utputText>
<h utputText value="TEST3"></h utputText>
<h utputText value="TEST4"></h utputText>
<h utputText value="TEST5"></h utputText>
<h utputText value="TEST6"></h utputText>
</h anelGrid>
</f:view>
</body>
</html>

creating the following output>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


<title>Example to JSF column width</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
.colStyle1 { width: 360px;
background: red;
}
.colStyle2 { width: 260px;
background: green;
}
.colStyle3 { width: 160px;
background: blue;
}
</style>

</head>

<body>
<table>
<tbody>
<tr>
<td class="colStyle1">TEST1<input type="text" name="_id3" /></td>
<td class="colStyle2">TEST2</td>
<td class="colStyle3">TEST3</td>
</tr>
<tr>
<td class="colStyle1">TEST4</td>
<td class="colStyle2">TEST5</td>
<td class="colStyle3">TEST6</td>
</tr>
</tbody>
</table>


</body>
</html>

Now that wasn't that hard was it!
[ January 21, 2006: Message edited by: Gerardo Tasistro ]
Jim Tough
Greenhorn

Joined: Nov 21, 2009
Posts: 3
Gerardo Tasistro wrote:Gentlemen stop whining and give the gentleman his answer will ya.


I agree. The short answer was: <h:panelGroup>. Thanks Gerardo.


Jim Tough - SCJP, SCWCD
Akaine Harga
Ranch Hand

Joined: Nov 03, 2009
Posts: 84

Gregg Bolinger wrote:I appreciated JSF a lot more when I was learning it. Now that the newness (buzz) has worn off, I see it's faults. Not that nothing is flawless. Don't get me wrong. I don't think anything is "perfect". I just think that since JSF there have been some better and improved frameworks come about. Maybe even due to JSF.

Web layout design is a VERY important factor in web frameworks. JSF seemed to ignore this. That is the major issue. Yes, there are workarounds so any suggestions you want to make are sure to be appreciated by the original poster.

Like there were other better alternatives... Struts2? Don't make me laugh... Maybe as an MVC framework itself it's ok but the extensions suck ash compared to MyFaces based series, Rich/Prime Faces, Seam, etc.

These days the major fault of each and every one of the frameworks out there (including JSF) is lack of advanced documentation, books included. You wanna do something just a bit more complicated than a HelloWorld app explained 1000 times in every book and tutorial - enjoy the hours and days of lonely and almost blind experiments (for ex. RichFaces AJAX API). Those who spend some time on dev forums know - more than 80% of all questions related to frameworks are caused by lack of documentation (not talking about the laziness case =)).


Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
willCodeForFood("Java,PHP,C#,XML,VBS,XHTML,CSS,JavaScript,SQL"); //always looking for job opportunities in AU/NZ/US/CA/Europe :P
vladimir dimitrov
Greenhorn

Joined: Apr 20, 2010
Posts: 1
Raphael Germano Boschiero wrote:hi friends , i need somenthing similar to colspan in PanelGrid ....

Thanks

Raphael Germano Boschiero
raphaelboschiero@gmail.com


Hi,

I realize it's been some time since this thread was created, but I'm going to reply in case someone googles his way to this thread.

I know only one way to sort of span columns, and that is by using the header/footer facet.
The problem is, that for example the footer facet spans all columns.

Here's a link with an example:
http://www.exadel.com/tutorial/jsf/jsftags-guide.html#panel

Hope this helps.

Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Welcome to the JavaRanch, Vladimir.

Actually, it's best to just let old threads like. We call this "waking the zombies", and one reason why we prefer that people just start new threads is that a lot of the information in them is obsolete. Even if you update the main topic, the side topics might not be correct any more. So actually, you may have just pushed some stale info back up into Google's view.

Over the last few years a number of discussions on "colspan" and its lack in JSF have been made. Someone actually did do a version of a colspannable grid control. I think Tomahawk may support this now, too. RichFaces has support in a specialized way. Otherwise, I've just learned to nest grid controls.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jeff Do
Greenhorn

Joined: Jul 22, 2009
Posts: 1

I found that the Towahawk library has extended panelGrid and panelGroup so that you can just go:

<t:panelGrid cols="3">
<hutputText value="Test1" />
<hutputText value="Test2" />
<hutputText value="Test3" />
<t:panelGroup colspan="3" >
<hutputText value="Test4" />
</t:panelGroup>
<hutputText value="Test5" />
</t:panelGrid>

Works like a charm
Sharan Rajendran
Greenhorn

Joined: Feb 01, 2013
Posts: 1
Something like this will work.


<style type="text/css">

.columnLabel {
width: 200px;
}
</style>

<h:panelGrid columns="2" columnClasses="columnLabel">
<hutputText value="#{msgs.labelAccountNo}"/>
<hutputText value="#{action.accountNo}"/>
<hutputText value="#{msgs.textUserName}"/>
<hutputText value="#{action.name}"/>
</h:panelGrid>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I need a colspan