Monday, 15 February 2010

java - if condition in jsp does not work -



java - if condition in jsp does not work -

i using next if status not work.

when jsp page loaded output shown without checking condition.

the code expect receive values of form set them in obj property , send them xclass when result "o" received should should message.

my.jsp

<jsp:usebean id="obj" class="com.user"/> <jsp:setproperty property="*" name="obj"/> <% string myoutput = myclass.xclass(obj); out.print(myoutput); if(myclass.xclass(obj).equals("output")) { out.print("message goes here"); } %>

myclass.class

public string xclass(user obj){ homecoming "output"; }

in version2 have missed semicolon ;

string output = myclass.xclass(obj);

try print output values.try below code

if(output.trim().equalsignorecase(¨o¨)) { // message goes here }

java jsp if-statement struts2 javabeans

No comments:

Post a Comment