• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....?
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you could use a runtime expression value here.
 
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
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
reply
    Bookmark Topic Watch Topic
  • New Topic