[JBoss Seam] - Re: is xhtml a good choice for Facelets templates?
by jcruise
I guess that a lot of us are using facelets as building blocks in componentized user interfaces. In my current application, only the top level templates could rightly be called xhtml files i.e. they look something like:
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:t="http://myfaces.apache.org/tomahawk"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:a="https://ajax4jsf.dev.java.net/ajax">
|
| <head>
| <title><ui:insert name="pageTitle">
| ... stuff ...
|
| </xhtml>
|
a lot of my other facelets look something like:
| <sl:gridPage xmlns:sl="http://mycompany.com/myapp" />
|
which is not really xhtml, whatever way you spin it. But I'm a pragmatic sort of person and am not that bothered about changing file extensions for the sake of it.
However, the "pondering facelets file extensions" thought process did lead me down another road which is sort of related. I got to wondering if I should actually move away from xml to specify facelets?
In particular, my application has a very data driven, modular ui that has a lot of dynamic view building and depends heavily on the <c:> tags for the view tree building logic. In my xhtml files this is transparently interspersed with the uicomponent's themselves and a liberal dose of jsf render-time logic, which is bloody confusing to read and maintain.
Apart from the top level templates there's not a lot of mixed content (which xml style markup handles gracefully).
I am beginning to wonder if a groovy based dsl wouldn't be much more concise and expressive for building complex facelets composition component's.
I want something that stays in the scripting domain, to avoid needing to redeploy during UI hacking.
Has anybody done anything like this?
Cheers
J
Oh, to stay on-topic with the original thread, I propose that these files should be known as Facelets User Composition Komponents, with an appropriate extension.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048576#4048576
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048576
18 years, 11 months
[JBoss Seam] - Seam Component Property Error (Weirdness)
by nathandennis
Jboss 4.0.5
seam 1.2 patch1
postgres
blah, blah, blah
i recently had what i believe to be a strange occurrence while writing a very simple app.
pay attention to destaddress property of Formmail...
| @Entity
| @Table(name = "formmail")
| @Name("formmail")
| public class Formmail implements Serializable {
|
| /**
| *
| */
| private static final long serialVersionUID = 1L;
| /**
| *
| */
|
| private String form;
| private String destaddress;
|
|
| @Id
| @NotNull
| @Length(max = 10)
| @Column(name="form")
| public String getForm() {
| return this.form;
| }
|
| public void setForm(String form) {
| this.form = form;
| }
|
| @Length(max = 80)
| @Column(name="destaddress")
| public String getDestAddress() {
| return this.destaddress;
| }
|
| public void setDestAddress(String destaddress) {
| this.destaddress = destaddress;
| }
|
| @Override
| public String toString()
| {
| return "Formmail(" + form + "," + destaddress + ")";
| }
| }
|
|
| ****************
|
| import javax.ejb.Local;
| @Local
| public interface FormmailSearch {
|
| public int getPageSize();
| public void setPageSize(int pageSize);
|
| public String getSearchString();
| public void setSearchString(String searchString);
|
| public String getSearchPattern();
|
| public void find();
| public void nextPage();
| public boolean isNextPageAvailable();
|
| public void destroy();
|
| }
|
|
|
|
|
|
|
| *********************
| //
| @Stateful
| @Name("formmailSearch")
| @Scope(ScopeType.SESSION)
| @Restrict("#{identity.loggedIn}")
| public class FormmailSearchAction implements FormmailSearch
| {
|
| @PersistenceContext
| private EntityManager em;
|
|
| private String searchString;
| private int pageSize = 10;
| private int page;
|
| @DataModel
| private List<Formmail> formmails;
|
| public void find()
| {
| page = 0;
| queryFormmails();
| }
| public void nextPage()
| {
| page++;
| queryFormmails();
| }
|
| @SuppressWarnings("unchecked")
| private void queryFormmails()
| {
| formmails = em.createQuery("select f from Formmail f where lower(f.form) like #{pattern}")
| .setMaxResults(pageSize)
| .setFirstResult( page * pageSize )
| .getResultList();
| }
|
|
| public boolean isNextPageAvailable()
| {
| return formmails!=null && formmails.size()==pageSize;
| }
|
| public int getPageSize() {
| return pageSize;
| }
|
| public void setPageSize(int pageSize) {
| this.pageSize = pageSize;
| }
|
| @Factory(value="pattern", scope=ScopeType.EVENT)
| public String getSearchPattern()
| {
| return searchString==null ?
| "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%';
| }
|
| public String getSearchString()
| {
| return searchString;
| }
|
| public void setSearchString(String searchString)
| {
| this.searchString = searchString;
| }
|
| @Destroy @Remove
| public void destroy() {}
|
|
| ****************
| <a:outputPanel id="searchResults">
| <div class="section">
| <h:outputText value="No Entrys Like That Found" rendered="#{formmails != null and formmails.rowCount==0}"/>
|
| <h:dataTable id="formmails" value="#{formmails}" var="mail" rendered="#{formmails.rowCount>0}">
|
| <h:column>
| <f:facet name="header">Form:</f:facet>
| #{mail.form}
| </h:column>
|
| <h:column>
| <f:facet name="header">Destination Address</f:facet>
| #{mail.destaddress}
| </h:column>
|
| <h:column>
| <s:link id="viewFormmail" value="View Record" action="#{formmailPersist.selectFormmail(mail)}"/>
| </h:column>
| </h:dataTable>
|
|
| <s:link value="More results" action="#{formmailSearch.nextPage}" rendered="#{formmailSearch.nextPageAvailable}"/>
| </div>
| </a:outputPanel>
|
| *******************
|
this gave me a error
Exception during request processing: javax.servlet.ServletException: /FormmailList.xhtml: Bean: com.foo.Formmail, property: destaddress
......
after banging my head against the table for a while,, i figured out that Seam had changed the property name from destaddress to destAddress.
WHY??
I went back and change the name of the column in my db,, then alter my code a little... none of the weird junk,,, just with destaddress-->destAddress.
explanation anyone???
what don't i understand??
i mean randomly mapping characters in a variable name string to upper case makes the mapping a little difficult if you catch my drift.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048575#4048575
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048575
18 years, 11 months
[Beginners Corner] - Problem Retrieving the ConnectionPoolDetails
by supu
Hi,
Can anyone help me with this issue.
I have created a JCA connector and deployed in JBoss Server. Connector is deployed as Mbeans . For the deployed connector I tried retrieving all the connector related attributes like min pool size , max pool size etc which was given at the time of creating the connector using the code
JCAStats jcaStats = getJCAStats(name); // The method getJCAStats() is pasted below.
JCAConnectionPoolStats[] connPools = jcaStats.getConnectionPools();
JCAConnectionPoolStats connPoolStats;
for (int i = 0; i < connPools.length; i++) {
connPoolStats = connPools(i) ;
}
Using this connPoolStats variable I tried to retrieve the values of minimum and maximum pool size using the two methods given below . The issue is that I am getting the Maximum pool size correctly but the value of Minimum pool size is always zero. Why is this methods not picking the correct value of lower bound if it could pick the value upper bound correctly. I have checked the JMX console for the deployed connector Mbean and there the values of Minimum and maximum pool size are shown correctly
maxPoolSize = connPoolStats.getPoolSize().getUpperBound();
minPoolSize = connPoolStats.getPoolSize().getLowerBound();
******** Method getJCAStas*********
public JCAStats getJCAStats(String jndiName){
JCAStats jcaStats = null;
try{
Management mejb = getMEJB();
ObjectName filterNames = getResourceManagerFilter(jndiName);
Set mbeanNames = mejb.queryNames(filterNames, null);
Iterator it = mbeanNames.iterator();
while (it.hasNext()) {
// Get List of ResourceAdapters on the server
ObjectName name = (ObjectName) it.next();
String jcaResource = name.getKeyProperty("JCAResource");
ObjectName jcaFilter = getJCAFilter(jcaResource);
Set mbeanSet = mejb.queryNames(jcaFilter, null);
Iterator iter = mbeanSet.iterator();
while (iter.hasNext()) {
ObjectName jcaObj = (ObjectName)iter.next();
jcaStats = (JCAStats)mejb.getAttribute(jcaObj, "stats");
}
}
}catch(Exception ex){
ex.printStackTrace();
}
return jcaStats;
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048574#4048574
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048574
18 years, 11 months