Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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

How can I set bean property in JSF page?!

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!

I have



have jsp page




and have faces.xml






when I run it, get in output

"
--- first---
--- first---
"
I other words JSTL <c:set /> is not working... Why?

Please help me...
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not know if the JSTL "set" will work with JSF. However, can't you just use another variable for the second level output? If you are looking to have both of the values appear on the same page then you would be making a cleaner solution by using two separate variables in my opinion.
 
Pavels Hlopoks
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Josh, thanks for your response ;)

But I really need to set managed bean property from jsf page. In our architecture it is required for menu...

Sombody can answer me - how can set managed bean property from JSF page?
[ June 03, 2007: Message edited by: Pavels Hlopoks ]
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Pavels,

If you don't force to use JSTL , you can set the bean properties by JSF easy.
Look:

UserBean bean = new UserBean(); // your bean class

ExternalContext context =
FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request =
(HttpServletRequest)context.getRequest();

String fullName = request.getParameter("form1:fullName");
bean.setFullName(fullName);

you can do this in utility class.

I hope it can help you.

Zohreh
 
Pavels Hlopoks
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hmmm ... For example managed bean in faces config looks like :



How I can get it from request?

Why you wrote: String fullName = request.getParameter("form1:fullName");

Why "form1:fullName"??
 
zohreh talebi
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok ,

How I can get it from request?
By this:

ExternalContext context =
FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest request =
(HttpServletRequest)context.getRequest();

Why you wrote: String fullName = request.getParameter("form1:fullName");

beacuase of this is for example your JSP :

<h:form id="form1" >
First Name :
<h:inputText id ="fullName" value="#{dbBean.fullName}"/>

Zohreh
 
Pavels Hlopoks
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
zohreh, are you sure?


I have jspx page :





how can see i try get bean from request...




And I have some bean - how Can I get HeaderBacking from request?

when I try get all RequestParemeterNames - I can't see my "headerBacking", like in faces config...


 
zohreh talebi
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know about jspx pages and i don't sure So ,sorry.
Can you tell me something about it.
 
Pavels Hlopoks
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jspx is jsp page in xml syntax.
 
reply
    Bookmark Topic Watch Topic
  • New Topic