Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to display output in the same page of imput

 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic