So trying to create a relatively (I thought) simple setup in groovy, and missing a couple of bits.
Basically I am trying to create a webpage with three panes, a title, left side bar and a main window. The title stays as it is, the left pain has a controller for generating reports, the right side shows the output. So far so good, but there are two or potentially three commands or features I do not seem to be able to master, searched but the search therms I used comes up with little useful.
So, first the main .gsp, the one that I would suspect loads the structure. Created a controller and view called calllog. The controller is empty, while the index.gsp contains the following.
<meta name='layout' content='call-log'/>
<html>
<head>
<title>Call log</title>
</head>
<body>
<div id="CallLogo"><H1>Call Logger</H1></div>
<div id="controller">
<object type="text/html" data="dbstats/index">
<g:link controller="dbstats" action="index">This is something</g:link>
</div>
<div id="output">Your output here</div>
</body>
</html>
Here is my first issue, it does not seem like it is creating the div sections I am expecting, it just outputs it. Secondly, the does not seem to load, and I have not been able to find a operator.
The layout looks as follows
<!doctype html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><g:layoutTitle default="call-log"/></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<asset:stylesheet src="calllog.css"/>
<asset:javascript src="call-log.js"/>
<g:layoutHead/>
</head>
<body>
<div class="CallLogo" id="CallLogo" role="banner"><a href="http://www.google.co.uk"><asset:image src="call.png" alt="call.png"/></a></div>
<g:layoutBody/>
<div id="controller" class="controller" role="contentinfo"></div>
<div id="output" class="output" style="display:none;"><g:message code="spinner.alt" default="Loading…"/></div>
</body>
</html>
The next problem I have, which may have the same answer is, how do I call (or do a call back) to a action. So, the dbstats controller will provide a menu, once you press submit, it will call a submit class which stores some data, what I want to be able to do is to get that pane to go back to index, while also start a process to generate output to the "body" pane.
=============UPDATE: One step forward Two steps ... ==================== So getting closer, managed to solve the issues with the layout and divs, did not help that I was editing the wrong CSS file as well.
The webpage looks like this now
-------------------------------
| Logo |
-------------------------------
| Con | Output |
| tro | |
| lle | |
| r | |
| | |
-------------------------------
I managed to update so that the Controller function loads correctly, and there is a list and a submit button and all.
However, what I can't figure out is. Once the Submit button is pressed, and I have read the info I wan't (that works now), how do I either get the Controller reloaded as controller="dbstats" action="index" into the div Controller and call a function to update Output with another controller, say controller=generateGraph action=graph. Tried with redirect which told me:
The code of submitform looks like this currently
def submitForm() {
def postIds = params.list('userform').get(0)
for ( e in session.users) {
session[e] = "False"
}
postIds.each() { postId ->
if ( postId.value == "1" ) {
session[postId.key] = "True"
//render {
//div(id: "Output", "Will do ${postId.key}<BR>")
//}>"
}
redirect(action: "CallLog")
}
} All that giver me is Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response.. Stacktrace follows: Message: Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response.
Would be happy to redraw the whole page id need be.