cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

why do we have 2 folders for java classes namely, src and web/src ?

Former Member
0 Kudos
758
  1. why do we have 2 folders for java classes namely, src and web/src in an extension?

  2. What is the difference between this 2 ?

  3. In which scenario we add controller in src and controller in web/src ?

Accepted Solutions (0)

Answers (2)

Answers (2)

arvind-kumar_avinash
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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,