first JSP : It is the jsp configured to call a controller onLoad or onSubmit.
- here, i will have to dynamically add new form elements such as txtbox, tablerows, checkbox, etc.
- In order to add new form elements, and assign values to it, I will need to click on a button, let's say, "add" button.
This "add" button will trigger the display of another JSP page, which I wouldn't like to pass through a controller.
second JSP : it is the jsp called from the first JSP.
- this is a "child window" which gets some data from the parent window.
- here I will need to enter the type of form element and enter the values to be assigned to it.
- after i click "OK" button, the new form shall be added to the first JSP, including the values.
It works well if I use plain JSP.
But when I integrate it with spring mvc framework, it cannot find the 2nd JSP's location. It says, not found.
Regardless if i put the absolute or relative path or just the name of the 2nd JSP.
I had written and submitted a whole different response but as I read this, it appears you may want to take a different approach. The thing that makes your requirements interesting is the parent/child relationship between the two pages. You may want to consider a different approach like using JavaScript. It doesn't sound like the second page needs to go to the server to fulfil its function so that might be a better way to do this.
Glyzel Martinez
Greenhorn
Joined: Aug 20, 2010
Posts: 2
posted
0
Mark Secrist wrote:I had written and submitted a whole different response but as I read this, it appears you may want to take a different approach. The thing that makes your requirements interesting is the parent/child relationship between the two pages. You may want to consider a different approach like using JavaScript. It doesn't sound like the second page needs to go to the server to fulfil its function so that might be a better way to do this.
Hi Mark.
Yes. Currently.. I am having the parent child relationship using javascript.
Parent window - this is called by a controller.
child window - called from the parent window via javascript window.open() call onclick of a button.
I tried to put the absolute path and the relative path of the jsp page like these, but both didn't work. :
(1) window.open("/myChildWindow.jsp","childWinName", <window properties>);
(2) window.open("/WEB-INF/jsp/myChildWindow.jsp","childWinName", <window properties>);
However, maybe since i am using spring, and i have a servlet mapping *.htm for the controllers, the javascript child window does not load.
The child window appears but does not behave as i expect it.
In your first attempt, it may simply be a matter of path mapping (i.e. you have no mapping to define '/myChildWindow.jsp' as being in the real location). In your second attempt, this would fail because the user won't have direct access to any files under WEB-INF so you can't reference that way.
I haven't tried this, but you may be able to get this to come up simply by creating a mapping. For example, in Spring 3.0, you could add the following to your controller config:
Then, you could try simply referencing it in your JSP as:
window.open("myChildWindow.htm","childWinName", <window properties>);
Out of the blue, but if you are using Spring 3.0 the MVC Namespace has a <mvc:controller> which does this trick of you map a URL, then it just passes it quickly through to a jsp page.