Help coderanch get a
new server
by contributing to the fundraiser

mohan kumar r

Ranch Hand
+ Follow
since Jan 19, 2006
Merit badge: grant badges
For More
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 mohan kumar r

is implicit constructor rule applicable for enum type?
below is the statement from Khalid A.Mughal's book

An implicit standard constructor is created if no constructors are provided for the enum type



but when i complied Meal.java(no explicit constructor provided) as below,



i got compilation error

can not find symbol :constructor Meal...(int,int)

Hi,
Long post but i want to explain the problem clearly so that i can get some help from you.

I am new to jasper.Trying to generate PDF for a webpage(TO provide printer friendly version in PDF to avoid browser dependencies).My problem is that some lines are missing while floating to next page.
How i am doing that?
I have around 70 elements on a webpage and the height of the Detail band is not sufficient to place all elements.So I am using group header and group footer so that I can place some of our detail elements on a special group header, some of them will probably remain on the detail section, and the rest could go on the group footer.i have started placing the elemets on Group Header ,and i expected the elements to flow(isSplit=true) to the next PDF page when they are not fit in current page.But when the end of the page is reached, subsequent elements are disappearing.In the PDF report i have attached,last line of the first page is

Name of regulatory authority of manager Rugulatroy Authority Value

The next line to be printed as a first line of the next page is

Please provide the licence number issued L1212122212121
by the
relevant regulatory authority

but this line is disappearing and the next line to be printed also missing some of its part.Please see the PDF and java programs attached.I have tried with isPrintWhenDetailOverflows but couldn't work.Depending on the data entered by the user for each field,last line of the page may differ but what expected is, It should flow to next page if it not fit in current page.

Please advice whethere there is any other way or am i doing anything wrong.

kindly ask me if you need more clarification about my problem.

Below is jrxml and java program.It is not allowing me to attach PDF file .

jrxml




Java Program



Thank you,
Regards,
Mohan
It seems the hash map 'names' is not available in the JSP. what is the data tranfer model you are using, is it data driven or model driven.

try below options.

If it is data driven, make sure that you have added getters and setters for your HashMap 'names'. See how you can access 'names' using OGNL in your JSP.
For Ex : <s:select name="Name" list="%{names}' ....

otherwise, just add your hashmap to session (your action class should be SessionAware).
And in your JSP..
<s:select name="Name" list="#session.names"> will do.
15 years ago
I am just writing my solution,helpful for others

If you are implementing PDF file download using struts2,below are the steps

1.in struts.xml or in respective module's struts configuration file

<action name="PDFReport_*" method="{1}" class="your Action Class">
<result name="success" type="stream">
<param name="contentType">application/pdf</param>
<param name="inputName">inputStream</param>
<param name="bufferSize">1024</param>
</result>
</action>
2. in your action class,define inputStream
private InputStream inputStream;
public InputStream getInputStream() {
return inputStream;
}
public void setInputStream(InputStream inputStream) {
this.inputStream = inputStream;
}

3. In the action,assign your stream data to this inputStream.If you are using jasper or some other API to generate PDF File,Those APIs may return PDF file to output stream.Ofcourse, you can write your PDF file to servlet output stream directly. Doing like this will work but you can see the exception 'response has already been committed'.

i have used jasper, So

public String actionDownload() throws Exception{
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Content-Disposition","attachment; filename=\"" + example.pdf+ "\"");
response.setHeader("Expires", "0");
response.setHeader("Cache-Control",
"must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma", "public");

ByteArrayOutputStream baos = new ByteArrayOutputStream();
JasperPrint jp =JasperFillManager.fillReport(....somestuff....);
JasperExportManager.exportReportToPdfStream(jp,baos);
response.setContentLength(baos.size());
ByteArrayInputStream bis=new ByteArrayInputStream(baos.toByteArray());
inputStream = bis;
return "success"
}

15 years ago
Hi,
we are using Jasper to generate PDF and user can download by clicking on a link.

struts config as below

<result name="success" type="stream">
<param name="contentType">application/pdf</param>
<param name="contentDisposition">filename="document.pdf"</param>
</result>

Inside Action class

JasperExportManager.exportReportToPdfStream(jp,response.getOutputStream());

we have two problems,

1. If the contentDisposition is 'inline',If the PDF file is of bigger sige,the file is not downloading properly, I mean downloaded file contains some binary value like Ċ��c�eF7. But if the contentDisposition is attachement, File is downloading properly.
2. We can see some exception

[2/24/09 18:53:40:362 SGT] 00000027 WebApp E [Servlet Error]-[Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.]: java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.at org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:189)


Please advise.

15 years ago
Hi,
i am also getting the same error Error 404: SRVE0190E: File not found.But the application is working fine.My problem is that,this error is being displayed at the left corner of every page.
Please suggest.
15 years ago
Hi,
Query related to strut2 framework.
we have some fields in a JSP which are already filled in and disabled on form-load.we are using 'ModelDriven' approach for data transfer and validations are in XML file.

On form load, data is as below

User Name :ABC --> disabled
password:_________

after user enters the password and validating the data, no data populated for user name and the text box is empty with disabled.

user name: no data --> disabled
password : ***** error message : password should be alphanumberic

If the input field is disabled,data is not being populated after validation but it is working fine if the field is 'read only'.
Is it struts2 limitation. Please advice.

Thank you
Mohan
15 years ago
Others are subclasses of RuntimeException that your program is expected to catch. Your program is catching becuase you did a mistake while programming and your program is throwing those exceptions.

StackOverFlowError is a subclass of java.lang.Error( refer API tree) .Represents system errors that your program is not expected to catch.So who will catch and throw that exception if there is any such errors,the JVM
Hi,
portal framework you are using may stop/override download popup window. If i am not wrong every window is a part of framework once you integrate your application with framework.I have faced the same problem once and i have a provision to specify not to dispaly pop up window in portal framework as below and that's solves the problem.
<a href="url?...&pCpslayout=false">payload</a>
16 years ago
Hi,
Is there any difference between database connection obtained using raw JDBC API ie without Weblogic Data Source and the Database Connection obtained from Weblogic Datasource.

During the execution of some bulk JOB, I found that transactions over direct connection is much faster than that of connection from datasource.

please enlighten me.

Thank you,
Regards,
Mohan
Hi,
If i am not wrong, JNDI name spcae(or tree) is same(share) for different clusters in the same server domain.If this is true,when i am trying to access EJB that is deployed in different cluster within the same domain, i am getting NameNotFoundException.In client application, i just inclded ejb jar and ejb-ref in deployment descriptors(web.xml,weblogic.xml).Please advice.

thank you,
Mohan
Is there any restriction on the length of Mq message header?I am trying to add a value to the Mq message header 'message id' but while retrieving i am not getting the complete message id whch i have set .
16 years ago
Hi Chris,
try this(with and witout finally block).Now the difference is obvious.

public static void main(String[] args) {
try{
System.out.println("before call");
TRYCATCH.method();

}catch(Exception e){
System.out.println(e.getMessage());
}

}
private static void method() throws Exception
{
try {
FileInputStream fis = new FileInputStream(new File("c:/abc.txt"));
}
catch (Exception e) {
throw new Exception("Foobar");
}
//finally {
System.out.println("here");
//}
}
}
16 years ago
try this(asume there is no file abc.txt)

public class TRYCATCH {
public static void main(String[] args) {
try{
System.out.println("before call");
TRYCATCH.method();
}catch(Exception e){
System.out.println(e.getMessage());
}
}
private static void method()
{
File f = new File("c:/abc.txt");
try{
System.out.println("===before fis====");
FileInputStream fis = new FileInputStream(f);
System.out.println("===after fis====");
return;
}
catch(Exception e){
System.out.println("===in catch====");
return;
}finally{
try{
FileInputStream fis = new FileInputStream(f);
System.out.println("===in finally====");
return;
}catch(Exception e){
System.out.println("===inside finally catch====");
}
}

}
}
16 years ago
you can also add jar in CLASSPATH entry of the server you are using.
for example,if you are using weblogic server and Oracel DB,
add classes12.jar to CLASSPATH entry in driver:\bea\user_projects\domains\mydomain\startManagedWebLogic.cmd(or .sh if it is in unix).
restart the server
deploy the application