I'm getting the following error reported from JSF in certain situations. I
have found a solution, but I wanted to dump out my code to the group to see if
you guys have seen this issue and help me determine if this is an issue in
seam, or if I'm just misusing or not understanding this particular concept.
What I have is a simple form application. This particular piece is a search
form. I simply want to submit my form, have seam inject it into my bean
component, which is an entity bean, and complete an action. Simple stuff. I'm
not doing anything crazy or extreme here. Let me show you the code that does
work and then I'll make a simple modification to show what doesn't work.
First, let's look at my Entity Bean.
| @Entity
| @Name("profileRecord")
| public class ProfileRecord implements Serializable {
|
| @Id
| @GeneratedValue
| private long id;
|
| private String workAuthorizationNumber;
| private String proposalNumber;
| }
|
This is a simple 3 field bean. I've removed the getters/setters from this
posting.
My listener looks like this:
| @Name("search")
| @Stateless
| public class SearchAction implements Search
| {
| @Logger
| private Log log;
|
| @In(required=false)
| private ProfileRecord profileRecord;
|
| public String search()
| {
| log.info("Running Search");
| return null;
| }
| }
|
And, my xhtml.
| <h:form>
| <h2>Basic Search</h2>
| <div style="text-align: right;"><label>WA #:<h:inputText
value="#{profileRecord.workAuthorizationNumber}" /></label></div>
| <div style="text-align: right;"><label>Proposal #:<h:inputText
value="#{profileRecord.proposalNumber}" /></label></div>
| <div style="text-align: right;"><h:commandButton type="submit"
value="Search" action="#{search.search}" /></div>
| <div style="text-align: right;"><a
href="detailedSearch.seam">Detailed Search</a></div>
| </h:form>
|
This code works as expected. My issues arise when I change the field name in
my action listener. My understanding is that I should be able to modify my
action listener to have a differently named variable for profileRecord. I
should be able to do that either by writing
| @In(required=false)
| private ProfileRecord searchRecord;
|
or
| @In(value="searchRecord", required=false)
| private ProfileRecord profileRecord;
|
And then changing my xhtml to
| <h:form>
| <h2>Basic Search</h2>
| <div style="text-align: right;"><label>WA #:<h:inputText
value="#{searchRecord.workAuthorizationNumber}" /></label></div>
| <div style="text-align: right;"><label>Proposal #:<h:inputText
value="#{searchRecord.proposalNumber}" /></label></div>
| <div style="text-align: right;"><h:commandButton type="submit"
value="Search" action="#{search.search}" /></div>
| <div style="text-align: right;"><a
href="detailedSearch.seam">Detailed Search</a></div>
| </h:form>
|
If I make any of those changes and deviate from my original example, I get the
error stating.
anonymous wrote : value could not be converted to the expected type
I'm taking this as a JSF error and not a seam error based on a previous thread
replied to by Gavin that stated that this particular error string was coming
from JSF. I can't find that thread back at the moment though. Sorry.
Am I misunderstanding the purpose and the abilities of injection here? My
understanding is that each injection or outjection (bijection) dumps these
components in a type of component cloud that other components can pull from or
put to. If I specify a value for a bijection annotation, that name is what is
stored as the link to that component. If I don't specify a value, the field
name is used as default. Which would lead me to believe that all three of my
examples should work the same.
Please, help clarify my understanding here. I've searched the forums and
Google and have had limited success in finding anything regarding this issue.
I've also looked in the demos and have seen numerous times where the examples
do what I'm doing and it has worked as expected, yet mine will not.
Thanks,
James
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4012545#4012545
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4012545
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user