[JBoss Seam] - Using the EntityHome and problems therein
by sjmenden
I am creating a Help Ticketing system and I am following the SEAM documenation and making use of the EntityHome for CRUDing my Ticket Entity. The initial creation and updating works great, however when I go to view tickets, then click on a ticket which gets redirected back to my original ticket.xhtml page, with ticketId as a parameter, I can not for the life of me get the ticket to display.
I need another pair of eyes to see where I am going wrong.
ticket.xhtml
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| template="template.xhtml">
|
| <ui:define name="content">
|
| <h1 class="center">
| <h:outputText rendered="#{!ticketHome.managed}" value="Create Ticket"/>
| <h:outputText rendered="#{ticketHome.managed}" value="Edit Ticket"/>
| </h1>
|
| <h:messages globalOnly="true" styleClass="message"/>
|
| <h:form id="createTicket">
| <f:facet name="beforeInvalidField">
| <s:message/>
| </f:facet>
| <f:facet name="afterInvalidField">
| <h:graphicImage src="img/error.gif"/>
| </f:facet>
| <f:facet name="aroundInvalidField">
| <s:span styleClass="errors"/>
| </f:facet>
|
| <s:validateAll>
|
| <table class="form-center">
|
| <tr>
| <td colspan="2" align="center" class="table-heading">Contact Information</td>
| </tr>
| <tr>
| <td class="name">Name</td>
| <td align="right">
| <s:decorate>
| <h:inputText id="name" required="true" value="#{ticketHome.instance.name}"/>
| </s:decorate>
| </td>
| </tr>
| <tr>
| <td>
| <span class="name">Problem Description</span>
| </td>
| <td align="right">
| <s:decorate>
| <h:inputTextarea id="problemDescription" required="true" cols="50" rows="20" value="#{ticketHome.instance.problemDescription}"/>
| </s:decorate>
| </td>
| </tr>
|
| <tr>
| <td></td>
| <td align="right">
| <h:commandButton value="Create Ticket" action="#{ticketHome.persist}" rendered="#{!ticketHome.managed}"/>
| <h:commandButton value="Update Ticket" action="#{ticketHome.update}" rendered="#{ticketHome.managed}"/>
| <h:commandButton value="Delete Ticket" action="#{ticketHome.remove}" rendered="#{ticketHome.managed}"/>
| <s:link id="done" value="Done" linkStyle="button" propagation="end" view="/viewTickets.xhtml"/>
| </td>
| </tr>
|
| </table>
| </s:validateAll>
| </h:form>
|
| </ui:define>
| </ui:composition>
|
Ticket.java
| @Entity
| @Name("ticket")
| @Role(name="tempTicket", scope=ScopeType.EVENT)
| @Table(name="tickets")
| public class Ticket implements Serializable {
|
| //seam-gen attributes (you should probably edit these)
| private int id;
| private Integer version;
| private String name;
|
|
| @Id @GeneratedValue
| public int getId() {
| return id;
| }
|
| public void setId(int id) {
| this.id = id;
| }
|
| @Version
| public Integer getVersion() {
| return version;
| }
|
| private void setVersion(Integer version) {
| this.version = version;
| }
|
| @NotNull
| @Column(length=50)
| @Length(max=50)
| public String getName() {
| return name;
| }
|
| @Lob
| public String getProblemDescription() {
| return problemDescription;
| }
|
| public void setProblemDescription(String problemDescription) {
| this.problemDescription = problemDescription;
| }
|
| }
|
|
viewTickets.xhtml
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:a="https://ajax4jsf.dev.java.net/ajax"
| template="template.xhtml">
|
| <!-- content -->
| <ui:define name="content">
| <div class="center">
| <h1>Tickets</h1>
| </div>
|
| <!-- Display the form for searching for tickets-->
| <s:validateAll>
| <table cellspacing="1" cellpadding="1" border="0" class="form-center">
| <tr>
| <td>
| Subject:
| </td>
| <td>
| <h:inputText value="#{tempTicket.subject}"/>
| </td>
| </tr>
|
| <tr>
| <td> </td>
| <td align="right">
| <h:commandButton value="Search" action="#{viewTickets.view}" styleClass="button" />
| </td>
| </tr>
| </table>
| </s:validateAll>
| <br />
| <br />
|
| <!-- ***************************************************************** -->
| <!-- Data Table of Tickets -->
| <!-- ***************************************************************** -->
| <h:dataTable value="#{tickets}"
| var="ticket"
| rendered="#{tickets.rowCount > 0}"
| styleClass="fiapps-table">
|
| <!-- Ticket Number -->
| <h:column>
| <f:facet name="header">
| <h:commandLink value="Ticket #" action="#{viewTickets.reorder}">
| <f:param name="orderBy" value="id"/>
| </h:commandLink>
| </f:facet>
| <s:link id="ticket" value="#{ticket.id}" view="/ticket.xhtml">
| <f:param name="ticketId" value="#{ticket.id}"/>
| </s:link>
| </h:column>
|
| <!-- Subject -->
| <h:column>
| <f:facet name="header">
| <h:commandLink value="Subject" action="#{viewTickets.reorder}">
| <f:param name="orderBy" value="subject"/>
| </h:commandLink>
| </f:facet>
| <h:outputText value="#{ticket.subject}" />
| </h:column>
|
| </h:dataTable>
| <br />
| <h:messages/>
| <br />
| <div class="center">
| <h:commandButton rendered="#{tickets.rowCount > 0}"
| type="submit"
| value="Refresh"
| action="#{viewTickets.findFirstPage}" />
| <h:commandButton action="#{viewTickets.findPreviousPage}"
| value="Previous Page"
| disabled="#{!viewTickets.previousPage}"
| rendered="#{tickets.rowCount > 0}"/>
| <h:commandButton action="#{viewTickets.findNextPage}"
| value="Next Page"
| disabled="#{!viewTickets.nextPage}"
| rendered="#{tickets.rowCount > 0}"/>
| </div>
| </h:form>
| <br />
| </ui:define>
|
| </ui:composition>
|
|
when I click on the Ticket Number I get in the url bar: http://localhost:8080/fiapps/ticket.seam?ticketId=1&dataModelSelection=ti...
so I know the ticketId is getting passed. But the ticket is not getting loaded. Here are some additional classes.
TicketHome.java
| @Name("ticketHome")
| public class TicketHome extends EntityHome<Ticket> {
|
|
| @Factory("ticket")
| public Ticket initPerson() {
| return getInstance();
| }
|
| protected Ticket createInstance() {
| Ticket ticket = new Ticket();
| return ticket;
| }
|
| public String getCreatedMessage() { return "New Ticket (#{ticket.subject}) created"; }
| public String getUpdatedMessage() { return "Ticket (#{ticket.subject}) updated"; }
| public String getDeletedMessage() { return "Ticket (#{ticket.subject}) deleted"; }
| }
|
ViewTicketsBean.java - the relevant part
| @Name("viewTickets")
| @Stateful
| @Scope(ScopeType.CONVERSATION)
| public class ViewTicketsBean implements ViewTickets {
|
| @In(create=false, value="tempTicket") @Out(value="tempTicket")
| private Ticket tempTicket;
|
| @Logger
| private Log log;
|
| @DataModel
| private List<Ticket> tickets;
|
| @DataModelSelection
| private Ticket ticket;
|
| @In(create=true)
| private EntityManager entityManager;
|
| ...
|
Any help would be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986663#3986663
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986663
19Â years, 7Â months
[Installation, Configuration & Deployment] - EARDeployer not finding *.jar(s) during startup.
by chrisodom
I am currently using the JBoss IDE 2 Beta which currently I have only out-of-memory problems with which easily solvable. I am publishing an EAR file to my local instance of JBoss4.0.5GA in /server/default/deploy. the EAR currently only contains a war and jar archives. The war uses the jar's classes (a common utilities jar) but upon startup this is all I see:
13:37:16,256 INFO [EARDeployer] Init J2EE application: file:/C:/Java/jboss-4.0.5.GA/server/default/deploy/DataPipe.ear
| 13:37:17,084 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../tmp/deploy/tmp30017DataPipe.ear-contents/datapipe-web-exp.war/
| 13:37:17,225 INFO [EARDeployer] Started J2EE application: file:/C:/Java/jboss-4.0.5.GA/server/default/deploy/DataPipe.ear
so basically the only thing getting deployed is the war file not the jar or I would think I would see the subdeployer JARDeployer running. Upon use of the web application the servler importing the common classes causes this to happen:
13:37:56,959 ERROR [[DataPipeServlet]] Allocate exception for servlet DataPipeServlet
| java.lang.NoClassDefFoundError: com/newsstand/common/exception/InvalidContentTypeException
| at java.lang.Class.getDeclaredConstructors0(Native Method)
| at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
| at java.lang.Class.getConstructor0(Class.java:2671)
| at java.lang.Class.newInstance0(Class.java:321)
| at java.lang.Class.newInstance(Class.java:303)
| at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1055)
| at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:757)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:130)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
I have tried placing the Utility jar in both the root /lib folder and the default server /lib folder but the Web application stills throughs this error. I have not been able to successfully bet my Web Application to see any classes outside of its current ClassLoader. Any help would be deeply appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986656#3986656
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986656
19Â years, 7Â months