You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by carmi_cd <ca...@yahoo.com> on 2007/10/24 07:14:28 UTC
conditional statement in struts2
hi i'm new in struts 2..my question is how can i get a value from a member
variable of my action class and
evaluate it in my if-else-if statemet?
i try to code it but it doesn't evaluate properly..here is my exisiting
code.
<s:if test='"%{getPdfValue()}" == "0"'>
<s:div theme="ajax" id="reportPreview"
href="%{getReportNumber()}.action?reportId=%{getReportId()}"
cssStyle="componentHolder"
loadingText="Loading report... Please wait."
errorText="Unable to load report."
listenTopics="load_report_preview"
executeScripts="true">
Loading report... Please wait.
</s:div>
</s:if>
<s:else>
<s:div theme="ajax" id="reportPreview"
cssStyle="componentHolder"
loadingText="Loading PDF"
errorText="Unable to load report."
listenTopics="load_report_preview"
executeScripts="true">
<iframe id="pdf_container" name="pdf_container"
src="%{getReportNumber()}.action?reportId=%{getReportId()}"
width="800" height="600"/>
</s:div>
</s:else>
it supposed to display the genereated pdf inside the iframe if the
getPdfValue() method return
are not equal to 0. please help me its not evaluating properly..thanks in
advance.
--
View this message in context: http://www.nabble.com/conditional-statement-in-struts2-tf4682064.html#a13379191
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: conditional statement in struts2
Posted by "jignesh(india)" <ji...@aspl.in>.
As per my local set up here it is working ok.
I have taken local method in action class named getPdfValue()
public int getPdfValue() {
return 1;
}
and it is working ok.
Jignesh.
carmi_cd wrote:
>
> would this code function correctly..that if pdfValue==1 it will display an
> iframe containing a pdf generated from jasperreports else a strut div will
> be displayed containing an html format report?
>
> <s:if test="pdfValue==1">
> <iframe id="reportPreview" name="reportPreview"
> src="%{getReportNumber()}.action?reportId=%{getReportId()}"
> width="800" height="600"/>
> </s:if>
> <s:else>
> <s:div theme="ajax" id="reportPreview"
> href="%{getReportNumber()}.action?reportId=%{getReportId()}"
> cssStyle="componentHolder"
> loadingText="Loading report... Please wait."
> errorText="Unable to load report."
> listenTopics="load_report_preview"
> executeScripts="true">
> Loading report... Please wait.
> </s:div>
> </s:else>
>
> thanks again.
>
>
> jignesh(india) wrote:
>>
>> It's simple dude use s:if and s:else like mentioned below
>> <s:if test="pdfValue!=0">
>> if part
>> </s:if>
>> <s:else>
>> else part
>> </s:else>
>>
>> hope it will help u.........!
>> Regards,
>> Jignesh
>>
>>
>>
>>
>> carmi_cd wrote:
>>>
>>> hi i'm new in struts 2..my question is how can i get a value from a
>>> member variable of my action class and
>>> evaluate it in my if-else-if statemet?
>>>
>>> i try to code it but it doesn't evaluate properly..here is my exisiting
>>> code.
>>>
>>> <s:if test='"%{getPdfValue()}" == "0"'>
>>> <s:div theme="ajax" id="reportPreview"
>>> href="%{getReportNumber()}.action?reportId=%{getReportId()}"
>>> cssStyle="componentHolder"
>>> loadingText="Loading report... Please wait."
>>> errorText="Unable to load report."
>>> listenTopics="load_report_preview"
>>> executeScripts="true">
>>> Loading report... Please wait.
>>> </s:div>
>>> </s:if>
>>> <s:else>
>>> <s:div theme="ajax" id="reportPreview"
>>> cssStyle="componentHolder"
>>> loadingText="Loading PDF"
>>> errorText="Unable to load report."
>>> listenTopics="load_report_preview"
>>> executeScripts="true">
>>> <iframe id="pdf_container" name="pdf_container"
>>> src="%{getReportNumber()}.action?reportId=%{getReportId()}"
>>> width="800" height="600"/>
>>> </s:div>
>>> </s:else>
>>>
>>> it supposed to display the genereated pdf inside the iframe if the
>>> getPdfValue() method return
>>> are not equal to 0. please help me its not evaluating properly..thanks
>>> in advance.
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/conditional-statement-in-struts2-tf4682064.html#a13383571
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: conditional statement in struts2
Posted by SudarshanP <Su...@Satyam.com>.
With all due respect to roseindia.net, i would like to say that, the examples
given are vanilla which is good to know the concepts but actual development
code will be much complex
Deepak Kumar wrote:
>
> Please check http://www.roseindia.net/struts/struts2/struts-2-tags.shtml
>
> Thanks
>
>
> -----Original Message-----
> From: carmi_cd [mailto:carmi_dom@yahoo.com]
> Sent: Wednesday, October 24, 2007 2:47 PM
> To: user@struts.apache.org
> Subject: Re: conditional statement in struts2
>
>
>
> would this code function correctly..that if pdfValue==1 it will display an
> iframe containing a pdf generated from jasperreports else a strut div will
> be displayed containing an html format report?
>
> <s:if test="pdfValue==1">
> <iframe id="reportPreview" name="reportPreview"
> src="%{getReportNumber()}.action?reportId=%{getReportId()}"
> width="800" height="600"/>
> </s:if>
> <s:else>
> <s:div theme="ajax" id="reportPreview"
> href="%{getReportNumber()}.action?reportId=%{getReportId()}"
> cssStyle="componentHolder"
> loadingText="Loading report... Please wait."
> errorText="Unable to load report."
> listenTopics="load_report_preview"
> executeScripts="true">
> Loading report... Please wait.
> </s:div>
> </s:else>
>
> thanks again.
>
>
> jignesh(india) wrote:
>>
>> It's simple dude use s:if and s:else like mentioned below
>> <s:if test="pdfValue!=0">
>> if part
>> </s:if>
>> <s:else>
>> else part
>> </s:else>
>>
>> hope it will help u.........!
>> Regards,
>> Jignesh
>>
>>
>>
>>
>> carmi_cd wrote:
>>>
>>> hi i'm new in struts 2..my question is how can i get a value from a
>>> member variable of my action class and
>>> evaluate it in my if-else-if statemet?
>>>
>>> i try to code it but it doesn't evaluate properly..here is my exisiting
>>> code.
>>>
>>> <s:if test='"%{getPdfValue()}" == "0"'>
>>> <s:div theme="ajax" id="reportPreview"
>>> href="%{getReportNumber()}.action?reportId=%{getReportId()}"
>>> cssStyle="componentHolder"
>>> loadingText="Loading report... Please wait."
>>> errorText="Unable to load report."
>>> listenTopics="load_report_preview"
>>> executeScripts="true">
>>> Loading report... Please wait.
>>> </s:div>
>>> </s:if>
>>> <s:else>
>>> <s:div theme="ajax" id="reportPreview"
>>> cssStyle="componentHolder"
>>> loadingText="Loading PDF"
>>> errorText="Unable to load report."
>>> listenTopics="load_report_preview"
>>> executeScripts="true">
>>> <iframe id="pdf_container" name="pdf_container"
>>> src="%{getReportNumber()}.action?reportId=%{getReportId()}"
>>> width="800" height="600"/>
>>> </s:div>
>>> </s:else>
>>>
>>> it supposed to display the genereated pdf inside the iframe if the
>>> getPdfValue() method return
>>> are not equal to 0. please help me its not evaluating properly..thanks
>>> in
>>> advance.
>>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/conditional-statement-in-struts2-tf4682064.html#a13382
> 105
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/conditional-statement-in-struts2-tf4682064.html#a13724734
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: conditional statement in struts2
Posted by Deepak Kumar <de...@roseindia.net>.
Please check http://www.roseindia.net/struts/struts2/struts-2-tags.shtml
Thanks
-----Original Message-----
From: carmi_cd [mailto:carmi_dom@yahoo.com]
Sent: Wednesday, October 24, 2007 2:47 PM
To: user@struts.apache.org
Subject: Re: conditional statement in struts2
would this code function correctly..that if pdfValue==1 it will display an
iframe containing a pdf generated from jasperreports else a strut div will
be displayed containing an html format report?
<s:if test="pdfValue==1">
<iframe id="reportPreview" name="reportPreview"
src="%{getReportNumber()}.action?reportId=%{getReportId()}"
width="800" height="600"/>
</s:if>
<s:else>
<s:div theme="ajax" id="reportPreview"
href="%{getReportNumber()}.action?reportId=%{getReportId()}"
cssStyle="componentHolder"
loadingText="Loading report... Please wait."
errorText="Unable to load report."
listenTopics="load_report_preview"
executeScripts="true">
Loading report... Please wait.
</s:div>
</s:else>
thanks again.
jignesh(india) wrote:
>
> It's simple dude use s:if and s:else like mentioned below
> <s:if test="pdfValue!=0">
> if part
> </s:if>
> <s:else>
> else part
> </s:else>
>
> hope it will help u.........!
> Regards,
> Jignesh
>
>
>
>
> carmi_cd wrote:
>>
>> hi i'm new in struts 2..my question is how can i get a value from a
>> member variable of my action class and
>> evaluate it in my if-else-if statemet?
>>
>> i try to code it but it doesn't evaluate properly..here is my exisiting
>> code.
>>
>> <s:if test='"%{getPdfValue()}" == "0"'>
>> <s:div theme="ajax" id="reportPreview"
>> href="%{getReportNumber()}.action?reportId=%{getReportId()}"
>> cssStyle="componentHolder"
>> loadingText="Loading report... Please wait."
>> errorText="Unable to load report."
>> listenTopics="load_report_preview"
>> executeScripts="true">
>> Loading report... Please wait.
>> </s:div>
>> </s:if>
>> <s:else>
>> <s:div theme="ajax" id="reportPreview"
>> cssStyle="componentHolder"
>> loadingText="Loading PDF"
>> errorText="Unable to load report."
>> listenTopics="load_report_preview"
>> executeScripts="true">
>> <iframe id="pdf_container" name="pdf_container"
>> src="%{getReportNumber()}.action?reportId=%{getReportId()}"
>> width="800" height="600"/>
>> </s:div>
>> </s:else>
>>
>> it supposed to display the genereated pdf inside the iframe if the
>> getPdfValue() method return
>> are not equal to 0. please help me its not evaluating properly..thanks in
>> advance.
>>
>
>
--
View this message in context:
http://www.nabble.com/conditional-statement-in-struts2-tf4682064.html#a13382
105
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: conditional statement in struts2
Posted by carmi_cd <ca...@yahoo.com>.
would this code function correctly..that if pdfValue==1 it will display an
iframe containing a pdf generated from jasperreports else a strut div will
be displayed containing an html format report?
<s:if test="pdfValue==1">
<iframe id="reportPreview" name="reportPreview"
src="%{getReportNumber()}.action?reportId=%{getReportId()}"
width="800" height="600"/>
</s:if>
<s:else>
<s:div theme="ajax" id="reportPreview"
href="%{getReportNumber()}.action?reportId=%{getReportId()}"
cssStyle="componentHolder"
loadingText="Loading report... Please wait."
errorText="Unable to load report."
listenTopics="load_report_preview"
executeScripts="true">
Loading report... Please wait.
</s:div>
</s:else>
thanks again.
jignesh(india) wrote:
>
> It's simple dude use s:if and s:else like mentioned below
> <s:if test="pdfValue!=0">
> if part
> </s:if>
> <s:else>
> else part
> </s:else>
>
> hope it will help u.........!
> Regards,
> Jignesh
>
>
>
>
> carmi_cd wrote:
>>
>> hi i'm new in struts 2..my question is how can i get a value from a
>> member variable of my action class and
>> evaluate it in my if-else-if statemet?
>>
>> i try to code it but it doesn't evaluate properly..here is my exisiting
>> code.
>>
>> <s:if test='"%{getPdfValue()}" == "0"'>
>> <s:div theme="ajax" id="reportPreview"
>> href="%{getReportNumber()}.action?reportId=%{getReportId()}"
>> cssStyle="componentHolder"
>> loadingText="Loading report... Please wait."
>> errorText="Unable to load report."
>> listenTopics="load_report_preview"
>> executeScripts="true">
>> Loading report... Please wait.
>> </s:div>
>> </s:if>
>> <s:else>
>> <s:div theme="ajax" id="reportPreview"
>> cssStyle="componentHolder"
>> loadingText="Loading PDF"
>> errorText="Unable to load report."
>> listenTopics="load_report_preview"
>> executeScripts="true">
>> <iframe id="pdf_container" name="pdf_container"
>> src="%{getReportNumber()}.action?reportId=%{getReportId()}"
>> width="800" height="600"/>
>> </s:div>
>> </s:else>
>>
>> it supposed to display the genereated pdf inside the iframe if the
>> getPdfValue() method return
>> are not equal to 0. please help me its not evaluating properly..thanks in
>> advance.
>>
>
>
--
View this message in context: http://www.nabble.com/conditional-statement-in-struts2-tf4682064.html#a13382105
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: conditional statement in struts2
Posted by "jignesh(india)" <ji...@aspl.in>.
It's simple dude use s:if and s:else like mentioned below
<s:if test="pdfValue!=0">
if part
</s:if>
<s:else>
else part
</s:else>
hope it will help u.........!
Regards,
Jignesh
carmi_cd wrote:
>
> hi i'm new in struts 2..my question is how can i get a value from a
> member variable of my action class and
> evaluate it in my if-else-if statemet?
>
> i try to code it but it doesn't evaluate properly..here is my exisiting
> code.
>
> <s:if test='"%{getPdfValue()}" == "0"'>
> <s:div theme="ajax" id="reportPreview"
> href="%{getReportNumber()}.action?reportId=%{getReportId()}"
> cssStyle="componentHolder"
> loadingText="Loading report... Please wait."
> errorText="Unable to load report."
> listenTopics="load_report_preview"
> executeScripts="true">
> Loading report... Please wait.
> </s:div>
> </s:if>
> <s:else>
> <s:div theme="ajax" id="reportPreview"
> cssStyle="componentHolder"
> loadingText="Loading PDF"
> errorText="Unable to load report."
> listenTopics="load_report_preview"
> executeScripts="true">
> <iframe id="pdf_container" name="pdf_container"
> src="%{getReportNumber()}.action?reportId=%{getReportId()}"
> width="800" height="600"/>
> </s:div>
> </s:else>
>
> it supposed to display the genereated pdf inside the iframe if the
> getPdfValue() method return
> are not equal to 0. please help me its not evaluating properly..thanks in
> advance.
>
--
View this message in context: http://www.nabble.com/conditional-statement-in-struts2-tf4682064.html#a13379510
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org