Récupérer un attribut d'une page JSP
bonjour,
dans la servlet 'gerer.do' de mon appli j'essaye de récupérer un attribut("schema") créer dans une JSP :
code JSP :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
<%! public static boolean isfirst=true; public static ContextSchema sh;%>
<%
if(isfirst==true)
{
/*je récupéré mon schéma d'une servlet first.do*/
sh= (ContextSchema)request.getAttribute("schema");isfirst=false;
}
request.setAttribute("schema", sh);
%> |
et j'ai des boutons submit qui renvoient vers gerer.do dont le code est :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
try{
ContextSchema sh=null;
sh= (ContextSchema)req.getAttribute("schema");
out.println(sh.toString());}
catch(Exception x)
{out.print(x.getMessage());}
} |
Le resultat du out.println(sh.toString()) est toujours null puisqu'il n'a pas récuperer l'attribut schema.
aidez moi svp !!