You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael McGrady <mi...@michaelmcgrady.com> on 2004/09/24 06:56:39 UTC

Extensions: An Answer to Code Bloat: http://kenfitzpatrick.dnsalias.org:8080/imageButtonBeanManager/index.jsp

I would like to applaud the approach Ken Fitzpatrick has used in his 
ImageButtonBeanManager program, viz. creating an extension to Struts 
rather than attempting to get this code into the framework.  This is 
good, I think, for struts.  I don't care for the solution myself.  Other 
will, I am sure.  That is why having this as an extension is important.  
I would recommend this approach rather than the approach of saying 
"Well, it isn't too messy, really!"

Michael McGrady


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


How read action before show page and with the validate check

Posted by BOU Hou <bo...@yahoo.co.jp>.
hello all,
I am making two pagee, one is List page which show the datas,another is a
Edit page which create the new datas.
the struts-config.xml:
    <action path="/MatterList"
            type="com.***.webapps.jin.admin.action.MatterListAction"
            name="MatterListForm"
            scope="request"
            validate="true">
      <forward name="new" path="/do/MatterEdit" redirect="true"/>
      <forward name="success" path="/WEB-INF/jsp/job/MatterList.jsp"
redirect="false" />
    </action>
    <action path="/MatterEdit"
            type="com.***.webapps.jin.admin.action.MatterEditAction"
            name="MatterEditForm"
            scope="request"
	input="???????"
            validate="true">
      <forward name="success" path="/WEB-INF/jsp/job/MatterEdit.jsp"
redirect="false" />
    </action>
I want to add the validate check in MatterEditForm, how to set the input tag
and redirect tag , path tag which in action tag.
And there is several combobox on the Edit page, which read data from
database in EditAction,I set like this
< input="/WEB-INF/jsp/job/MatterEdit.jsp > ,that the value of combobox which
setAttibute in Action can not be find.
Please help me, thank you.

this is the combobox setting code in ActionForm
        try
        {
            List prefecture = PrefectureFactory.getAll(getDataSource());
            for (int i = 0; i < prefecture.size(); i++)
            {
                maform.setPrefecturecode(((Prefecture) (prefecture.get(i)))
                        .getCode());
            }
            request.setAttribute("prefecture", prefecture);
        } catch (SQLException sqle)
        {
            log.fatal(sqle.getMessage());
            sqle.printStackTrace();
        }
        try
        {
            List job = JobFactory.getAll(getDataSource());
            for (int i = 0; i < job.size(); i++)
            {
                maform.setJobcode(((Job) (job.get(i))).getCode());
            }
            request.setAttribute("job", job);
        } catch (SQLException sqle)
        {
            log.fatal(sqle.getMessage());
            sqle.printStackTrace();
        }
        try
        {
            List customer = CustomerFactory.getAll(getDataSource());
            for (int i = 0; i < customer.size(); i++)
            {
                maform
                        .setCustomercode(((Customer) (customer.get(i)))
                                .getCode());
            }
            request.setAttribute("customer", customer);
        } catch (SQLException sqle)
        {
            log.fatal(sqle.getMessage());
            sqle.printStackTrace();
        }
        try
        {
            List customerperson =
CustomerPersonFactory.getAll(getDataSource());
            for (int i = 0; i < customerperson.size(); i++)
            {
                maform.setCustomerpersoncode(((CustomerPerson)
(customerperson
                        .get(i))).getCode());
            }
            request.setAttribute("customerperson", customerperson);
        } catch (SQLException sqle)
        {
            log.fatal(sqle.getMessage());
            sqle.printStackTrace();
        }
        request.setAttribute(mapping.getName(), maform);


__________________________________
TSUKAME EIKOU! KAGAYAKE EGAO!
Yahoo! JAPAN JPC OFFICIAL INTERNET PORTAL SITE
http://pr.mail.yahoo.co.jp/para/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org