[JBoss Seam] - h:dataTable, h:selectOneMenu and s:selectItems problem
by daniel.zmuda
Hi,
for about 1 week I'm trying to find the solution to what I'm doing. So :
I'm using:
Jboss AS 4.2.1
Jboss Seam 2.0.0 CR1
I want to have selectOneMenu in each row of dataTable to have opportunity to change the subgroup category of each products.
The problem is in that, when I'm submitting the form NPE is thrown and it looks like the selectOneMenu value is not setted. I was also trying to change the adnotation in at sungroup to @DataModelSelection and in some way it works, but it always chooses the first value.
My files:
products.xhtml
| <h:dataTable value="#{products}" var="product" rendered="#{products.size >0}">
| <h:column >
| <f:facet name="header">Change subgroup</f:facet>
| <h:form>
| <h:selectOneMenu value="#{GroupsAction.newSubgroup}" >
| <s:convertEntity />
| <s:selectItems value="#{subs}" var="sub" label="#{sub.name}" noSelectionLabel="Select subgroup"/>
| </h:selectOneMenu>
| <h:commandButton action="#{GroupsAction.changeSubgroup(product)}" value="Change"/>
| </h:form>
| </h:column>
| </h:dataTable>
|
GroupsAction.java
|
| @Stateful
| @Name ("GroupsAction")
| @Scope(SESSION)
| public class GroupsAction implements Groups{
|
| ...
|
| //@DataModelSelection(value="subs")
| private Podgrupy newSubgroup;
|
|
| @PersistenceContext(type=PersistenceContextType.EXTENDED)
| private EntityManager em;
|
|
| @DataModel
| private List <Materia> products;
|
| @DataModel
| private List <Podgrupy> subs ;
|
| @Factory("subs")
| @Begin(join=true)
| public void findSubs(){
| subs = em.createQuery("select pg from Podgrupy pg order by pg.grupy.idgrupy").getResultList();
| }
|
| @Begin(join=true)
| public String changeSubgroup(Materia m){
| System.out.println(newSubgroup.getNazwapodgrupy());
| m.setPodgrupy(newSubgroup);
| em.merge(m);
| em.flush();
| return "products";
| }
|
| @Remove @Destroy
| public void destroy() {}
|
| public List<Podgrupy> getSubs() {
| return subs;
| }
|
| public void setSubs(List<Podgrupy> subs) {
| this.subs = subs;
| }
|
| public Podgrupy getNewSubgroup() {
| return newSubgroup;
| }
|
| public void setNewSubgroup(Podgrupy newSubgroup) {
| this.newSubgroup = newSubgroup;
| }
|
| ...
| }
|
|
I have read I think all topics at forum which are connected with that problem, but I didnt find solution.So anyone have any idea why it dont want to work ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088726#4088726
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088726
18 years, 7 months
[JBoss Seam] - cannot access method using seam and ejb3
by margas
Hi,
I have a sample application (seam-ejb3-richfaces).
In one page i want to use <rich:tabPanel> and a valueChangeListener so that to get events when i change tabs.
It seems that the valueChangeListener fires the events but when it tries to execute the method i get the following warning.
WARN [lifecycle] /projecttype.xhtml @73,90 valueChangeListener="#{projecttype.changeTab}": Method not found: TProjecttypeAction:a00a-2idpbn-f71lr7w3-1-f71ls2aq-a.changeTab()
I post some code that can help :
Interface
@Local
| public interface TProjecttypeInt {
|
|
| String changeTab(ValueChangeEvent evtHandle);
Session Bean
@Stateful
| @Name("projecttype")
| @Scope (SESSION)
| @Restrict("#{identity.loggedIn}")
| public class TProjecttypeAction extends Search implements TProjecttypeInt{
|
| public String changeTab(ValueChangeEvent evtHandle){
| if (!evtHandle.getOldValue().toString().trim().equalsIgnoreCase("edit")){
| if (currentPknId !=null && !currentPknId.trim().equalsIgnoreCase("")){
| pknId = Integer.valueOf(currentPknId);
| tProjecttype = em.find(TProjecttype.class, Integer.valueOf(currentPknId));
| }
| }
| tabName = evtHandle.getNewValue().toString();
| return "/projecttype.xhtml";
| }
|
Page
<rich:tabPanel selectedTab="#{tabName}" valueChangeListener="#{projecttype.changeTab}">
I cannot figure out why this happens if someone can give a hint
thank you
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088724#4088724
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088724
18 years, 7 months
[JBoss Seam] - Re: SeamTest and expectedExceptions
by gagool
This isn't working as I expect it.
If an exception is thrown inside the FacesRequest(){}; and the exception isn't propagated into the test class.
Tests that should fail due to exceptions are not failing..
The only way seems to be to create a try/catch-block inside each method of FacesRequest.. but that does not look nice.
Does not work as I exptected:
| public void test() throws Exception {
| new FacesRequest() {
| @Override
| protected void updateModelValues() throws Exception {
| setValue("#{invalidcomponent.blabla}", "me is monkey. me likes to swing treez.");
| }
|
| }.run();
| }
|
Does work as exptected but adds much jitter code to the tests:
| public void test() throws Exception {
| new FacesRequest() {
| @Override
| protected void updateModelValues() throws Exception {
| try{
| setValue("#{invalidcomponent.blabla}", "me is monkey. me likes to swing treez.");
| catch(exception e){
| Fail("test failed", e);
| }
| }
|
| }.run();
| }
|
Is this the intended behaviour?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088720#4088720
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088720
18 years, 7 months