File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i display my data on jsp page

 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi to all,
i m new to struts2,jpa and i retrieved the data from database and i want to show it on my jsp page ,so please help me toprint the data on jsp page.
my action class is:-
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you have so far? What specific problem(s) did you encounter writing the JSP page?
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to display this retrieved user list to show on my jsp,so please guide me.
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried it through property tag but it didnt show any output on my jsp page
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can't speculate on what might be happening without seeing the JSP code. You might also want to check the server log files to make sure there aren't any exceptions.

By the way, please UseCodeTags (like I have added now) when posting code of any length. It's unnecessarily hard to read the code otherwise, making it less likely that people will bother to do so.
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is no problem in action class it is executing fine and displying all system.out.printn messaages in my command prompt and also showing the result jsp page ,i have just a problem to show this user list on my jsp page .
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's what I understood, but we can't tell what might be happening in the JSP page without seeing its code.
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its my jsp :-
<%@ page language="java" contentType="text/html" import="java.util.*"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib prefix="s" uri="/struts-tags" %>


<s:textfield label="firstname"/>
<s:form action="addregister" validate="true">

<ul>
<s:iterator value="iterator">
<li><s:property/></li>
</s:iterator>
</ul>
<s:submit value="Register"/>

</s:form>
</div>
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on my jsp page only text field is created but there is no list on page.
if you have any idea please give me .


thanks in advance
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. Now where do you think that JSP should output something? And where in the Java code do you think you're instructing it what to pass to the JSP page?
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in action class i have mentioned in result tag which jsp has to open ,
the text field i have added just to check jsp page.
and i just want to show this list of user which i have retrieved from database i.e. list of my action class.
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have used tiles plugin in this apppln
and the textfield is also shown by my browser .please guide me to show the user list on my jps page
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somewhere there needs to be code that passes the "list" data structure from the Java code to the JSP, no?
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you any idea so please post the code
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have take some ejb changes but unable to display the result on jsp page if any idea you have give me its urgent
my corrected action class is:-



 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still don't see anything that would pass the query results to the JSP page. A Struts2 tutorial might help with that.

By the way, why is the create method static? That looks like a potential thread-safety issue.

(I also see nothing related to EJBs -which you said you changed something about- but that's irrelevant to the problem at hand.)
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m using a rest plugin in my project thats why i put it static my problem is to display

here User.class is my bean name and 11 is my value of id field.
this user i want to display on my jsp page.
 
shekhar john
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my bean User:-.



just in simple ,i want to retrieve any field through only jpa and display it on jsp page if you have any idea please post me.

 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it would be a good idea to study the Struts2 documentation on how to pass Java objects to JSP pages; the details of the object are immaterial.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic