I’m currently working on understanding the web-app source code and i have some questions. In auditSynthesisController the function prepareSynthesisSiteData returns: TgolKeyStore.SYNTHESIS_SITE_VIEW_NAME. Where is this function called and where and how is the returned value used? I suppose that it is somehow connected to the view SynthesisSite.jsp. I’m trying to understand how the html code is produced.
Also if i want to change something in a view for example if i want to add a link or something should i change only the .jsp file or is it more complex? Thanks a lot!
About your second question, to add a link to the page, just add your html in the jsp.
If the code you want to add uses data from the model, you need to add an entry in the model Object in the controller method. This is a classical map, key/value.
Once in the model, the data can be simply accessed by using ${myKeyInTheModelMap} in the jsp. That will then interpreted before being rendered by the server.
Regarding the kind of Java object you associate to the key in the map, you can for instance :
access to the any attribute of the object : ${myKeyInTheModelMap.myClassAttribute}. The class must simply define a method called “getMyClassAttribute”
iterate over a collection with a <c:forEach tag,
and so many other stuffs.
Enjoy and thanks for your interest
Feel free to ask other questions
Ok thanks a lot! Let’s say that i want to add another graph to the html identical for example to the score graph but i want this to be computed with a different formula computed by java code that i will write. How complex would something like that be? Or what if i would like to create a new view containing some graphs which would display some of the data from the database?
It depends on what kind of graphics you want to create.
We currently use the d3.js library to build our graphics.
To do so, we create in the jsp a table with the data, that is then used by some javascript code to collect dara, build the graphics and then hide the original data by css.
You may use another way, we can discuss about it, if you have any idea.
git clone https://github.com/Asqatasun/Asqatasun.git
cd Asqatasun
git checkout develop
# make changes to the source code using an IDE
# (...)
# builds with maven, builds docker image and runs a new docker contenair
docker/compile_and_build_docker_image.sh -l -s ${PWD} -d docker/single-container-SNAPSHOT-local
In your browser, go to http://127.0.0.1:8085/asqatasun/
Ok @fabrice i tried to do it this way but the compile takes too much time and i want to test very often the changes i make. Do i need to compile everytime or a refresh on the browser is enough?
I have made some changes such as putting a link in home.jsp:
the link i added is absent in http://127.0.0.1:8085/asqatasun/home.html although it exists on home.jsp.
Also i added a simple view named mypage.jsp and this controller:
@Controller
public class MyPageController{
@RequestMapping(value = TgolKeyStore.MY_PAGE, method = RequestMethod.GET)
//@Secured({TgolKeyStore.ROLE_USER_KEY, TgolKeyStore.ROLE_ADMIN_KEY})
public String MyPage(HttpServletRequest request,
HttpServletResponse response,
Model model){
return TgolKeyStore.MY_PAGE_VIEW_NAME;
}
}
Of course i added: public static final String MY_PAGE = "/mypage";
and : public static final String MY_PAGE_VIEW_NAME = "My-page" in TgolKeyStore.java and configured view.properties by adding:
Problems solved! Instead of typing http://127.0.0.1:8085/asqatasun/mypage i should type http://127.0.0.1:8085/asqatasun/mypage.html (i don’t know why) and for compiling i added mvn clean install -Dmaven.test.skip=true to the script.
My new question is whether each time i compile and run a new container a new database is created? I already have an asqatasun database from the installation without docker with the default credentials, so if it is created how could it be the same?
[quote=“nivak91, post:15, topic:259, full:true”]
My new question is whether each time i compile and run a new container a new database is created? [/quote]
when you run a new Docker container, a new database is created inside this new container.
Also another question that i have is where are the parameters of draw function of score-min.js set? I would like too use this script in order to make more than one score graphs in a page. Is that possible by changing those parameters?
Hello again! If i make changes to the database how are the native SQL queries affected? For example if i add a new table or add to an existing table should i change them?