Based from the information I've read, in order for you to expose your properties to the .jsp, you will have to set the properties file at the same level as your action method. Currently, this is how my sample app directory looks like:
app
|
| build
| src
| some.package.login
| Login.java
| Login.properties
| WebContent
| META-INF
| WEB-INF
| login
| login.jsp
As you can see, my Login.properties is in the same folder as my Login.java. This bothers me a lot seeing that once my application grows, there would be lots of property files that will be scattered around in various folders inside my src directory.
I was wondering if there is a way to consolidate all these property files into a single folder (probably src/resources) and tell Struts to look there for the property files just so that my property files aren't scattered around everywhere.
EDIT: I also wanted to know the best practices regarding property files. There are two kinds: the local and the global. I'm planning to place action-specific properties in local property files and I'm planning to put generic / static texts (to be rendered in the JSP) in the global property file. Is this a good practice?
Best practice is to put properties files in separate folder.
Like this(Maven directory structure)
src/
/main
/java
/com.dao
/com.action
/com.domain
/resources
/displaytag.properties
You can have package.properties file in a folder that will aggregate all the properties (but only within the package of course)
Related
My team has been working with serverless and we're trying to establish a new standard in the company for a file organization that eases the collaborative development.
We plan to isolate the lambdas/functions handler each in their folder, alongside the function .yml file and other necessary configs.
Example expected directory structure (lean):
-- /app
--- /functions
---- /func_a
----- func_a.py
----- func_a.yml
---- /func_b
----- func_b.py
----- func_b.yml
- serverles.yml
The problem so far is that we have to manually declare all external config function files in the serverless.yml file, which breaks the whole purpose of the idea.
The question is: is there a way to automate this import?
What we've searched so far:
Wildcard path - does not work for file variables. Eg.: ${file(./app/functions/*.yml)} or ${file(./app/functions/{any+})}
Extending configuration using custom plugins - does not seem to be able to modify the functions list. Only found information about: DefineTopLevelProperty, defineCustomProperties, defineFunctionEvent, defineFunctionEventProperties, defineFunctionProperties, defineProvider.
Info from here: Serverless Doc - base schema link broken, so no other information aside from the one in the page.
What we thought to be options:
Maybe is there a plugin that does that? Didn't find any.
Create an isolated custom function (python) that is called before running sls deploy and creates the final serverles.yml file from a template by traversing all folders.
What is the better and most natural approach to that?
I think that for your use case, you might be better of with considering using JS/TS configuration file format instead of YAML. That allows you to use regular JS to define your config which makes importing such parts of configurations much easier. See the TS template for example on how to use it: https://github.com/serverless/serverless/blob/master/lib/plugins/create/templates/aws-nodejs-typescript/serverless.ts
I have several VB.Net projects each with containing many files/forms. Several of the forms are shared/linked between more than one project and saved in a shared folder. Recently I discovered one file that should have been shared was not, meaning that there were two files with the same name in two different folders. Obviously any change of a file in one project was not shown in the other poject. Is there any way of listing all the files and paths in a project - either to screen or spreadsheet?
you should take a look at the projectname.vbproj file, it is a xml file and in the node called <ItemGroup> you are going to find what you are looking for, you can tell if a file is a linked one if inside the <Compile> node there is a <Link> tag.
With help of this CocoaLumberjack FileLogger logging to multiple files , I am able to create multiple log files (with same name in multiple directories),
But I need to use DDLog in one of my project where it is required to write multiple logs files in the same directory with different names.
Is there any way to attain this?
DDFileLogger uses logFileManager for managing logfiles. By default it uses DDLogFileManagerDefault. You can create your own file manager that confirms to DDLogFileManager protocol and provide whatever behavior you need.
The easiest way doing this is to copy DDLogFileManagerDefault and change it to feet your needs.
I'm trying to learn CMake and I've run into a little hiccup. I have a library with a structure somewhat like this:
LibProj
| include
| | public1.h
| | public2.h
| library
| | public1.cpp
| | public2.cpp
Now, let's say I want a .h file that may or may not be associated with a .cpp file that I want to only be used by the files within the library. That is, I don't want it exposed to projects that use the library. Is there a way to do this?
Thanks!
The typical solution is to move the internal stuff to another directory:
LibProj
| include
| | public1.h
| internal
| | private1.h
And then only add the internal folder as an include directory in your library and make sure it is not copied at install time. In general it is not possible to allow including one header file from a directory but disallow another. Most (if not all) compilers only allow to specify include directories, not singular include files.
Is it possible to load values for infinispan-config.xml file from some property file so that we can get rid of hard coded values. If possible then can somebody show me the way how i load property file in infinispan-config.xml file because there is no Pre defined tag for configuration.
This is possible by setting respective system properties.
For example here is one specific Infinispan configuration file which is using this approach: https://github.com/infinispan/infinispan/blob/master/core/src/test/resources/configs/string-property-replaced.xml
and here is a test which is working with that file: https://github.com/infinispan/infinispan/blob/master/core/src/test/java/org/infinispan/config/StringPropertyReplacementTest.java
This looks to be the most straightforward way how to achieve this.
The last thing which needs to be done is to simply read all lines in your configuration file and put them correctly to system properties.