• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Using a servlet bean in a jsp file

 
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I�m working on upgrading all my code to use Struts Tiles Templates. In the code I define some variables, which have to be used by all my jsp pages. Before my udgrading to Struts Tiles Templates I just included a jsp file, where all the variables was defined - i.e.


But now I have to share the variables in a bean request scope.

The way I will share the variables is by using a servlet bean (Initialize.java), which I call in the way below:

<jsp:useBean id="init" class="ini.Initialize" scope="request" />

My big problem is that now I have to change all my code in the jsp pages to use the variables, by calling the variables using the bean id, called init. I have to change my code from:

<%=ressources.getString("toppanel.choose_language")%>

to

<%=init.resources.getString("toppanel.choose_language")%>

That is a lot of work. Are there any way to get around of this problem?
[ June 27, 2005: Message edited by: Jeppe Fjord ]
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Give how similar those two pieces of code are, you can just use the Search / Replace function in your IDE. Most IDE's should support this, I know that Eclipse does.
 
On top of spaghetti all covered in cheese, there was this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic