This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 with Display tag issue

 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to the Sturts2 and Displaytag.

I have configured it to use the displaytag.

What I did is :

I have added the follwoing displaytag jars in WEB-INF/lib and added them to buildpath
displaytag-1.2.jar
displaytag-export-poi-1.2.jar
displaytag-portlet-1.2.jar

In action class added a method ArrayList<ForbesData> getForbesList() which return the ArrayList<ForbesData> data.

ForbesData class is


I have onmore java class


In struts.xml I have configured action class LoginAction .

In jsp I added


When I try to see the my table after running the program I am getting exception.
I am not able to find any help from net as all examples are shown as per sturts1.x




Can some one please help what Am I missing here.
 
Niiraj Patel
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amruth,

The issue is with struts action class: LoginAction.

Fact about Struts 2.0 : Your class must inherite Struts library class: com.opensymphony.xwork2.ActionSupport to become a legal Struts Action class.

Your LoginAction's pseudo code should be like :



I have attached eclipse project which uses struts 2, display tag lib 1.2 and apache 6.0.
Import it in eclipse and run.

I have used below jar files.


To test it type like: http://localhost:8080/VPM_F/UserLogin.action
It will hit your action and popup the table.

--Niraj
VPM_F.jpg
Rename above file to VPM_F.zip and extract it.
[Thumbnail for VPM_F.jpg]
 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Niraj for the reply.

Now I have extended my class



my sturts.xml is


still I get the exception


Please help where Am I missing things
 
Niiraj Patel
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amruth,

Its hard to say from log what you are missing. Can you tell me which jars are you using?
The quick fix is, Run my project in your eclipse and try to merge your part in that.

Thanks
Niraj patel
 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Niraj,

Thanks so much.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic