• 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

Not getting request parameters

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i am getting null values for the request parameters in JSF. The code was
returning correct values before I have added more getter and setter methods.

The size of the code is big now. Correct values are passed from JSP when
clicking tracking number. Tracking number is the request parameter variable.
if I roll back to my old version, I am getting the values. From the JSP
the values are passed perfectly. Can someone tell me how to put System.out.println (similar to that ) in JSP. Further how to fix this problem ? Thanks in advance.

Mural

String grantsgovtrackingNumber = (String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("grantsgovtrackingNumber");
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by seshayya krishna:
Hi
i am getting null values for the request parameters in JSF. The code was
returning correct values before I have added more getter and setter methods.

The size of the code is big now. Correct values are passed from JSP when
clicking tracking number. Tracking number is the request parameter variable.
if I roll back to my old version, I am getting the values. From the JSP
the values are passed perfectly. Can someone tell me how to put System.out.println (similar to that ) in JSP. Further how to fix this problem ? Thanks in advance.

Mural

String grantsgovtrackingNumber = (String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("grantsgovtrackingNumber");



If you have a component <id="XYZ"> inside a a form <id="ABC">, then you should be doing

(String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("ABC:XYZ")
If your component is present in submitted form it will be the part of the request, unless you have disabled your component or something equivalent
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a similar problem, well sort of. My h:commandButton tag included

immediate="true"

if you do that, the setter doesn't get called before the action method is invoked. So the action method can't see any changes to the form.

Amy
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying fetch request param it always gets null value

String name = (String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("n");
n is the id of the component, tried formid.componentid too ,still it give null value.

my managed bean is of requestscope

@ManagedBean
@RequestScoped
public class MyBean

Can anybody help me to sort out this issue....
 
Ranch Hand
Posts: 101
Spring Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These issues can be because of anyone of the below reasons:
1. Id of the component is not proper. If you give id to your text box as "abc" and the id of your form is "xyz" then when the page renders, id of the text box becomes "xyz:abc" you can check this out by seeing the source once the page renders. Can be fixed by using forceId="true" if you are using tomahawk or just copy the automatically generated id from the source and use it in the code.
2. All the six phases of JSF are not successful. Most likely validation phase is failing. In this case update model doesn't happen.
3.If the same page gets refreshed on clicking the button, then the button should be having a rendered attribute which has an EL expression. And in all phases the expression is executed and it should return true.
 
appandarajan poornachandran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thnxs for the reply..
i was able to get my request param the other way round thru the managed bean values set
MyBean my = (MyBean) FacesContext.getCurrentInstance().getExternalContext()
.getRequestMap().get("myBean");

but i would like to know if this the right way to get my form variable values.........
 
permaculture is largely about replacing oil with people. And one tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic