[JBoss Seam] - Navigate to anchor?
by whafrog
I have a series of h:dataTables, each of which can have rows added to or removed from them. To add or remove the rows I use an h:commandButton to call a method on the action class, which adds or removes the entity from the underlying list. As the page is rather long, when the page returns, I'd like to navigate to the dataTable where the row was added or removed. Example:
| <ui:define name="content">
| <h:form>
| <a name="DataTable1"/>
| <h:dataTable value="#{entityTypeLists.getEntityType('EntityType1')}" var="entity">
| <h:column>
| <h:inputText value="#{entity.name}"/>
| <f:facet name="footer"> </f:facet>
| </h:column>
| <h:column>
| <h:commandButton type="submit" value="-" action="#{entityManager.remove('EntityType1', entity)}"/>
| <f:facet name="footer">
| <h:commandButton type="submit" value="+" action="#{entityManager.add('EntityType1')}"/>
| </f:facet>
| </h:column>
| </h:dataTable>
| <a name="DataTable2"/>
| <h:dataTable value="#{entityTypeLists.getEntityType('EntityType2')}" var="entity">
| <h:column>
| <h:inputText value="#{entity.name}"/>
| <f:facet name="footer"> </f:facet>
| </h:column>
| <h:column>
| <h:commandButton type="submit" value="-" action="#{entityManager.remove('EntityType2', entity)}"/>
| <f:facet name="footer">
| <h:commandButton type="submit" value="+" action="#{entityManager.add('EntityType2')}"/>
| </f:facet>
| </h:column>
| </h:dataTable>
| <!-- and on and on -->
| </h:form>
| </ui:define>
|
The action class code:
| public String add(String entityTypeName) {
| // ... add to list
| return "entityEditPage";
| }
| public String remove(String entityTypeName, Entity entity) {
| // ... remove from list
| return "entityEditPage";
| }
|
Now, how can I navigate back to the anchor for, say, "DataTable2"?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112085#4112085
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4112085
18 years, 4 months
[JNDI/Naming/Network] - Newbie EJB3 JNDI/ENC question
by DeanoUK
Hi all.
(Actually posted this in EJB3 but on reflection think it's more apt in this sub-forum).
I'm still confused as to how I should properly use EJB injection within another EJB.
Say I have an EJB called MyBean. Within it I define the JNDI mapping to be:
@LocalBinding(jndiBinding="ejb/MyBean/local")
Within another EJB I grab it using:
| @EJB(name = "ejb/MyBean", beanInterface = MyBeanLocal.class)
Now currently, I then look it up using
InitialContext ctx = new InitialContext();
| MyBeanLocal myBeanLocal = (MyBeanLocal ) ctx.lookup("java:comp/env/ejb/MyBean");
In EJB3, what is the best way of actually injecting a bean into the local JNDI and referencing it, ensuring application server portability?
I'm still very unsure I'm not going way over the top by ensuring it's injected into the local JNDI from the ENC and then looked up in the local JNDI.
Any direction would be most helpful, thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112079#4112079
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4112079
18 years, 4 months