Defining custom properties in the application panel - how to get the value in the code?

In the IBM WebSphere Web Admin Console, you can go to Applications β†’ WebSphere Enterprise Applications, select the application, and click the Custom Properties link. A page will be added to add key-value pairs. How do you access these values ​​from code? It seems that the properties do not fall into the properties of the system or in the ServletContext.

+8
websphere websphere-8
source share
4 answers

I have never seen it used during my 7 year career with IBM WebSphere Application Server. I think that if he ever used it so rarely that I would call this feature the left version of the previous version of IBM WebSphere that supported it.

For application configuration options, I highly recommend web.xml for web applications or @Resource annotation for web applications and other application types.

0
source share

I tested this on WAS ND 8.5. Adding a custom property to the application adds it to the deploy.xml file.

I updated \ DefaultApplication.ear with the property name = "testprop" value = "true". Updated here:

C: \ WASNEW85 \ WebSphere \ AppServer \ Profiles \ Dmgr01 \ Config \ cells \ cell01 \ applications \ DefaultApplication.ear.ear \ deployments \ DefaultApplication.ear

The value shows:

 <properties xmi:id="Property_1424805152486" name="testprop" value="true" description="test-forum" required="false"/> 

Hope this helps.

0
source share

This answer will not be entirely relevant, but it can solve the problem of defining and setting configuration properties for web applications managed by WebSphere.

The easiest way to define configuration settings for a web application in WebSphere:

  • Define the parameters of the web application using the servlet initialization parameters:

web.xml

 <servlet> <servlet-name>my-servlet</servlet-name> <servlet-class> my.servlet.ClassName </servlet-class> <init-param> <param-name>someConfigurationPropertyName</param-name> <param-value>This Value Can Be Set</param-value> </init-param> </servlet> 
  1. The value of these servlet parameters can be changed using the web administration console, you will find and can change them in Enterprise Applications > your-web-application-name > Initialize parameters for servlets
0
source share

To set a custom webcontainer property on IBM WebSphere Application Server version 7 or version 8

  • In the administrative console, click "Servers", and under the servers, click "Server Types", and in the "Server Types" section, click "WebSphere Application Servers".
  • Click on the server to which the custom property will apply.
  • In the "Configuration" and "Container Settings" section, click "Web Container Settings" and in the "Web Container Settings" section, click "Web Container"
  • In the "Configuration" and "Advanced Properties" section, click "Custom Properties"
  • On the Custom Properties page, click Create
  • On the settings page, enter the name of the custom property that will be added to the Name field and the value that will be set for the custom property in the Value field. Please note that some properties are case sensitive.
  • Click "Apply" or "OK"
  • Click "Save" in the appeared window "Messages"
  • Restart the server for the custom property to take effect.

To set the webcontainer custom property on IBM WebSphere Application Server version 6:

  • In the administrative console, click "Servers" and under the servers, click "Application Servers"
  • Click on the server to which the custom property will apply.
  • In the "Configuration" and "Container Settings" section, click "Web Container Settings" and in the "Web Container Settings" section, click "Web Container"
  • In the "Configuration" and "Advanced Properties" section, click "Custom Properties"
  • On the Custom Properties page, click Create
  • On the settings page, enter the name of the custom property that will be added to the Name field and the value that will be set for the custom property in the Value field. Please note that some properties are case sensitive.
  • Click "Apply" or "OK"
  • Click "Save" in the appeared window "Messages"
  • Restart the server for the custom property to take effect.

To set the webcontainer custom property on WebSphere Application Server version 6 using wsadmin:

  • Create a jacl script to add / update a custom property.
  • Make sure the server is running.
  • Run jacl script in wsadmin using "wsadmin -f.jacl
  • Reboot the server for the custom property to take effect.
-one
source share

All Articles