Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in showing data on page after database retrival

 
prasad hagargi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic