• 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

Passing parameters to JSF Error

 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I think the problem was due to the parameter lis. Should have been


Mat
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,
thanks for the reply. I will try using .jsf

Mat
 
Ranch Hand
Posts: 99
MyEclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic