Jsp is not invoking default java functions -


i have jsp trying invoke default java functions tostring, name() etc..

source object -> function not working

 long         ->  tostring()  enum         ->  name()  locale       ->  displayname() 

sample jsp codes

<div><s:select name="displaylocale" list="locales" listvalue="displayname" emptyoption="false" /></div> 

corresponding java action class:

public list<locale> getlocales()   {     list<locale> locales = localedao.getlocales();     collections.sort( locales, new localecomparator() );     return locales;   } 

same way facing issues other types too..

environment: jsp 2.0, tomcat 8, java 8

can me there else need do?

thanks

wow. i'd forgotten, jstl has access properties follow javabean standard, why locales accessible you. have access methods getfoo, getbaz, setfoo, , setbaz "foo" , "baz".

it seems possible access static method in class using custom tag library: http://www.javaworld.com/article/2073435/java-web-development/call-javabean-methods-from-jsp-2-0-pages.html seems way many hoops jump through call method on object. i'd forgotten how labor intensive web development used me.

you might consider other more modern templating http://www.thymeleaf.org/


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -