File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Call JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Call JSP page" Watch "Call JSP page" New topic
Author

Call JSP page

jay yu
Greenhorn

Joined: Oct 23, 2011
Posts: 3
Hi there, quick question

how can I call a jsp page from anther jsp page?

I have a simple math calculation jsp page (A.jsp) and i want another tester jsp page (T.jsp) to call A.jsp a multiple times, but each time i want T.jsp to wait until the calculation is done before calling A.jsp the second time. what is the best way to do?
also I want to pass some random number to the A.jsp.

many thanks.
Jay
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61421
    
  67

Except for the "wait" part (which makes no sense -- JSPs execute sequentially just like any other code), it sounds like you want to create a tag file or a custom tag.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jay yu
Greenhorn

Joined: Oct 23, 2011
Posts: 3
Bear Bibeault wrote:Except for the "wait" part (which makes no sense -- JSPs execute sequentially just like any other code), it sounds like you want to create a tag file or a custom tag.


no i don't want to create a tag file or custom tag. so it is possible to call another JSP file and wait til it finished?
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3166
    
  47

jay yu wrote:so it is possible to call another JSP file and wait til it finished?

No. As Bear said, it doesn't make any sense. If what you need is performing some calculation after the page has rendered, JavaScript might be the best way to go.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
jay yu
Greenhorn

Joined: Oct 23, 2011
Posts: 3
Devaka Cooray wrote:
jay yu wrote:so it is possible to call another JSP file and wait til it finished?

No. As Bear said, it doesn't make any sense. If what you need is performing some calculation after the page has rendered, JavaScript might be the best way to go.


right,i know what you mean now. first i have to use JSP, and second mostly i am just calling for testing purpose to see how long does it take to call 10K times, so actually i don't need to have the calculation but for the performance test i want to wait unti the calculation is done before calling another one that's all. am i making sense now??
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18657
    
    8

Not really, no. If you do something 10,000 times in a row on a computer, it's hard NOT to do them sequentially.
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
jay yu wrote:
right,i know what you mean now. first i have to use JSP, and second mostly i am just calling for testing purpose to see how long does it take to call 10K times, so actually i don't need to have the calculation but for the performance test i want to wait unti the calculation is done before calling another one that's all. am i making sense now??


Yes, it is possible. Convert the A.jsp page into a servlet, says AServlet. The servlet must return a value. Run a for loop in a test app to invoke AServlet multiple times sequentially, make sure to check the response from AServlet for each invocation. If the servlet returns a valid response, run the next invocation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Call JSP page