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 how to display output in the same page of imput 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 "how to display output in the same page of imput" Watch "how to display output in the same page of imput" New topic
Author

how to display output in the same page of imput

Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Actually i'm new to Struts/JSP programming.

AS - Is:

This is basically stockApp. In this application from GUI perspective i have two JSPs one in which i'm giving an input of name of stock. In this example we have one static name "SUNW" after giving this as an input it use to display output in the next page.

To - Be:

My requirement is to diplay output in the same page of input. below the input section.

Code is attached below for the reference.

index.jsp (This is the page where user gives the input ("SUNW"))
======


Quote.jsp (This is the page where output in this case price of SUNW is being displayed)
=======

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Wrox Struts Application</title>
</head>
<body>
<table border="1" >
<tr>
<th> </th>
</tr>
<tr>
<th ><align="center">Wrox Application</th>
</tr>
<tr>
<th> </th>
</tr>
<tr>
<th> </th>
</tr>
<tr>
<th> </th>
</tr>
<tr>
<td>Current Price : <%= request.getAttribute("PRICE") %></td>
</tr>
<tr>
<th> </th>
</tr>

</table>
</body>
</html>



So as per the new reuireqment after user given an input and press submit end user should see the same page with upper portion of the page will have input details, after that there will be one horizontal line and below that output will be dispalyed.


Please guide me on this or refer me if any application is available on the internet.


Thanks in Advance.

Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Sorry formatted code for Quote.jsp is here.

Quote.jsp (This is the page where output in this case price of SUNW is being displayed)
=======

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

You can either do a normal submission and repaint the whole page including both the inputs and results, or use Ajax to fetch an HTML fragment to add to the DOM without a page refresh.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to display output in the same page of imput