• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

calling a jsp without using a controller

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I have a 2 JSPs.

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.

Is it possible?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"pica choo",
Please check your Private Messages for an important administrative matter.
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

The error says something like this : "reference not found".
The URL of the child window is : localhost://myProj/myChildWindow.jsp

usually. when i go to a page using a controller, the url would look like this :
localhost://myProj/myPage.htm

 
Mark Secrist
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>);
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic