This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How can I set bean property in JSF page?!

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
jspx is jsp page in xml syntax.
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic