Carregar apresentação
A apresentação está carregando. Por favor, espere
1
JAVA - Struts
2
AULA 4
3
Alterar struts-config.xml; Criar jsp com a consulta; Criar Action;
Exercício 3 Tarefa 2 Criar uma consulta de Produto, informando o Nome do produto , ou parte do nome do produto.Atentar para os seguintes detalhes : Alterar struts-config.xml; Criar jsp com a consulta; Criar Action; Usar Form já existente da inclusão; Criar método no ProdutoDAO, para consulta ao banco de dados, utilizando os parametros solicitados; Criar jsp com a resposta a consulta.
4
Usando Tag-libs do STRUTS Bean Tags HTML Tags Logic Tags Nested Tags
Tiles Tags Utilities Validator Consultar :
5
Usando Tag-libs do STRUTS (Bean_Tags)
Exemplo : (fim.jsp) uri="/WEB-INF/struts-html.tld" prefix="html" %> uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <html:html> Seu produto está cadastrado com as seguintes informações :<hr> Código : <bean:write name="produto" property="codigo"/><br/> Produto : <bean:write name="produto" property="produto"/><br/> Descrição : <bean:write name="produto" property="descricao"/><br/> <p/><a href="index.jsp">voltar</a> </html:html>
6
Usando Tag-libs do STRUTS (HTML_Tags)
Exemplo : (index2.jsp) uri="/WEB-INF/struts-html.tld" prefix="html" %> <html:html> <html:form action="Cadastrar.do" method="post"> <br/> Produto: <html:text name="produto" size="20" value="“ property="produto"/> Descrição: <html:text name="descricao" size="40" value="“ property="descricao"/> <html:submit>Enviar</html:submit> </html:form> </html:html>
7
Usando Tag-libs do STRUTS (Logic_Tags)
Exemplo : uri="/WEB-INF/struts-html.tld" prefix=“html" %> uri="/WEB-INF/struts-logic.tld" prefix=“logic" %> <html:html> <logic:present name=“produto” scope=“session”> Código : <bean:write name="produto" property="codigo"/><br/> Produto : <bean:write name="produto" property="produto"/><br/> Descrição : <bean:write name="produto" property="descricao"/><br/> </logic:present> </html:html>
8
Usando Tag-libs do STRUTS (Logic_Tags) Exemplo :
uri="/WEB-INF/struts-html.tld" prefix=“html" %> uri="/WEB-INF/struts-logic.tld" prefix=“logic" %> <html:html> <logic:present name=“lista” scope=“session”> <table> <tr> <td>Código</td><td>Produto</td><td>Descrição</td> </tr> <logic:iterate id=“produto" name="lista"> <td><bean:write name="produto" property="codigo"/></td> <td><bean:write name="produto" property="produto"/></td> <td><bean:write name="produto" property="descricao"/></td> </logic:iterate> </logic:present> </html:html>
9
public ActionForward execute(ActionMapping mapping, ActionForm form,
Usando LOG4J public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionForward actionforward = null; log.debug("Inicio CadastrarAction"); try { ... } catch (Exception e) { log.error(“Erro”,e.getMessage());
10
Exercício 4
Apresentações semelhantes
© 2024 SlidePlayer.com.br Inc.
All rights reserved.