Criando uma lista na sessão com DWR – Parte 2
Dando continuidade…..
Vimos no artigo anterior a parte teórica deste artigo, agora vamos dar início a parte mais divertida: código ;D
Criando o Bean
Para iniciarmos o nosso exemplo sem mais delongas vamos criar o bean que iremos utilizar. Veja a listagem 01
public class BeanSession { private String id; private String keyMap; private String name; public String getId() { return id; } public String getKeyMap() { return keyMap; } public String getName() { return name; } public void setId(String id) { this.id = id; } public void setKeyMap(String keyMap) { this.keyMap = keyMap; } public void setName(String name) { this.name = name; } }
Listagem 01: Código do BeanSession com 3 propriedades(id, keyMap e name) e seus respectivos Get´s e Set´s.
Iremos utilizar esse bean para auxiliar o transporte dos dados entre o Java e o JavaScript. Mas o uso do mesmo não é obrigatório como vocês já sabem. No meu modelo eu utilizo Bean´s, mas caso você esteja utilizando outra forma também é possível, tanto com objetos JSON, Parâmetros como Integer, String etc, são aceitos com tranqüilidade pelo DWR.
Alterando o FacadeAjaxSession.java
Segue o código que tínhamos:
public class FacadeAjaxSession { public String exampleSession1(String attribute){ WebContext wc = WebContextFactory.get(); String valueSession = ""; if(wc.getHttpServletRequest().getSession().getAttribute(attribute)!= null){ valueSession = wc.getHttpServletRequest().getSession().getAttribute(attribute).toString(); }else{ valueSession = "Session is null"; } return valueSession; } public void createSession(String attribute, String value){ WebContext wc = WebContextFactory.get(); wc.getHttpServletRequest().getSession().setAttribute(attribute, value); } public String exampleSession2(String attribute){ Session session = new SessionFacade(); String valueSession = ""; if(session.getAttribute(attribute)!= null){ valueSession = session.getAttribute(attribute).toString(); }else{ valueSession = "Session is null"; } return valueSession; } }
Listagem 02: Código do FacadeAjaxSession que utilizamos no último artigo.
Por hoje é só, na parte 3 deste artigo vamos ver o restante da classe FacadeAjaxSession.
Abraços
generic tadalafil cialis tablet buy erection pills
zovirax brand name
400 mg trazodone
lexapro capsules
tadacip india pharmacy
buy gabapentin usa
neurontin cost
trazodone brand name uk
brand levitra online
generic trental 400 mg
buy baclofen 10 mg
buy altace 5mg without prescription order glimepiride 4mg without prescription purchase arcoxia generic
advair diskus medication
robaxin over the counter usa
buy generic levaquin
canadian pharmacy coupon
xenical 120 mg coupon
valtrex.com
buy tadacip 20 india
can i buy clindamycin gel over the counter
trazodone 100mg capsules
citalopram hbr
buy levitra 20mg where can i buy levitra buy hydroxychloroquine without prescription
strattera price south africa
mebendazole tablets
order augmentin online
buy zanaflex 4mg online
strattera 40 mg coupon
cost of aralen without insurance
buy vermox over the counter uk
zoloft price 50 mg
diflucan tablet australia
vermox australia
order mesalamine 800mg without prescription generic irbesartan buy generic irbesartan
levothyroxine synthroid
retino 0.05 price
buy lyrica usa
lipitor generics
oral vardenafil 10mg buy vardenafil 10mg generic buy plaquenil 200mg sale
neurontin 800mg
zyban for smoking cessation
amoxicillin 500 mg price in india
clindamycin cap 300 mg cost
tizanidine buy online without rx
tetracycline tablets brand name
baclofen cream over the counter