I am trying to build an HQU plugin that has a form to ask some questions from the user, do some work when the user submits and display a response. There are two views and two methods in the controller. In pseudocode this is what I am trying to do:
controller:
class MyController extends BaseController
def index(params) {
render()
}
def result(params) {
// check form values, make remote call, display result page
render(locals:[ myResult: 'Success'])
}
index.gsp:
<form action="/hqu/myplugin/mycontroller/result.hqu" method="post">
// some fields
<input name="commit" type="submit" value="Submit">
</form>
result.gsp:
<p>${myResult}</p>
Plugin.groovy:
addView(description: 'My Plugin,
attachType: 'admin',
controller: MyController,
action: 'index',
category: 'tracker')
My plugin is listed on the Administrator page, and the index page gets rendered fine. But when I hit the submit button, I get a stack trace that has:
groovy.lang.MissingPropertyException: No such property: myResult for class: Script1 at
Q1: Why isn't myResult available in the gsp even though I pass it in the render() call (hmm, is the result method even called at all I wonder)?
Q2: If I make the result.gsp "<p>Hello<p>" I do get a page. However, it is a standalone page (not wrapped in Hyperic header and footer like the index.gsp page). Is there any way to get this result page also wrapped like the index page?
I am trying to build an HQU plugin that has a form to ask some
> questions from the user, do some work when the user submits and
> display a response. There are two views and two methods in the
> controller. In pseudocode this is what I am trying to do:
>
>
controller:
>
> class MyController extends BaseController
> def index(params) {
> render()
> }
>
> def result(params) {
> // check form values, make remote call, display result page
> render(locals:[ myResult: 'Success'])
> }
>
>
index.gsp:
>
> <form action="/hqu/myplugin/mycontroller/result.hqu"
> method="post">
> // some fields
> <input name="commit" type="submit" value="Submit">
> </form>
>
>
result.gsp:
>
> <p>${myResult}</p>
>
>
Plugin.groovy:
>
> addView(description: 'My Plugin,
> attachType: 'admin',
> controller: MyController,
> action: 'index',
> category: 'tracker')
>
>
My plugin is listed on the Administrator page, and the index
> page gets rendered fine. But when I hit the submit button, I get a
> stack trace that has:
>
> groovy.lang.MissingPropertyException: No such property: myResult
> for class: Script1 at
>
>
Q1: Why isn't myResult available in the gsp even though I
> pass it in the render() call (hmm, is the result method even called
> at all I wonder)?
>
>
Q2: If I make the result.gsp "<p>Hello<p>" I do
> get a page. However, it is a standalone page (not wrapped in
> Hyperic header and footer like the index.gsp page). Is there any
> way to get this result page also wrapped like the index page?