aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes how can i display my data on jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "how can i display my data on jsp page" Watch "how can i display my data on jsp page" New topic
Author

how can i display my data on jsp page

shekhar john
Ranch Hand

Joined: Feb 02, 2011
Posts: 38
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: 42918
    
  68
What do you have so far? What specific problem(s) did you encounter writing the JSP page?
shekhar john
Ranch Hand

Joined: Feb 02, 2011
Posts: 38
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: 38
i tried it through property tag but it didnt show any output on my jsp page
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
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: 38
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: 42918
    
  68
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: 38
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

Joined: Feb 02, 2011
Posts: 38
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: 42918
    
  68
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: 38
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: 38
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: 42918
    
  68
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: 38
have you any idea so please post the code
shekhar john
Ranch Hand

Joined: Feb 02, 2011
Posts: 38
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: 42918
    
  68
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: 38
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: 38
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: 42918
    
  68
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how can i display my data on jsp page