jsp - How to check if my value is null or empty? -
jsp - How to check if my value is null or empty? -
in jsp code have following:
<s:iterator value="details" id="cle" status="rowcle"> <s:iterator value="value" status="row" > <tr> <s:if test="%{#surname== ''}"> <td> </td> </s:if> <s:else> <td class="reference"><s:property value="%{gettext(key.longname.tolowercase()) }" /></td> </s:else>
depending on value of surname (which field getter in object details, in value stack) want display value longname or blank.
i have no problem display {gettext(key.longname.tolowercase()), display surname later in code, concern testing content of surname check if null or empty.
i have tried several options such
"%{#surname== ''}"> %{surname== null}'> '%{#surname== null}'>
but none works.
i bit lost. have solution please?
thank you. b.
jsp struts2 jsp-tags share|improve question asked jun 20 '14 @ 10:47 ecoli 377 1surname == null || surname == ''
. – aleksandr m jun 20 '14 @ 10:51 very fast answer! give thanks you. works. think time me dig concepts of using # or { or nil because lost. – ecoli jun 20 '14 @ 10:59 add comment | 3 answers 3 active oldest votes up vote 1 down vote accepted its improve using validation.so these validation codes removed view layer(jsp). can inherit method validate() action class extending actionsupport. add together validation codes here.if validation grab error show above jsp page textbox.
share|improve answer answered jun 22 '14 @ 4:26 afsal parangooz 1225 of course!! how should it. read , totally forgot it. give thanks reminding me right way it. – ecoli jun 23 '14 @ 17:54 you welcome :) – afsal parangooz jun 24 '14 @ 4:55 add comment | var ados = ados || {}; ados.run = ados.run || []; ados.run.push(function () { ados_add_placement(22,8277,"adzerk621423366",4).setzone(44); }); up vote 1 down voteso wrote code:
<s:if test="%{ (surname!=null) && (!surname.isempty()) }">
and inverted content of if , else, test opposite.
no need #
or {....
because surname in value stack straight accessible.
the “debug” tag useful debugging tag output content of “value stack” , “stack context” details in web page
for more reference u may see link debugging struts <s:debug />
in body
sign using google
sign using facebook
sign using email , password
post guest name email stackexchange.ready( function () { stackexchange.openid.initpostlogin('.new-post-login', 'http%3a%2f%2fstackoverflow.com%2fquestions%2f24325529%2fhow-to-check-if-my-value-is-null-or-empty%23new-answer', 'question_page'); } ); post guest name email discardposting answer, agree privacy policy , terms of service.
not reply you're looking for? browse other questions tagged jsp struts2 jsp-tags or ask own question.asked
1 year ago
viewed
292 times
active
1 year ago
blog 2016 stack overflow developer survey results var ados = ados || {}; ados.run = ados.run || []; ados.run.push(function () { ados_add_placement(22,8277,"adzerk2044891134",[5,17,2221]).setzone(45); }); ;"use strict";var _extends=object.assign||function(n){for(var i,r,t=1;t0&&(n.tags=i.join(";"))),n}function k(n){return n.innerhtml.replace(/\s+$/g,"")}function st(n,t,i,u){var c=r(n);if(c===null)return function(){};var h=null,e=null,l=f(),a=function a(){k(c)?(s(h),u(!1,f()-l)):e=o(a,t)};return e=o(a,t),i&&(h=o(function(){s(e);u(!0,f()-l)},i)),function(){s(e);s(h)}}function ht(){var t="careers1",i="careers3",u=e.hash.indexof("large=1")!==-1||!g()||r("#careersadsdoublehigh"),f=u?1:2,n=[f+"=hireme"];return r("#"+t)&&n.push("5="+t),r("#"+i)&&n.push("6="+i),n.join("&")}function d(n,i){var r=ot(_extends({},nt,{zones:ht()})),u,e;n&&(r.azt=1);i&&(r.lw=i);typeof t.innerwidth=="number"&&(r.bw=t.innerwidth);u=["zones","ip","ac","eng","prov","tags","theme","at","remote","seed","lw","azt","sysadmin","bw","nocpm","jobview","cpview"];e=l+"?"+ft(r,u);c=f();p(e)}function ct(n){function h(){u.foreach(w);e.foreach(function(n){lt(n,i[n],s,o)});typeof t.clc_after_load=="function"&&t.clc_after_load()}var i=n.cr,r=n.h,u=n.st,e=object.keys(i),o=c?f()-c:0,s="//"+r+"/ct";h()}function lt(n,t,i,f){var h=t.cl,c=t.cn,o=t.an,l=t.utm,s=(h||[]).join(" "),e=r("#"+n);e&&(s&&(e.classname+=" "+s),e.innerhtml=c.replace("&pt=0","&pt="+(f||0)),e.onmousedown=function(n){for(var t=n.target,r,f,s;t.tagname!=="a"&&t!==e;)t=t.parentnode;t!==e&&(r=[],o&&r.push("an="+o),f=[].filter.call(t.attributes,function(n){return/^data-/.test(n.name)}),f.length>0&&f.foreach(function(n){var t=n.name.replace(/^data-/,"");r.push(u(t)+"="+u(n.value))}),r.push("utm="+u(rt+l)),s="",r.length>0&&(s="?"+r.join("&")),t.href=i+s)})}function g(){return y(h).length>0}function at(n){var t=i.createelement("a");return t.href=n,t.host}function vt(){var t,n;g()?(n=st(h,20,t,d),o(function(){var u=r(h),t;k(u)||(u.parentnode.removechild(u),typeof n=="function"&&n(),t=i.createelement("img"),t.src="//"+at(l)+"/to.gif",t.style.display="none",i.body.appendchild(t))},2e3)):d()}var l=n.u,a=n.o,nt=a===undefined?{}:a,t=window,e=t.location,u=t.encodeuricomponent,v=t.decodeuricomponent,i=t.document,tt=i.body,it=i.getelementsbytagname("head")[0],o=t.settimeout,s=t.cleartimeout,rt="&utm_source="+e.hostname+"&utm_medium=ad&utm_campaign=",h="#sidebar [id^=adzerk].everyonelovesstackoverflow",c=0;t.clc={init:ct,load:vt,ls:p,as:w,tags:b}}).call(null, {"u":"//clc.stackoverflow.com/p.js"});"use strict";var allowedhosts=["stackoverflow.com","serverfault.com"];(allowedhosts[0]==="*"||allowedhosts.indexof(location.hostname)!==-1)&&window.clc.load(); #newsletter-ad { width: 270px; height: 250px; overflow: hidden; background: url('//cdn.sstatic.net/stackoverflow/img/newsletter-ad.png?v=3'); padding: 0 15px 0 15px; } #newsletter-ad-header { margin-top: 60px; } #newsletter-ad ul { margin: 1em 0 1em 1.5em; } #newsletter-ad ul li { margin-bottom: 5px; } #newsletter-signup-container { text-align: center; } #newsletter-preview-container { margin-top: 10px; text-align: center; } #newsletter-email-input { width: 200px; } stackexchange.ready(function () { stackexchange.newsletterad.init(); }); the week's top questions , answers important community announcements questions need answerssubscribing, agree privacy policy , terms of service.
related 0 retrieving value row in struts2 table while using displaytag 0 assign hidden value using struts2 tag 3 default value in struts2 list box 0 how invoke action given object in struts 2 , jsp? 5 struts2 increment previous set <s:set /> value 0 how check if user logged in struts2 2 how check permission in jsp if tag 1 how retain select box value 0 how fetch info dynamically generated jsp page in struts 2? 4 how create pop after user has registered without servlet hot network questions age should 1 heed "but i'm not cold!"? why have private fields, isn't protected enough? solving problem of long dc wires selling logo business did not inquire 1 why cauliflower puree taste mustardy after 2 days? can cameras+display screens window/mirror-like optical behaviour exist? using fiance's money pay off pupil debt python: there need close files have no reference them did snape infiltrating death eaters? hard 1 person ride tandem bike? derogatory word, describing person (a pupil) memorizes instead of learning? should smoke detector beeps constantly? rpg currency scheme potential employer not disclosing info without references how align superscripts? if stuck website has poor security? why might paper published in journal no longer available anywhere? what's point of ca? how can maintain secret major detail known pov protagonist? reverse n-dimensional array projects ever end early? 7c mean in poster? english language language have grammatical gender? 5000th question more hot questions
Comments
Post a Comment