[JBoss Seam] - Newbie conversation question
by UTDrew
I'm having a hard time getting seam to start conversations when I want it to. I have a series of pages that go with a type of task. Using facelets I've created a special navigation bar for each task. This bar has a series of links that can be clicked on at any time that the user is working with that type of task. A couple of the links open 'wizards' for creating new things. What I would like to have happen is that every time a user clicks one of these links a new conversation is started and the first page of the wizard opens. I've tried this a couple of different ways and haven't had much luck
Here is my stateful wizard bean
| @Stateful
| @Name("feeProductWizard")
| public class FeeProductWizardBean implements FeeProductWizard {
|
| @Logger private Log log;
|
| @Out
| private FeeProduct feeProduct;
|
| @In
| private FacesMessages facesMessages;
|
| @In
| private FeeConfiguratonHandler feesConfigBean;
|
| @In(create=true)
| private FeeSearcher feeSearcher;
|
| @Resource(mappedName="java:/FeeEntityManager")
| private EntityManager em;
| /** Whether the product is valid or not */
| private boolean feeProductValid;
| /** The set of default assessment notes */
| private Hashtable<Integer,String> defaultAssessmentNotes;
|
| @SuppressWarnings("unchecked")
| @Create
| public void init() {
| defaultAssessmentNotes = feesConfigBean.getDefaultNotes();
| log.info("default assessment notes = " + defaultAssessmentNotes);
| }
|
| /**
| * @see com.emida.intranet.fees.wizard.NewWizard#startNewWizard()
| */
| @Begin
| public void startNewWizard() {
| log.info("Starting new fee product wizard");
| feeProduct = new FeeProduct();
| }
|
| /**
| * @see com.emida.intranet.fees.wizard.NewWizard#back()
| */
| public void back() {
| }
|
| /**
| * @see com.emida.intranet.fees.wizard.NewWizard#next()
| */
| public void next() {
| log.info("next called : " + feeProduct);
| }
|
| /**
| * @see com.emida.intranet.fees.wizard.FeeProductWizard#validateDates()
| */
| public void validateDates() {
| log.info("validating dates");
| if(feeProduct.getEndDate() != null) {
| if(feeProduct.getStartDate().compareTo(feeProduct.getEndDate()) >= 0) {
| log.debug("end date is after start date");
| facesMessages.addToControl("endDate", "#{messages.endDateError}");
| feeProductValid = false;
| }else {
| feeProductValid=true;
| }
| }else {
| feeProductValid=true;
| }
| }
|
| /**
| * @see com.emida.intranet.fees.wizard.FeeProductWizard#isFeeProductValid()
| */
| public boolean isFeeProductValid() {
| return feeProductValid;
| }
|
| /**
| * @see com.emida.intranet.fees.wizard.NewWizard#cancel()
| */
| @End
| public void cancel() {
| }
|
| /**
| * @see com.emida.intranet.fees.wizard.NewWizard#destroy()
| */
| @Remove
| @Destroy
| public void destroy() {
| }
|
| /**
| * @see com.emida.intranet.fees.wizard.NewWizard#saveNew()
| */
| @End
| public void saveNew() {
| em.persist(feeProduct);
| }
|
| /**
| * @see com.emida.intranet.fees.wizard.FeeProductWizard#setupDefaultNote()
| */
| public void setupDefaultNote() {
| FeeProductSearchConfig config = new FeeProductSearchConfig();
| config.setFeeName(feeProduct.getFeeName());
| if(feeSearcher.doFeeProductSearch(config).size() != 0) {
| log.debug("fee name has been taken");
| facesMessages.addToControl("feeName", "#{messages.feeNameError}");
| feeProductValid = false;
| }else {
| feeProductValid=true;
| }
| feeProduct.setFeeAssessmentNote(defaultAssessmentNotes.get(feeProduct.getFeeCriteriaType().ordinal()));
| }
| }
|
|
This is the facelets fragment for the navigation bar
| ?xml version="1.0" encoding="ISO-8859-1" ?>
|
| <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
| 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:c="http://java.sun.com/jstl/core"
| xmlns:a4j="http://richfaces.org/a4j"
| xmlns:rich="http://richfaces.org/rich"
| xmlns:intra="http://www.emida.net/intranet"
| xmlns:s="http://jboss.com/products/seam/taglib"
| version="2.0">
|
| <ui:composition>
| <f:loadBundle var="feesNav" basename="fees.GeneralFeeMessages" />
| <rich:panel>
|
| <table class="sidebar">
| <tr>
| <td> <font size="-2">
| <h:form id="navForm">
| <h:panelGrid columns="1" cellpadding="2" cellspacing="2">
| <f:facet name="header">
| <h:outputText value="#{feesNav.feesHeader}"/>
| </f:facet>
| <h:outputText styleClass="sectionHeader" value="#{feesNav.manageFeeAgreements}"/>
| <h:outputLink value="/intranet/fees/feeAgreement/search.seam">
| <h:outputText value="[#{feesNav.searchFeeAgreements}]" />
| </h:outputLink>
| <h:commandLink id="newFeeAgreement" value="[#{feesNav.createNewFeeAgreement}]"
| action="#{feeAgreementWizard.startNewWizard}" />
| <h:outputText styleClass="sectionHeader" value="#{feesNav.manageFeeProducts}"/>
| <h:outputLink value="/intranet/fees/feeProduct/search.seam">
| <h:outputText value="[#{feesNav.searchFeeProducts}]" />
| </h:outputLink>
| <h:commandLink id="newFeeProduct" value="[#{feesNav.createNewFeeProduct}]"
| action="#{feeProductWizard.startNewWizard}" />
| <h:outputText styleClass="sectionHeader" value="#{feesNav.misc}"/>
| <h:outputLink value="/intranet/fees/approveFees.seam">
| <h:outputText value="[#{feesNav.approveFees}]" />
| </h:outputLink>
| </h:panelGrid>
| </h:form>
| </font>
| </td>
| </tr>
| </table>
| </rich:panel>
| </ui:composition>
| </jsp:root>
|
I first tried using the s:link tag to start the wizard but for some reason I had to click the link twice before it would call the action method. The code for that was:
| <s:link id="newFeeProduct" value="[#{feesNav.createNewFeeProduct}]"
| action="#{feeProductWizard.startNewWizard()}" propogation="begin" />
|
Here is the navigation rule from the pages.xml file.
| <page view-id="/fees/*">
| <navigation from-action="#{feeProductWizard.startNewWizard}">
| <redirect view-id="/fees/feeProduct/wizard/step1.xhtml" />
| </navigation>
| </page>
|
In the application's current state, I can only click on the link once. The wizard is started within the current conversation but it won't start a new conversation and if I attempt to click the link again it tells me the conversation has already been started. Everything else works beautifully though.
Seam 2.0.0 GA
Facelets
JBoss 4.2.2 GA
Thanks in advance for your help.
Drew
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117146#4117146
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117146
18 years, 3 months
[JCA/JBoss] - Resource Adapter javax.naming.NamingException
by pecks1976
Using JBoss 4.0.0, Java ee sdk 5.03.
I'm trying to write a resource adapter, with the intention of being able to call some native (C++) code from a EJB.
The EJB is in it's own project, and appears to be quite happy. I am using XDoclet, and so have included the following tags:
| * @ejb.resource-ref res-ref-name="eis/MySample"
| * res-type="com.riskaware.iwmdt.SampleConnectionFactory"
| * res-auth="Container"
| *
| * @jboss.resource-ref
| * res-ref-name="eis/MySample"
| * jndi-name="eis/ConnectorProj"
|
This sorts out the ejb-jar.xml and the jboss.xml files for this project:
ejb-jar.xml:
| <resource-ref id="ResRef_1">
| <res-ref-name>eis/MySample</res-ref-name>
| <res-type>com.riskaware.iwmdt.SampleConnectionFactory</res-type>
| <res-auth>Container</res-auth>
| </resource-ref>
|
jboss.xml:
| <resource-ref>
| <res-ref-name>eis/MySample</res-ref-name>
| <jndi-name>eis/ConnectorProj</jndi-name>
| </resource-ref>
|
Now, when the EJB tries to do a lookup:
| ctx = new InitialContext();
|
| ///////////////////////////////////////////////////////////
| NamingEnumeration ne = ctx.list("java:comp/env/eis");
| while(ne.hasMoreElements()){
| System.out.println(ne.nextElement());
| }
| ////////////////////////////////////////////////////////////
|
| ctx.lookup("java:/comp/env/eis/MySample");
|
I get the following:
16:06:24,685 INFO [STDOUT] MySample: javax.naming.LinkRef
16:06:24,685 INFO [STDOUT] javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: eis not bound]
16:06:24,685 INFO [STDOUT] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:971)
16:06:24,685 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:614)
16:06:24,685 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:643)
16:06:24,685 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:508)
Now, in my resource adapter project, I have a ra.xml file that looks like this:
| <?xml version="1.0" encoding="UTF-8"?>
| <connector id="Connector_ID" version="1.5"
| xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd">
| <description></description>
| <display-name>ConnectorProj</display-name>
| <vendor-name>RiskAware</vendor-name>
| <eis-type>GDF</eis-type>
| <resourceadapter-version>0.1</resourceadapter-version>
| <resourceadapter>
| <resourceadapter-class>
| com.riskaware.iwmdt.SampleResourceAdapter
| </resourceadapter-class>
| <outbound-resourceadapter>
| <connection-definition>
| <managedconnectionfactory-class>com.riskaware.iwmdt.SampleManagedConnectionFactory</managedconnectionfactory-class>
| <connectionfactory-interface>com.riskaware.iwmdt.SampleConnectionFactory</connectionfactory-interface>
| <connectionfactory-impl-class>com.riskaware.iwmdt.SampleConnectionFactory</connectionfactory-impl-class>
| <connection-interface>com.riskaware.iwmdt.SampleConnection</connection-interface>
| <connection-impl-class>com.riskaware.iwmdt.SampleConnection</connection-impl-class>
| </connection-definition><transaction-support>NoTransaction</transaction-support><reauthentication-support>false</reauthentication-support>
| </outbound-resourceadapter>
| </resourceadapter>
| </connector>
|
But, I don't have a .ds file. Do I need one of these to specify the jndi name for the RA? Or is there another problem here?
Thanks,
Pecks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117144#4117144
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117144
18 years, 3 months