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
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
What do you have so far? What specific problem(s) did you encounter writing the JSP page?
i want to display this retrieved user list to show on my jsp,so please guide me.
shekhar john
Ranch Hand
Joined: Feb 02, 2011
Posts: 34
posted
0
i tried it through property tag but it didnt show any output on my jsp page
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
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
Joined: Feb 02, 2011
Posts: 34
posted
0
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
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
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
Joined: Feb 02, 2011
Posts: 34
posted
0
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" %>
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
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
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
Joined: Feb 02, 2011
Posts: 34
posted
0
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
Joined: Feb 02, 2011
Posts: 34
posted
0
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
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
Somewhere there needs to be code that passes the "list" data structure from the Java code to the JSP, no?
shekhar john
Ranch Hand
Joined: Feb 02, 2011
Posts: 34
posted
0
have you any idea so please post the code
shekhar john
Ranch Hand
Joined: Feb 02, 2011
Posts: 34
posted
0
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
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
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
Joined: Feb 02, 2011
Posts: 34
posted
0
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
Joined: Feb 02, 2011
Posts: 34
posted
0
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
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
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.