Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing parameters to JSF Error  RSS feed

 
Mat Anthony
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I'm trying to pass a parmeter to a jsf page from a servlet(i.e. associated with paypal adaptive api), but I keep getting the following error, even though the productType on ProductDetailsVO is a String.

INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
sourceId=j_idt2[severity=(ERROR 2), summary=(j_idt2: '45;productType=Sport'
must be a number consisting of one or more digits.), detail=(j_idt2: '45;productType=Sport' must be a number between -2147483648 and 2147483647 Example: 9346)]

Calling JSF page contains:-


file:paypalpaymentapproved.xhtml


file:ProductDetailsVO.java


Has anybody seen this before, or have any ideas how to solve this.

Mat
 
Mat Anthony
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I think the problem was due to the parameter lis. Should have been


Mat
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to be nitpicky here and note that JSF backing beans are not Controllers, they are Models. No amount of embedded logic turns them into Controllers, since a Controller is what transfers the data values to and from the View, and in JSF, that's done by tags and the FacesServelet.

Naming conventions aside, here's what looks odd to me:

(j_idt2:'45;productType=Sport'

I'm not sure about that apostrophe, in particular.

Aside from that, you're using what appears to be a resource path as though it was a URL path. So instead of "pages/paypalpaymentapproved.xhtml", I'd expect to see "pages/paypalpaymentapproved.jsf"

Using a resource path as though it were a URL can potentially cause the FacesServlet not to be invoked and thus completely bollixed results.
 
Mat Anthony
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,
thanks for the reply. I will try using .jsf

Mat
 
Akaine Harga
Ranch Hand
Posts: 99
Java MyEclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO, it has nothing to do with the view files extensions. The error you get in the console is classic JSF form validation error. Means the form expects an Integer value for the productType field while you're sending a string. Why don't you change the approach? Call the managed bean from the servlet and set the values there and then render the page.

Step 1. Define and abstract Faces Servlet:


Step 2. Initialize the FacesContext and set the values in the managed bean:


Alternatively you could just use HttpSession attributes and read them from your managed bean.

Hope it helps, Regards
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF Rule #1:


The more JSF-specific code you have in your JSF web application, the more likely it is that you're doing things the hard way.
 
Mat Anthony
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Akaine and Tim,
thanks for all you replies. Akaine I'm using paypal Adaptive api servlet. Hence once the user has authorised payament, paypal uses the return url that points to my application Adaptive servlet.
My servlet then checks the response back from paypal to ensure that payment has been authorised and then forwards it to a jsf page that has a mapped backing bean. The issue was that the return url that i was using to
call the jsf page:-


should have looked like this:-


Hence the error that Tim noticed:-
(j_idt2:'45;productType=Sport'


Thanks all
Mat
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!