Isuru Jay

Greenhorn
+ Follow
since May 09, 2012
Isuru likes ...
Spring Java Ubuntu
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Isuru Jay

I want to define a property in Struts1 configuration file to use inside the same config file.

As an example,

Define the property



Use the property value



Is there a possibility to do so in struts1.

Thanks.
1 year ago
Thanks Roel. yes, that's what I was looking for. Thank you very much.

And one more thing

If I follow this way, will it be a issue with the performance when retrieving records from these tables?
Actually I need a very good performance while searching the products.
Could you please suggest any improvements for this product table.

Thanks and Regards,
Isuru

Hi,

I am designing a database to store Electric and electronic products. As different products have lot of different features I have a table call "Product" to store common features and product specific tables to stare its own features.

Here I consider about 3 tables
1. Product - common features
2. TV - television specific features
3. Fridge - fridge specific features

I have attached an image and it will be clear I think.

My problem is how to implement it in hibernate? The issue is here product table have a relationship with either Fridge or TV table.

Can somebody help me to solve this?

thanks...


Hi,

I am working with a web application and it is running on a mobile browsers too. For counting the number of requests every jsp page connect with a another server and count the request.

Like this <img width="1" height="1" alt="tag" src="http://www.aaabbb.com" />

Sometimes jsp page cannot connect with the server and jsp page continuously try to connect with the server until the global timeout. But in this point if the jsp page cannot connect with the server I need to stop trying to connect. I can't use javascript for that as some old mobile browser don't support javascript. Is it possible to set timeout from that event or should I need to do something else?

Please be kind enough to help me to solve this.

Thanks...
9 years ago
JSP
You are welcome buddy. but as Piyush said it is better not to do cording in your jsp file. It will damage your MVC architecture.
9 years ago
JSP
Done and thanks Rob. Here I used struts for my front end. above method is called from the action class and that action class forward to a jsp file. What i did was just return null from the action class. Now it is ok. Thanks again
9 years ago
Use this buddy

String date1 = "10-05-2012";
String date2 = "06-06-2012";

SimpleDateFormat sim = new SimpleDateFormat("dd-MM-yyyy");

Calendar calendar = Calendar.getInstance();
Calendar calendar2 = Calendar.getInstance();

try {

calendar.setTime(sim.parse(date1));
calendar2.setTime(sim.parse(date2));

while(calendar.compareTo(calendar2)<=0){
System.out.println(sim.format(calendar.getTime()));
calendar.add(Calendar.DATE, 7);
}



} catch (ParseException e) {
e.printStackTrace();
}
9 years ago
JSP
Yes. you must check it is not null before you pass that value to that kind of operation. And are you sure you are passing a number through the request. so better to add a catch block as follow.

try{
idepo = Integer.parseInt(depo);
ilastdepo = Integer.parseInt(lastdepo);
}catch(Exception e){
}
9 years ago
JSP
Hi,

I'm working with java 1.5 and jasperreports-2.0.1. While generating a report I'm getting some errors but output report is generated without an issue for all html,csv and excel format. but bottom of the report error message is displayed. " Error 500: Cannot forward. Response already committed ".
This happens in websphere only. I'm using tomcat 5.5 too. In tomcat no errors will be displayed nor on the report.

This is the code I'm using for generating csv report.


public void genReportCSVFormat(ServletContext application,String filename,
Map customParams, HttpServletResponse response,String outputFileName){

Connection con = null;
try {
con = getConnection();
File reportFile = new File(application
.getRealPath(IReportConstant.JASPER_COMPILE_PATH + filename));

JasperReport jasperReport = (JasperReport) JRLoader
.loadObject(reportFile.getPath());


JasperPrint jasperPrint = JasperFillManager.fillReport(
jasperReport, customParams, con);

JRCsvExporter csvExporter = new JRCsvExporter();
csvExporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER,
",");
csvExporter.setParameter(JRCsvExporterParameter.RECORD_DELIMITER,
"\n");
csvExporter.setParameter(JRCsvExporterParameter.JASPER_PRINT,
jasperPrint);
csvExporter.setParameter(JRCsvExporterParameter.OUTPUT_STREAM,
response.getOutputStream());

response.setContentType("application/csv");

response.setHeader("Content-Disposition", "inline; filename="+outputFileName);


csvExporter.exportReport();

} catch (Exception e) {
e.printStackTrace();
}
}

The error I'm getting in websphere log as follow.

[4/22/12 15:27:33:973 AST] 00000034 ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: action. Exception thrown : java.lang.IllegalStateException: Cannot forward. Response already committed.
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:148)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:989)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:930)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at com.affno.mob.common.filter.SessionCheckingFilter.doFilter(SessionCheckingFilter.java:151)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:761)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:673)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:498)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:96)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)



So please help me to solve this. Thanks...
9 years ago