• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setter not called on submit

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to JSF. I created a page based on some examples I see from the JBoss Seam examples but my problem is not Seam related (I think).

It is very simple. Enter a value into an h:inputText field, click a button to call an action method on an SLSB. The problem is the setter for the text field (setTestVal) is not being called. It is my understanding it should be called to load the text typed into the page into the testVal property of the SLSB before the action method is called. I can build the examples I have and they work! I noticed the example used a SFSB. I tried making mine a SFSB but nothing changed. I must have missed something or misunderstand how this works (again, new stuff to me)

Environment: JBoss AS 4.0.5, Seam 1.2.1.GA, JSF?? whatever comes with this JBoss version (I think myfaces 1.1.4).

From Page:

<h:form>
<h:inputText value="#{Tester.testVal}"/>
<s:button title="Submit" action="#{Tester.post}" />
</h:form>

From SLSB:

@Name("Tester") // seam annotation, avoids XML definition
public @Stateless class ActionTestBean implements ActionTest {

private String testVal;

public String getTestVal() {
return testVal;
}

// SHOULDN'T THIS SETTER BE CALLED BEFORE THE POST METHOD WHEN THE BUTTON IS // CLICKED to load what was entered into the page ???
public void setTestVal(String testVal) {
this.testVal = testVal;
}

public void post()
{

String tmp = testVal;

}

The action method is called as I expect. There are no errors of any kind that I see or can find in the logs.

HELP!
 
Dowell Griffin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SOLVED!

It turns out the s:button (seam component) does not submit the form! From Seam manual:

A button that supports invocation of an action with control over conversation
propagation. Does not submit the form.

I changed it to h:commandButton and it works!
 
Ranch Hand
Posts: 893
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your solution.

I'm also testing Seam because I want to implement this framework for a customer of mine and will make sure that I don't make the same mistake.

Good luck with your testing.
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy "lpmon",

That's nice to see that you solved the issue. Here are a couple of suggestions.

(1) please adjust your display name according to the ranch's naming policy. You can please go through the Name Page and easily update your name by editing your profile.

(2) Please use the Code Tags for pasting the java code and output so that it will help the code look clean.
 
reply
    Bookmark Topic Watch Topic
  • New Topic