• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

By using display tag

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,I have a small requirement.My application needs to display the database values by using the display tag in a JSP page.But ,I have to show the sample screens using display tag but without the database. Coud you please tell me How can I do that even with manual written values?
Thanks in advance
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi chinna,

use your servlet (or action or controller or...) to put some dummy data in the scope you want (request, session or context).

Do you use any framework other than display-tag?

Herman
 
suresh sai
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI, Thanks for your response.I am using struts frame work in RAD tool.
Could you please tell me how can I do that one?
 
suresh sai
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here I am showing my sample code.

In Jsp Page....

<display:table class="com.myproject.mywork.MyAction" id="row">
<display:column property="accountNO"/>
</display:table>

In MyAction....(here MyAction is my one of the controller component)

class MyAction extends Action
{

execute()
{
ArrayList accountNO=new ArrayList();
accountNo.add("55236");

}

}


Here I am showing the code abstractly....with this code my project is not working.when I remove display tag its working fine but I need this using display tag.
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi chinna,

OK, Struts it is then.

Your action should put the list in a scope

The JSP does not need to know the class of this list, just the name.
(where did you find an example like this?)

Typically, there are 4 steps

1-you make a domain object class,
like Account
int accountNo
String accountName

2-put some Account objects with the dummy data in a List

3-add the list to a scope
like: request.setAttribute("myList", myList);

4-add to the JSP if you want to see all properties:
<display:table name="myList" />

Herman
See http://displaytag.sourceforge.net/11/tut_basic.html for more examples
 
suresh sai
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Herman.I got it.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic