Anjanaya swamy

Greenhorn
+ Follow
since Jun 14, 2012
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 Anjanaya swamy

hi Bill,

Could you please help me in solving the issue.
6 years ago
Hi Bill,

Thanks for the reply.

Yes i am using the portlet, and i am using the below in XML file.

<bean id="portletMultipartResolver"
class="org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="100000"/>
</bean>


Actually If i define the below mentioned field in partyRegnStepFour Bean ...its working fine...but if i moved to the sub bean after selecting the file ...the file name is not coming to the controller.

private CommonsMultipartFile documentSelected;
6 years ago
Hi Bill,


Thanks for the response and help to solve my issue in spring.

Actually i had already placed the below line in the form tag ...

enctype="multipart/form-data


As suggested i had also updated the form tag to normal input tag as below ...

<c:forEach var="document" items="${partyRegnStepFour.documentList}" varStatus="loopStatus">
<tr>
<td>
<input name="documentList[${loopStatus.index}].documentId}" value="${document.documentId}"/>
</td>
<td>
<input name="documentList[${loopStatus.index}].documentName}" value="${document.documentName}" />
</td>
<td>
<input name="documentList[${loopStatus.index}].mandatory}" value="${document.mandatory}" />
</td>
<td>
<input name="documentList[${loopStatus.index}].documentSelected}" value="${document.documentSelected}" type="file"/>
</td>
</tr>
</c:forEach>

The values are getting displayed...but the values are not going to the action method in the controller.

In the below action method the List<DocumentUpload> is coming as NULL.

The action method in the controller is as follows :

@ActionMapping(params = "actionParamRegisterNewParty=registerNewParty_Step4")
public void actionRegisterNewParty_Step4(@ModelAttribute("partyRegnStepFour") PartyRegnStepFour partyRegnStepFour, final BindingResult errors, final ExtendedModelMap model,
final ActionRequest actionRequest, final ActionResponse actionResponse) {

List<DocumentUpload> listFileUpload = partyRegnStepFour.getDocumentList();

if (listFileUpload != null && listFileUpload.size() > 0) {
System.out.println("frm listFileUpload---------------------------------");
for (DocumentUpload doc : listFileUpload) {
System.out.println(doc.getDocumentId());
System.out.println(doc.getDocumentName());
System.out.println(doc.getMandatory());
System.out.println(doc.getDocumentSelected().getOriginalFilename());
}

} else {
System.out.println("frm else --------------------------------------------------------------------------------------------------");
}
actionResponse.setRenderParameter("renderParamRegisterNewParty", renderResponseString);
}


Advance thanks for your help.
6 years ago
hi all,

I am trying to display the values from backing bean,but getting the error as below :

org.springframework.beans.NotReadablePropertyException: Invalid property 'documentList[0].documentSelected}' of bean class [com.elm.common.domain.PartyRegnStepFour]: Bean property 'documentList[0].documentSelected}' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?


the code is as follows :

The code in jsp is as follows :

<c:forEach var="document" items="${partyRegnStepFour.documentList}" varStatus="loopStatus">
<tr>
<td>
<form:input path="documentList[${loopStatus.index}].documentId}" />
</td>
<td>
<form:input path="documentList[${loopStatus.index}].documentName}" />
</td>
<td>
<form:input path="documentList[${loopStatus.index}].mandatory}"/>
</td>
<td>
<form:input path="documentList[${loopStatus.index}].documentSelected}" type="file"/>
</td>
</tr>
</c:forEach>


The code in the bean is as follows :

public class PartyRegnStepFour implements Serializable
{
private List<DocumentUpload> documentList;
setter and getter for the list.
}

The backing bean is as follows :

public class DocumentUpload implements Serializable {
private String documentName;
private String mandatory;
private String documentId;
private CommonsMultipartFile documentSelected;

setter and getter ....
}

In controller is :

@RequestMapping(params = "renderParamRegisterNewParty=registerNewParty_Step4")
public String methodStep4(@ModelAttribute PartyRegnStepFour partyRegnStepFour, final BindingResult errors,
final ExtendedModelMap model) {

List<DocumentUpload> listFileUpload = partyRegistrationService.populateDoumentList(partyRegnStepFour, errors, portletRequest);
model.put("partyRegnStepFour", partyRegnStepFour);
return "/party/Step4";
}


Thanks in advance for the help.
6 years ago
Hi All,

Please help me in solving the below issues, as i am unable to find the solution for the issue.

Thanks in advance.
7 years ago
Hi All,

I am displaying the searched fields in my app through ajax using display tag. When i click on the next bottom in pagination its displays the data in a saparate page ,instead of displaying on the same page. please suggest how to enable the pagination in display tag through ajax.

The code is of the display tag is as follows :
...
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
............

<display:table id="tfsRangeList" name="tfsRangeList" pagesize="10" excludedParams="*" export="false" requestURI="/searchNumber.action" class="tableFormat10">
<display:column property="customerName" title="Customer Name" ></display:column>
<display:column property="customerId" title="Customer ID" ></display:column>
<display:column property="reservationId" title="Reservation ID" ></display:column>
<display:column property="premiumNumber" title="Is Premium Number" ></display:column>
</display:table>
7 years ago
hi all,

i am trying to export the data into excel from struts 2. In my case excel is opening but no data is getting interested into the excel (blank excel sheet).

The code is struts.xml is as follows :

<action name="downloadReserveNumbersPri" class="com.wipro.vel.nmp.web.NMP.DownloadReserveAction">
<result name="success" type="stream">
<param name="contentType">application/vnd.ms-excel</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">attachment; filename="excelExport.xls"</param>
<param name="bufferSize">4096</param>
</result>
</action>

The code in the action class is as follows :

private InputStream inputStream;


public void exportExcel() throws Exception {

Map session = ActionContext.getContext().getSession();
FileOutputStream file = null;
file = new FileOutputStream("poi-test.xls");

List<SearchNumberDTO> outputCityAndRangeList=(List<SearchNumberDTO>)session.get("outputCityAndRangeList");
System.out.println("numberTypes--------------->"+outputCityAndRangeList.size());

HSSFWorkbook workbook = createWorkbook(outputCityAndRangeList);

ByteArrayOutputStream baos = new ByteArrayOutputStream();
workbook.write(file);
workbook.write(baos);
ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
inputStream = bis;


}


public HSSFWorkbook createWorkbook(List<SearchNumberDTO> totalSearchNumberDTO) throws Exception {

HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Reservation Details ");

HSSFCellStyle headerCellStyle = wb.createCellStyle();
HSSFFont boldFont = wb.createFont();
boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
headerCellStyle.setFont(boldFont);

HSSFRow row = sheet.createRow(0);
HSSFCell cell = row.createCell(0);
cell.setCellStyle(headerCellStyle);
cell.setCellValue(new HSSFRichTextString("Reservation Id"));
cell = row.createCell(1);
cell.setCellStyle(headerCellStyle);
cell.setCellValue(new HSSFRichTextString("Customer Name"));
cell = row.createCell(2);
cell.setCellStyle(headerCellStyle);
cell.setCellValue(new HSSFRichTextString("STD Code"));

for(int index=0;index < totalSearchNumberDTO.size(); index++){
row = sheet.createRow(index);
cell = row.createCell(0);
SearchNumberDTO searchNumberDTO = (SearchNumberDTO) totalSearchNumberDTO.get(index);
HSSFRichTextString reservationId = new HSSFRichTextString(searchNumberDTO.getReservationId());
cell.setCellValue(reservationId);
cell = row.createCell(1);
HSSFRichTextString customerName = new HSSFRichTextString(searchNumberDTO.getCustomerName());
cell.setCellValue(customerName);
cell = row.createCell(2);
HSSFRichTextString stdCode = new HSSFRichTextString(searchNumberDTO.getStdCode());
cell.setCellValue(stdCode);
cell = row.createCell(3);

}

return wb;
}


public InputStream getInputStream() {
return inputStream;
}


public void setInputStream(InputStream inputStream) {
this.inputStream = inputStream;
}


Please someone help me .

Thanks in advance.

7 years ago