• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can the 'id' in jsp:useBean id="xxx". be set using a Constants file ?

 
moto raja
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please confirm me this ..
Suppose that I have a value in my constant file,Constants.java :

public String OUTPUT_KEY = "output" ;
.....
After some processing of the request,
the response handler creates a valid viewBean object,say, 'info' and sets it's attributre value as :
info.setAttribute(Constants.OUTPUT_KEY,someValidObject) ...
....

Now , in the success.jsp where I want to display the details of the viewBean,
I generally get the response bean by saying...

<jsp:useBean id="output" scope="someScope" type="validClassType" />
While setting the value of 'id' as above,we should remember the value of OUTPUT_KEY in constants file and set 'id' to this same value,means we are hardcodng it.

I do not want to hardcode id="output" here..
I want to use the Constants.OUTPUT_KEY value directly to set value of 'id'.
If not,whenever a change is made to OUTPUT_KEY in Constants.java,we need to change the value that 'id' is set to in the jsp.

Any answers on this please....?
 
tiim fei
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you could use a runtime expression value here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic