Hi!

I'm a newbie trying to use struts.  I'm just trying to set a parameter
to the "request" object, but won't work.  Can anyone tell me where I
made my mistake?

I have a System.out.println and it prints alright, but the message never
arrives to the jsp page, the default value is printed instead.

This is from my struts-config.xml
---------------------------------
   <form-beans>
       <form-bean name="pepitaForm" type="test.PepitaForm"/>
   </form-beans>
   <action-mappings>
        <action 
                path="/pepita"
                scope="request" 
                type="test.PepitaAction" 
                name="pepitaForm">
                <forward name="success" path="/pages/pepita.jsp"/>
        </action>
    </action-mappings>
----------------------------------

This is PepitaAction:
---------------------
public final class PepitaAction extends Action {

    public ActionForward perform(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
        throws IOException, ServletException {

        PepitaForm pform = (PepitaForm) form;
        
        int base = pform.getBase();
        int exp = pform.getExp();
        try {
                String strMessage = base + "^" + exp + "=" + Math.pow(base,exp);
                System.out.println(strMessage);
                request.setAttribute("message", strMessage);
                return (mapping.findForward("success"));
        } 
        catch (Exception e)
        {
                request.setAttribute ("message", e.getMessage());
                return (mapping.findForward("failure"));
        }
    }
}
--------------------

This is pepita.jsp:
-------------------
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<[EMAIL PROTECTED] contentType="text/html"%>
<html>
<head><title>Pepita</title></head>
<body>
<br>
<bean:parameter id="strMessage" name="message" value="No value was
specified" />
<%=strMessage%>
<br>
</body>
</html>
-------------------

Please, tell me where did I mix everything up.

Love,
Margarita.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to