on 2018 Dec 05 9:25 AM
why do we have 2 folders for java classes namely, src and web/src in an extension?
What is the difference between this 2 ?
In which scenario we add controller in src and controller in web/src ?
Request clarification before answering.
Please check https://help.hybris.com/1808/hcd/438db70eb0234697976eeceaba6d0394.html which says:
Partition classes between src and web/src folder appropriately.
General extension specific logic should be independent from web logic, and the two clearly separated by being placed in different source directories. For example:
Classes having business logic concerning the task of the extension must be located under the src folder.
Classes having business logic concerning the task of the extension must be located under the src folder.
Classes using web specific libs like zk components must be located under web/src.
General logic should not have dependencies on web stuff. For example, a finder for a type should never be dependent on zk classes.
You will find controllers mostly in web/src but you can see some exceptions e.g. in yacceleratorstorefront, yb2bacceleratorstorefront and acceleratorstorefrontcommons there are some controllers in web/commonwebsrc and in addonsupport there are controllers in src.
I hope it helps.
Best regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
you can imagine it like this: the src folder is mostly used for backend and the whole web folder is for the frontend of your extension.
Controllers in web/src folder should only be mapping to the static views when controllers from the src folder should return the data, or views filled with data.
These two folders delimit the functionalities of the extension. Probably you could just put all controllers mapping into one folder, but this way it's more transparent.
I hope that I have clarified the situation somewhat.
Best regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.