P
polpot
I kindly request your help
I've a Javabean that i must declare only with session or request scope
i have to initialize the variables with values taken from web.xml
This is a sample situation
file web.xml
<param-name>state</param-name>
<param-value>01</param-value>
</context-param>
<context-param>
<param-name>county</param-name>
<param-value>TO</param-value>
</context-param>
<context-param>
<param-name>town</param-name>
<param-value>01000011</param-value>
</context-param>
This is the bean
import java.io.*;
public class SearchBean implements Serializable
{
private String state;
private String county;
private String comune ;
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
public String getTown() {
return town;
}
public void setTown(String town) {
this.town= town;
}
}
I wish that state, county and town values in the bean will be initialized
with web.xml values
(ie. Private String regione =01 read from web.xml)
The olny solution I found is to use System.properties (set in startup
servlet and get in bean:
state=System.getProperty("state"); etc.
I don't want to use this bacause there are more parametrized applications in
the same JVM and I think there will be data confusion.
I can't initialize values in the JSP callin the bean because these will be
default values (selected value) for combo boxes
Any help will be greatly appreciated
I've a Javabean that i must declare only with session or request scope
i have to initialize the variables with values taken from web.xml
This is a sample situation
file web.xml
<param-name>state</param-name>
<param-value>01</param-value>
</context-param>
<context-param>
<param-name>county</param-name>
<param-value>TO</param-value>
</context-param>
<context-param>
<param-name>town</param-name>
<param-value>01000011</param-value>
</context-param>
This is the bean
import java.io.*;
public class SearchBean implements Serializable
{
private String state;
private String county;
private String comune ;
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
}
public String getTown() {
return town;
}
public void setTown(String town) {
this.town= town;
}
}
I wish that state, county and town values in the bean will be initialized
with web.xml values
(ie. Private String regione =01 read from web.xml)
The olny solution I found is to use System.properties (set in startup
servlet and get in bean:
state=System.getProperty("state"); etc.
I don't want to use this bacause there are more parametrized applications in
the same JVM and I think there will be data confusion.
I can't initialize values in the JSP callin the bean because these will be
default values (selected value) for combo boxes
Any help will be greatly appreciated