This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes problem in showing data on page after database retrival Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem in showing data on page after database retrival" Watch "problem in showing data on page after database retrival" New topic
Author

problem in showing data on page after database retrival

prasad hagargi
Ranch Hand

Joined: Oct 21, 2002
Posts: 36
hi,iam new to struts framework,
iam trying to display data fetched from database in a page contaning multiple textfields,when i try to call this page iam getting
"javax.servlet.ServletException: Cannot find bean org.apache.struts.taglib.html.BEAN in scope null"
execption.can anybody tell me what can be the problem.
action tag is
<action path="/getdetails" type="com.dpsl.dxdam.participant.actions.ParticipantAction" name="ParticipantForm" scope="request"input="/jsp/participant/participantdetails.jsp">
<forward name="success" path="/jsp/participant/participantdetails.jsp"/>
</action>
iam setting the values in textfield by
<html:text property="participantpolicyID"/>
iam calling the page by url
http://localhost:8080/dxdams1.0/getdetails.do?action=getdetails
what can be the problem ,please guide me
Lalitha Chandran
Ranch Hand

Joined: Jul 03, 2003
Posts: 92
Hi
One of the reasons why that exception is thrown might be
You might have placed a form element outside the form tag.
for example:
<html:form action="....">
</html:form>
<html:select property="..">
Maybe by looking at your action file or jsp code things could be clearer.
Lalitha
prasad hagargi
Ranch Hand

Joined: Oct 21, 2002
Posts: 36
thanks lalita,u were right,
can you tell me how i can highlight/keep the defualt option as selected as per the defualt value ie if my id=2 value of id =2 should behighlighted.
my code is :
<select id="selectedDate" name="selectedDate">
<logic:iterate id="row" type="com.dpsl.dxdam.util.UtilClass" collection="<%=colDevID%>" >
<option value='<bean:write name="row" property="partTypeID"/>'>
<bean:write name="row" property="particpantName"/></option>
</logic:iterate>
</select>
Lalitha Chandran
Ranch Hand

Joined: Jul 03, 2003
Posts: 92
Hi Prasad,
I am not quite sure if this piece of code works because you haven't specified the 'property' attribute for the select tag, which is required.
<select id="selectedDate" name="selectedDate">

So when you give a property attribute it has getter/setter methods within the particular bean- either <form-bean> or the bean specified by the name attribute of select tag.
You can set the default value by calling the setter method. For example
JSP:
<select id="selectedDate" property="date">
......
Action Form (let us call it DateForm)
....
private String date;
public String getDate()
{
return date;
}
public void setDate(String date)
{
this.date = date;
}

.....
Action file
DateForm d = (DateForm) form;
d.setDate("02/02/2003");

Hope this helps
Lalitha
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem in showing data on page after database retrival
 
Similar Threads
Getting the Parser Error struts
Help in struts
want help in iframe
Dispatch Action Issue/Exception
redirect="true" not working