Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Mahanth Kumar

Greenhorn
+ Follow
since Dec 10, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mahanth Kumar

Hi,

I read that when a thread calls join, it makes the currently running thread join after it. Please correct me if i am wrong here.

Now what happens if innocently the thread that is currently running calls join()?

I believe the scenario would roughly translate to "Thread.currentThread().join();"

I tried this in eclipse out of curiosity and it seems to me like the VM hung or something. There was a process running but i couldnt see anything on the console

If this is the case wouldnt it lead to catastrophic results in case in an application only one thread happens to be running at some point and it calls join()


Cheers
yes i did try adding a properties file...but that doesnt help either...here is the file
---------------------------------------------------------------------------
#sort.behavior=list
#sort.amount=list
#basic.empty.showtable=true
#basic.msg.empty_list=No results matched your criteria.
#paging.banner.placement=top
#paging.banner.onepage=<span class="pagelinks"></span>
export.types=csv excel xml
export.excel=true
export.csv=true
export.xml=true
export.excel.class=org.displaytag.export.excel.DefaultHssfExportView
# if set, file is downloaded instead of opened in the browser window
export.excel.filename=excel.xls
---------------------------------------------------------------------------

another seemingly bizzare thing i noticed was that the table wont show up on the jsp page if i change the action scope to session from request or even if i remove the attribute altogether
14 years ago
i am using display tag 1.1.1( http://displaytag.sourceforge.net/11/ )to display data and export data to an excel file in struts 1.2

though i am able to display the table successfully on the jsp page ...the excel file is empty

i have already tried configuring the export filter but that doesnt do a thing.

i have been trying to get this to work for the past 2 days in vain ...what am i missing???

my entire code:


welcome page:-------------------------------------

<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<html>
<head>
<title></title>

</head>
<body bgcolor="white">

<a href = "trialDo.do">link to the action</a>



</body>
</html>
---------------------------------------------------------------------------
destination page:---------------------------------------------------------
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@ page buffer = "16kb" %>

<html>

<body>


</br></br>
<display:table name = "tryForm.tryList" export = "true" id = "currrowobj">
<display:column property="name" title="Name"/>
<display:column property="desig" title = "Designation"/>



</display:table>





</body>



</html>


---------------------------------------------------------------------------
action and bean config in struts-config.xml:-------------------------------

<action-mappings>
<action
path="/trialDo"
type="trialpack.TrialAction"
name="tryForm"
scope="request"
>
<forward name = "success" path = "/pages/trialdispjsp.jsp"/>
</action>
</action-mappings>

<form-beans>

<form-bean
name="tryForm"
type="trialpack.TryForm"/>
</form-beans>

--------------------------------------------------------------------------

Action class:-------------------------------------------------------------

package trialpack;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
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;

public class TrialAction extends Action{

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{

TryForm tF = (TryForm)form;
List<TrialObj> tlist = new ArrayList<TrialObj>();
for(int i = 0; i < 5 ; i++){

TrialObj tB = new TrialObj();
String name = "Name"+i;
System.out.println(name);
tB.setName(name);
tB.setDesig(name);
tlist.add(tB);

}
tF.setTryList(tlist);

for(int i = 0; i < 5; i++)
{
System.out.println("hello");
System.out.println(tF.getTryList().get(i).getName());
}




return (mapping.findForward("success"));
}


}
---------------------------------------------------------------------------
formbean:------------------------------------------------------------------

package trialpack;

import java.util.List;

import org.apache.struts.action.ActionForm;

public class TryForm extends ActionForm{

private static final long serialVersionUID = 1L;
private List<TrialObj> tryList;


public List <TrialObj> getTryList() {
return tryList;
}
public void setTryList(List <TrialObj> tryList) {
this.tryList = tryList;
}




}
---------------------------------------------------------------------------

trialobj:------------------------------------------------------------------
package trialpack;

public class TrialObj {


private String name = "";
private String desig = "";


public String getDesig() {
return desig;
}
public void setDesig(String desig) {
this.desig = desig;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}


}


---------------------------------------------------------------------------
export filter config in web.xml:-------------------------------------------

<filter>
<filter-name>ResponseOverrideFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>


---------------------------------------------------------------------------
14 years ago
i need to pass an object(ArrayList) to an action class...

<html-el:hidden property = "arrayListOfEmpData" value = "${element.arrayList_Of_EmpData}"/>

<a href = "ExcelD.do?arrayList_Of_EmpData=arrayListOfEmpData">Report in Excel</a>

i tried the above but it throws the following exception...


exception

javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.IllegalArgumentException: argument type mismatch
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1656)
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1551)
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1580)
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:919)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:816)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
14 years ago