Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

@ManagedProperty is not the right tool for the job of converting a submitted value and setting it as a bean property. HTTP request parameters are inherently strings. Better use <f:viewParam>, you can attach a converter to it like as you would do to <h:inputText>.

Source page:

<h:link value="Consulter Détails" outcome="question"> <f:param name="quesId" value="#{quests.quesPk}" /> </h:link> 

Target page (question.xhtml):

<f:metadata> <f:viewParam name="quesId" value="#{questionBean.quesPk}" converter="javax.faces.Long" /> </f:metadata> 

With

private Long quesPk; // +setter 

###See also:


Unrelated to the concrete problem, doing business logic in getter methods is a bad idea. Don't do that. Use <f:event type="preRenderView"> or <f:viewAction> listener method.

###See also:

@ManagedProperty is not the right tool for the job of converting a submitted value and setting it as a bean property. HTTP request parameters are inherently strings. Better use <f:viewParam>, you can attach a converter to it like as you would do to <h:inputText>.

Source page:

<h:link value="Consulter Détails" outcome="question"> <f:param name="quesId" value="#{quests.quesPk}" /> </h:link> 

Target page (question.xhtml):

<f:metadata> <f:viewParam name="quesId" value="#{questionBean.quesPk}" converter="javax.faces.Long" /> </f:metadata> 

With

private Long quesPk; // +setter 

###See also:


Unrelated to the concrete problem, doing business logic in getter methods is a bad idea. Don't do that. Use <f:event type="preRenderView"> or <f:viewAction> listener method.

###See also:

@ManagedProperty is not the right tool for the job of converting a submitted value and setting it as a bean property. HTTP request parameters are inherently strings. Better use <f:viewParam>, you can attach a converter to it like as you would do to <h:inputText>.

Source page:

<h:link value="Consulter Détails" outcome="question"> <f:param name="quesId" value="#{quests.quesPk}" /> </h:link> 

Target page (question.xhtml):

<f:metadata> <f:viewParam name="quesId" value="#{questionBean.quesPk}" converter="javax.faces.Long" /> </f:metadata> 

With

private Long quesPk; // +setter 

###See also:


Unrelated to the concrete problem, doing business logic in getter methods is a bad idea. Don't do that. Use <f:event type="preRenderView"> or <f:viewAction> listener method.

###See also:

added 47 characters in body
Source Link
BalusC
  • 1.1m
  • 377
  • 3.7k
  • 3.6k

@ManagedProperty is not the right tool for the job of converting a submitted value and setting it as a bean property. HTTP request parameters are inherently strings. Better use <f:viewParam>, you can attach a converter to it like as you would do to <h:inputText>.

Source page:

<h:link value="Consulter Détails">Détails" outcome="question"> <f:param name="quesId" value="#{quests.quesPk}" /> </h:link> 

Target page (question.xhtml):

<f:metadata> <f:viewParam name="quesId" value="#{questionBean.quesPk}" converter="javax.faces.Long" /> </f:metadata> 

With

private Long quesPk; // +setter 

###See also:


Unrelated to the concrete problem, doing business logic in getter methods is a bad idea. Don't do that. Use <f:event type="preRenderView"> or <f:viewAction> listener method.

###See also:

@ManagedProperty is not the right tool for the job of converting a submitted value and setting it as a bean property. HTTP request parameters are inherently strings. Better use <f:viewParam>, you can attach a converter to it like as you would do to <h:inputText>.

Source page:

<h:link value="Consulter Détails"> <f:param name="quesId" value="#{quests.quesPk}" /> </h:link> 

Target page:

<f:metadata> <f:viewParam name="quesId" value="#{questionBean.quesPk}" converter="javax.faces.Long" /> </f:metadata> 

###See also:


Unrelated to the concrete problem, doing business logic in getter methods is a bad idea. Don't do that. Use <f:event type="preRenderView"> or <f:viewAction> listener method.

###See also:

@ManagedProperty is not the right tool for the job of converting a submitted value and setting it as a bean property. HTTP request parameters are inherently strings. Better use <f:viewParam>, you can attach a converter to it like as you would do to <h:inputText>.

Source page:

<h:link value="Consulter Détails" outcome="question"> <f:param name="quesId" value="#{quests.quesPk}" /> </h:link> 

Target page (question.xhtml):

<f:metadata> <f:viewParam name="quesId" value="#{questionBean.quesPk}" converter="javax.faces.Long" /> </f:metadata> 

With

private Long quesPk; // +setter 

###See also:


Unrelated to the concrete problem, doing business logic in getter methods is a bad idea. Don't do that. Use <f:event type="preRenderView"> or <f:viewAction> listener method.

###See also:

Source Link
BalusC
  • 1.1m
  • 377
  • 3.7k
  • 3.6k

@ManagedProperty is not the right tool for the job of converting a submitted value and setting it as a bean property. HTTP request parameters are inherently strings. Better use <f:viewParam>, you can attach a converter to it like as you would do to <h:inputText>.

Source page:

<h:link value="Consulter Détails"> <f:param name="quesId" value="#{quests.quesPk}" /> </h:link> 

Target page:

<f:metadata> <f:viewParam name="quesId" value="#{questionBean.quesPk}" converter="javax.faces.Long" /> </f:metadata> 

###See also:


Unrelated to the concrete problem, doing business logic in getter methods is a bad idea. Don't do that. Use <f:event type="preRenderView"> or <f:viewAction> listener method.

###See also: