Skip to content
Advertisement

JSF Keep Parameter in XHTML

How can ı kep parameter in XHMTL file.

for example ı want to kep parameter like

….param name= “name” value=”john”….

then the other line ı want to print it with calling name parameter.

I want to do this. I have a problem with calling multiple times a sessionscoped bean.

I will solve this way.

the Login Bean is here :

JavaScript

The XML PART is Here :

JavaScript

Advertisement

Answer

There might be better ways but you could try JSTL tags like <c:set name="name" value="john"/>.

Note, however, that you need to keep in mind when JSTL tag handlers are evaluated and when JSF kicks in. Here’s an article that should help get you started with that: https://rogerkeays.com/jsf-c-foreach-vs-ui-repeat

Additionally, you might want to tell us why you can’t call the bean multiple times. There might be an issue with your design that you could address. For example, try not to caluclate things in getters because they might be called more than once, even for a single expression on a page. Move those calculations/date retrievals to an action that is executed exactly once. Alternatively use a flag to check whether the data has already been calculated/retrieved.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement