| Author |
javax.servlet.jsp.JspException: No getter method available for property label for bean undername Sc1
|
Eshwin Sukhdeve
Ranch Hand
Joined: Mar 15, 2012
Posts: 78
|
|
Hi,
I am getting the above Exception.I have checked in coderanch but I didn't get the solution.(Sc1 is value which I am adding in ArrayList)
JSP Page
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head>
<script type="text/javascript">
function populateValue()
{
document.forms[0].action = "opsPath.do?method=getDropDownValue";
document.forms[0].submit();
}
function submitForm()
{
document.forms[0].action = "opsPath.do?method=authWorkFlow";
document.forms[0].submit();
}
</script>
</head>
<body onload="populateValue()">
<html:form action="/opsPath">
<table width=100%>
<tr>
<td align="right">
Select Script
</td>
<td align="left">
<html:select property="select1" size="">
<html ptionsCollection name="OpsForm" property="scriptlist"/>
</html:select>
</td>
<tr>
<td align="right">
Enter argumnets
</td>
<td align="left">
<html:text property="text1"></html:text>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<html:submit value="Submit" onclick="submitForm()"/>
</td>
</tr>
<tr align="center">
<td>
High Level Log details
</td>
<td>
Low Level Log Details
</td>
</tr>
<tr align="center">
<td>
<html:textarea property="highLog" value="">
</html:textarea>
</td>
<td>
<html:textarea property="lowLog" value="">
</html:textarea>
</td>
</tr>
</table>
</html:form>
</body>
</html>
Struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="OpsForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="select1" type="java.lang.String" />
<form-property name="text1" type="java.lang.String" />
<form-property name="highLog" type="java.lang.String"/>
<form-property name="lowLog" type="java.lang.String"/>
<form-property name="scriptlist" type="java.util.ArrayList"/>
</form-bean>
</form-beans>
<global-forwards>
<forward name="opsPath" path="/opsPath.do"/>
</global-forwards>
<action-mappings>
<action path="/opsPath" type="com.verizon.uis.TestAction" name="OpsForm" parameter="method" scope="request">
<forward name="success1" path="/Ops.jsp" />
<forward name="success2" path="/Ops.jsp" />
<forward name="success3" path="/Ops.jsp" />
<forward name="success4" path="/Ops.jsp" />
</action>
</action-mappings>
</struts-config>
Action class
package com.verizon.uis;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction;
public class TestAction extends DispatchAction {
public ActionForward authWorkFlow(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward("success1");
}
public ActionForward GenWorkFlow(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward("success2");
}
public ActionForward testFlow(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward("success3");
}
public ActionForward getDropDownValue(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
{
DynaActionForm dy=(DynaActionForm)form;
ArrayList list=new ArrayList();
list.add("Sc1");
list.add("Sc2");
System.out.print("hi--------------------------------------------");
dy.set("scriptlist",list);
// request.setAttribute("scriptList",list);
return mapping.findForward("success4");
}
}
|
 |
jatan bhavsar
Ranch Hand
Joined: Jul 23, 2008
Posts: 296
|
|
Hi Eshwin,
It seems the tag you have used htmloptionscollection is not proper as there should be lable attribute .
Good Explanation is given here http://www.coderanch.com/t/52918/Struts/html-select-html-options
Another recent post is http://www.coderanch.com/t/589313/Struts/HashMap-Display-Default-value
Try using:
<s:select list="searchEngine" name="" value="" />
Regards
jatan
|
 |
 |
|
|
subject: javax.servlet.jsp.JspException: No getter method available for property label for bean undername Sc1
|
|
|