Loading ...
Sorry, an error occurred while loading the content.

Servlet Examples

Expand Messages
  • gregtaylor3
    I am looking for examples of using YUI with Java servlets / JSPs
    Message 1 of 2 , Dec 30, 2007
    • 0 Attachment
      I am looking for examples of using YUI with Java servlets / JSPs
    • Peter Kiraly
      This is not a full example, just an extract from my codebase. The JS part is writen with Ext grid, not YUI. The Java part is based on Jakarta Struts. I hope it
      Message 2 of 2 , Jan 2, 2008
      • 0 Attachment
        This is not a full example, just an extract from my
        codebase. The JS part is writen with Ext grid, not YUI.
        The Java part is based on Jakarta Struts.
        I hope it helps.

        Kiraly Peter
        http://www.tesuji.eu

        servlet:
        =======
        public class GetStatesAction extends Action {
        public ActionForward execute(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) {
        GetStatesForm statesForm = (GetStatesForm) form;
        StringBuilder state = new StringBuilder();
        // collecting the state indormation
        //...
        statesForm.setStates(states);
        return mapping.getInputForward();
        }
        }

        JSP:
        ===
        <%@ page language="java" pageEncoding="UTF-8" %>
        <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
        <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"
        %>

        <logic:empty name="getStatesForm" property="error">
        {success: true, response: <bean:write name="getStatesForm" property="states"
        filter="none" />}
        </logic:empty>

        <logic:notEmpty name="getStatesForm" property="error">
        {success: false, error: "<bean:write name="getStatesForm" property="error"
        />"}
        </logic:notEmpty>

        JavaScript:
        ==========
        function refreshState(b_showMessage) {
        var options = {
        url: GET_STATES_URL,
        method: "GET",
        success : function(form, action) {
        var states = action.result.response.states;
        // write out
        // ...
        },
        failure : function(form, action) {
        // handle failure
        // ...
        }
        };
        // ...
        gridForm.submit(options);
        }


        ----- Original Message -----
        From: gregtaylor3
        To: ydn-javascript@yahoogroups.com
        Sent: Monday, December 31, 2007 2:22 AM
        Subject: [ydn-javascript] Servlet Examples


        I am looking for examples of using YUI with Java servlets / JSPs
      Your message has been successfully submitted and would be delivered to recipients shortly.