sábado, 13 de julho de 2013

Re: [java-br] objeto de sessão fica nulo na JSP após refresh da página

·

O problema é a sessão que se perde ao fazer um refresh na página.
Infelizmente a aplicação somente funciona no Internet Explorer, porém
somente passou a apresentar este erro depois dessa atualização do Windows.

Tem algum jeito de forçar a JSP para não criar uma nova sessão?


Em 13 de julho de 2013 22:46, Marcus Paulo <mpaulobr@gmail.com> escreveu:

> **
>
>
> Conseguiu identificar o problema?
> Chegou a fazer teste com outro navegador e/ou sistema operacional?
>
> Abraços
> Em 13/07/2013 20:54, "Joao Carlos Gomes Cruz" <jckgomescruz@gmail.com>
>
> escreveu:
>
> > Fazendo mais alguns testes. Identifiquei que ao fazer um refresh na
> página,
> > o Session ID está mudando.
> >
> > A aplicação funcionava corretamente, mas após a atualização automática do
> > windows (kb2846071) passou a ter este comportamento de perda de sessão.
> >
> > Att.
> > João Carlos
> >
> >
> > Em 13 de julho de 2013 16:53, Joao Carlos Gomes Cruz <
> > jckgomescruz@gmail.com
> > > escreveu:
> >
> > > Seguem os códigos:
> > >
> > > Tenho uma jsp com outra incluída
> > >
> > > selectProducts.jsp
> > >
> > > <%--
> > > Description: This page allows to select the product, plan and number of
> > > objects for the quote.
> > > Title: selectProducts.jsp
> > > Copyright: (c) 2003 Consis International
> > > Company: Consis International
> > >
> > > Author: Consis International
> > > Author: Salvador Velasco
> > > Version: iBroker V2.0
> > >
> > > Changes:
> > > 2004-12-21 (EFVP) JSP Documentation
> > > --%>
> > > <%@ page import="com.consisint.ibroker.main.configurator.*,
> > > com.consisint.ibroker.main.quoter.*,
> > > com.consisint.ibroker.servlets.iBrokerQuoterUser"%>
> > > <%@ page import="java.util.*"%>
> > > <%@ page errorPage="errorManager.jsp"%>
> > > <%@ page isELIgnored="false" %>
> > > <jsp:include page="sessionVerify.jsp"/>
> > > <%
> > > WebQuoterStatus webStatus = (WebQuoterStatus)
> > > session.getAttribute("webStatus");
> > > webStatus.setStatus(WebQuoterStatus.NEW);
> > > session.setAttribute("webStatus",webStatus);
> > > iBrokerWebLanguageHandler userLanguage = (iBrokerWebLanguageHandler)
> > > request.getAttribute("language");
> > > //iBrokerWebLayoutHandler userWebLayout = (iBrokerWebLayoutHandler)
> > > request.getAttribute("weblayout");
> > >
> > > //Frank T. 22/06/2007 -- Após versão de renovação, não estava
> > > atualizando quoteType.
> > > // Em SelectProducts, sempre será "NEW_LINE"
> > > //String quoteType = (String) session.getAttribute("quoteType");
> > > //if (quoteType == null) {
> > > //}
> > >
> > > // Ricardo 12/07/2007
> > > // As renovações que vinham do Lazuw eram tratadas como New Line.
> > > String requestType = (String)session.getAttribute("RequestType");
> > > if ("RenewalRating".equalsIgnoreCase(requestType)) {
> > > session.setAttribute("quoteType", Constants.RENEWAL);
> > > } else {
> > > session.setAttribute("quoteType", Constants.NEW_LINE);
> > > }
> > >
> > > iBrokerBean bean = (iBrokerBean)application.getAttribute("bean");
> > >
> > > GroupIF agent = (GroupIF)session.getAttribute("agent");
> > > Usuario userObject = (Usuario)session.getAttribute("user");
> > > if ((agent==null)||(userObject==null))
> > > throw new ServletException(userLanguage.mSessionHasExpired);
> > >
> > > if (bean==null)
> > > throw new ServletException(userLanguage.mBeanNotLoaded);
> > >
> > > // LAZUW Interface
> > > String workingLAZUW = (String)session.getAttribute("workingLAZUW");
> > > boolean varLAZUW = (workingLAZUW!=null) ?
> > > workingLAZUW.equalsIgnoreCase("true") : false;
> > >
> > > Ramos products = (Ramos)application.getAttribute("products");
> > > if (products==null)
> > > throw new ServletException(userLanguage.mErrorProductsNotLoaded);
> > > Ramo product;
> > > Producto plan;
> > > AgregatedUserGroup agregatedAgent;
> > >
> > > String[] allproductNames = null;
> > >
> > > allproductNames = bean.getProductsArray(agent);
> > >
> > > if (allproductNames==null)
> > > throw new ServletException(userLanguage.mErrorNoProductsDefined);
> > > else if (allproductNames.length<=0)
> > > throw new ServletException(userLanguage.mErrorNoProductsDefined);
> > > Vector allProdVector=new Vector();
> > > for (int i=0; i< allproductNames.length; i++) {
> > > if (!allProdVector.contains(allproductNames[i]))
> > > allProdVector.add(allproductNames[i]);
> > > }
> > >
> > > allproductNames = new String[allProdVector.size()];
> > > for (int i=0; i< allProdVector.size(); i++) {
> > > allproductNames[i] =(String) allProdVector.get(i);
> > > }
> > >
> > > Empresas countries = (Empresas)application.getAttribute("countries");
> > > if (countries == null)
> > > throw new ServletException(userLanguage.mErrorCountryNotLoaded);
> > > session.setAttribute("country",countries);
> > >
> > > if (varLAZUW) {
> > > product = (Ramo)application.getAttribute("product");
> > > String pid = (String)session.getAttribute("productID");
> > >
> > > String planName = ((pid!=null)&&(!pid.equals(""))) ?
> > > products.getPlan(pid) : null;
> > >
> > > if ((product!=null)&&(planName!=null)) {
> > > session.setAttribute("product",product);
> > > plan = (Producto)product.getPlan(planName);
> > > if (plan == null)
> > > throw new
> > > ServletException(userLanguage.mErrorPlanNotFound);
> > > session.setAttribute("plan",plan);
> > > agregatedAgent = plan.getGroup(agent.getDesc());
> > > if (agregatedAgent == null)
> > > throw new
> > > ServletException(userLanguage.mErrorAgentNotLinked);
> > > session.setAttribute("agregatedAgent",agregatedAgent);
> > > session.setAttribute("allproductNames",allproductNames);
> > > // clean up options
> > > session.setAttribute("quotationOptions", new Vector());
> > >
> > >
> >
> response.sendRedirect("processInputs.jsp?insuredItems=1&plan="+planName+"&product="+product.getDesc());
> > > return;
> > > }
> > > }
> > >
> > > String productSelected = (request.getParameter("product")!=null) ?
> > > request.getParameter("product") : allproductNames[0];
> > >
> > > if (productSelected.equals("")) productSelected = allproductNames[0];
> > >
> > > product = products.get(productSelected);
> > > if (product==null)
> > > throw new ServletException(userLanguage.mErrorProductNotFound);
> > > session.setAttribute("product",product);
> > >
> > > String[] planNames = bean.getPlansArray(product);
> > > if (planNames==null)
> > > throw new ServletException(userLanguage.mErrorProductHasNoPlans);
> > > else if (planNames.length<=0)
> > > throw new ServletException(userLanguage.mErrorProductHasNoPlans);
> > >
> > >
> > > String planSelected = (request.getParameter("plan")!=null) ?
> > > request.getParameter("plan") : "";
> > > if (planSelected.equals("")) planSelected = planNames[0];
> > > // pre-select the plan
> > > plan = (Producto)product.getPlan(planSelected);
> > > if (plan == null)
> > > throw new ServletException(userLanguage.mErrorPlanNotFound);
> > >
> > > //Santa Elena - 19/05/2012 - Pricing Enhancemens - Melhora do processo
> de
> > > login
> > > //::Início
> > > agregatedAgent = plan.getGroupIfExists(agent);
> > > //::Fim
> > >
> > > if (agregatedAgent == null)
> > > throw new ServletException(userLanguage.mErrorAgentNotLinked);
> > >
> > > session.setAttribute("agregatedAgent",agregatedAgent);
> > > session.setAttribute("plan",plan);
> > > session.setAttribute("allproductNames",allproductNames);
> > > // clean up options
> > > session.setAttribute("quotationOptions", new Vector());
> > >
> > > String sel = "";
> > > if ((allproductNames.length==1)&&(planNames.length==1)) {// there's
> > > only one product and plan frozen do not choose
> > >
> > >
> >
> response.sendRedirect("processInputs.jsp?insuredItems=1&plan="+planSelected+"&product="+productSelected);
> > > } else {
> > > %>
> > > <html>
> > > <head>
> > > <title><%=userLanguage.mSelectProductTitle%></title>
> > > <link rel="stylesheet" type="text/css"
> > > href="${sessionScope.weblayout.styleSheet}">
> > > </head>
> > > <script language="JavaScript1.2" src="js/checkform.js"></script>
> > > <body background="${sessionScope.weblayout.backgroundImage}"
> > > bgproperties="fixed" oncontextmenu="return false;"
> > onunload="ajaxLogout();">
> > > <table border="0" width="759" height="82">
> > > <tr>
> > > <td width=175 valign=top align=right>
> > > <img src="images/chubb/chubb_logo.jpg" alt="The Chubb
> > > Corporation" hspace=0 vspace=0 valign="center" align="left" width=79
> > > height=85 border=0>
> > > </td>
> > > <td>
> > > <img src="images/chubb/nullpixel.gif" width=25 height=1>
> > > </td>
> > > </tr>
> > > <tr>
> > > <td valign="bottom" align="left" colspan=2>
> > > <h3><font
> > > color="#ACACAC"><%=userLanguage.mWebQuotingSystemTitle%></font></h3>
> > > </td>
> > > </tr>
> > > </table>
> > > <form name="productForm" action="processInputs.jsp" method="get">
> > > <p><font color="#ACACAC"><%=userLanguage.mSelectWelcomeUser%>:
> > > <b><%=userObject.getLogin()%></b>,
> > > <%=userLanguage.mSelectYourProduct%>:</font></p>
> > > <br>
> > > <table border="0" cellpadding=5 cellspacing=0 align="center">
> > > <tr>
> > > <th class="texto" align="left" valign="middle" width=250>
> > > <%=userLanguage.mSelectProductHeader%>:
> > > </th>
> > > <td class="texto" align="left" valign="middle" width=150>
> > > <select name="product" size=1 class="forma" OnChange="refreshPage();">
> > > <%
> > > for (int i=0;i<allproductNames.length;i++ )
> > > {
> > > sel = (productSelected.equalsIgnoreCase(allproductNames[i])) ?
> > > "selected" : "";
> > > %>
> > > <option value="<%=allproductNames[i]%>"
> > > <%=sel%>><%=allproductNames[i]%></option>
> > > <% } %>
> > > </select>
> > > </td>
> > > </tr>
> > > <tr>
> > > <th class="texto" align="left" valign="middle" width=250>
> > > <%=userLanguage.mSelectPlanHeader%>:
> > > </th>
> > > <td class="texto" align="left" valign="middle" width=150>
> > > <select name="plan" size=1 class="forma">
> > > <%
> > > for (int j=0;j<planNames.length;j++) {
> > > sel = (planSelected.equalsIgnoreCase(planNames[j])) ?
> > > "selected" : "";
> > > %>
> > > <option value="<%=planNames[j]%>"
> > > <%=sel%>><%=planNames[j]%></option>
> > > <% }
> > >
> > > %>
> > > </select>
> > > </td>
> > > </tr>
> > > <input type="hidden" name="insuredItems" value="1">
> > > <tr>
> > > <td class="texto" align="left" valign="middle" width=250>
> > > <%=userLanguage.mPressContinueToStartNormal%>
> > > </td>
> > > <td class="texto" align="left" valign="middle" width=250>
> > > <input type="button" class="altButtonFormat"
> > > value="<%=userLanguage.mProcessQuoteBack%>"
> > > onClick="history.go(-1);">
> > > <input type="submit" class="altButtonFormat"
> > > value="<%=userLanguage.mSelectProductContinueButton%>">
> > > </td>
> > > </tr>
> > > </form>
> > > </body>
> > > </html>
> > > <%
> > > }
> > > %>
> > >
> > >
> > > Na JSP que está incluída, tenho o código abaixo e o erro é o objeto
> > > language que fica null depois de dar um refresh na página
> > selectProducts.jsp
> > >
> > > sessionVerify.jsp
> > >
> > > <%@ page
> > > import="com.consisint.ibroker.main.quoter.iBrokerWebLanguageHandler,
> > >
> > > com.consisint.ibroker.main.quoter.iBrokerWebLayoutHandler,
> > > com.consisint.ibroker.main.quoter.WebQuoterStatus,
> > > java.util.Locale"%>
> > > <%@ page isELIgnored="false" %>
> > > <%--
> > > Description: This page verifies if the session variables to handle the
> > > language are still in there.
> > > Title: viewquotes.jsp
> > > Copyright: (c) 2003 Consis International
> > > Company: Consis International
> > >
> > > Author: Consis International
> > > Version: iBroker Extranet
> > >
> > > Changes:
> > > 2005-08-30 (EFVP) JSP Creation
> > > --%>
> > > <%
> > > iBrokerWebLanguageHandler language =
> > > (iBrokerWebLanguageHandler)session.getAttribute("language");
> > > //iBrokerWebLayoutHandler layout =
> > > (iBrokerWebLayoutHandler)session.getAttribute("weblayout");
> > > if (language==null) {
> > > language = new iBrokerWebLanguageHandler(new
> > >
> >
> Locale(iBrokerWebLanguageHandler.PORTUGUESE,iBrokerWebLanguageHandler.BRA));
> > > throw new ServletException(language.mSessionHasExpired);
> > > }
> > > //if (layout==null) {
> > > // throw new ServletException(language.mSessionHasExpired);
> > > //}
> > > pageContext.setAttribute("language", language,
> > > PageContext.REQUEST_SCOPE);
> > > //pageContext.setAttribute("weblayout", layout,
> > > PageContext.REQUEST_SCOPE);
> > > if (session.getAttribute("webStatus") ==null){
> > > session.setAttribute("webStatus",new WebQuoterStatus());
> > > }
> > > %>
> > >
> > >
> > > Em 13 de julho de 2013 12:18, Arthur José Eloy Pozo Colado <
> > > arthureloy@yahoo.com.br> escreveu:
> > >
> > > **
>
> > >>
> > >>
> > >> Olá amigo...
> > >>
> > >> Você já tentou colocar o valor assim
> > >> session.putValue("variavel_armazena", valor que deseja colocar na
> > sessão);
> > >> e depois para exibir o valor armazenado
> > >> session.getValue("variavel_armazena");
> > >>
> > >> Espero que tenha ajudado.
> > >>
> > >> Abraços
> > >>
> > >> Arthur
> > >>
> > >>
> > >> ________________________________
> > >> De: Marcus Paulo <mpaulobr@gmail.com>
> > >> Para: "java-br@yahoogrupos.com.br" <java-br@yahoogrupos.com.br>
> > >> Enviadas: Sábado, 13 de Julho de 2013 9:52
> > >> Assunto: Re: [java-br] objeto de sessão fica nulo na JSP após refresh
> da
> > >> página
> > >>
> > >>
> > >>
> > >> Olá José,
> > >>
> > >> Você tem como enviar o código-fonte.
> > >>
> > >> Amigo, esse seu atributo, ele não está em algum campo desabilitado?
> > >>
> > >> Abraços,
> > >> Marcus Paulo
> > >>
> > >> Enviado via iPhone
> > >>
> > >> > Em 13/07/2013, às 08:50, Joao Carlos Gomes Cruz <
> > jckgomescruz@gmail.com>
> > >> escreveu:
> > >> >
> > >> > Bom dia Pessoal.
> > >> >
> > >> > Tenho em uma JSP um atributo que recupero da sessão no momento que a
> > >> mesma
> > >> > é aberta. Ao realizar um refresh na página o atributo da sessão fica
> > >> nulo.
> > >> > Já tenti adicionar o comando response.setDataHeader("Expires", 0)
> mas
> > >> não
> > >> > funcionou.
> > >> >
> > >> > Alguém já teve este problema?
> > >> >
> > >> > Obrigado.
> > >> >
> > >> > [As partes desta mensagem que não continham texto foram removidas]
> > >> >
> > >> >
> > >>
> > >> [As partes desta mensagem que não continham texto foram removidas]
> > >>
> > >> [As partes desta mensagem que não continham texto foram removidas]
> > >>
> > >>
> > >>
> > >
> > >
> >
> >
> > [As partes desta mensagem que não continham texto foram removidas]
> >
> >
> >
> > ------------------------------------
>
> >
> > Para sair da lista, envie email para:
> java-br-unsubscribe@yahoogroups.com
> > Para upload/download de arquivos:
> > http://www.yahoogroups.com/files/java-brLinks do Yahoo! Grupos
>
> >
> >
> >
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>
>


[As partes desta mensagem que não continham texto foram removidas]



------------------------------------

Para sair da lista, envie email para: java-br-unsubscribe@yahoogroups.com
Para upload/download de arquivos: http://www.yahoogroups.com/files/java-brLinks do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
http://br.groups.yahoo.com/group/java-br/

<*> Para sair deste grupo, envie um e-mail para:
java-br-unsubscribe@yahoogrupos.com.br

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
http://br.yahoo.com/info/utos.html

0 comentários:

Pague com LPs do Mister Colibri

Pague com LPs do Mister Colibri
Quer comprar celular,Tablet,pen drive, GPS e muito outros produtos e ainda podendo pagar tudo em LPs ?Pois saiba que isso é possível,basta você visitar o site downloadstotal.com e realizar a sua compra com toda tranquilidade e segurança!!!

Hora

Online

Arquivo do Blog