Search in sources :

Example 66 with JspException

use of javax.servlet.jsp.JspException in project jodd by oblac.

the class ElseTag method doTag.

@Override
public void doTag() throws JspException {
    JspTag parent = getParent();
    if (!(parent instanceof IfElseTag)) {
        throw new JspException("Parent IfElse tag is required", null);
    }
    IfElseTag ifTag = (IfElseTag) parent;
    if (!ifTag.getTestValue()) {
        TagUtil.invokeBody(getJspBody());
    }
}
Also used : JspException(javax.servlet.jsp.JspException) JspTag(javax.servlet.jsp.tagext.JspTag)

Example 67 with JspException

use of javax.servlet.jsp.JspException in project jodd by oblac.

the class UnsetTag method doTag.

@Override
public void doTag() throws JspException {
    PageContext pageContext = (PageContext) getJspContext();
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    String scopeValue = scope != null ? scope.toLowerCase() : SCOPE_PAGE;
    if (scopeValue.equals(SCOPE_APPLICATION)) {
        request.getSession().getServletContext().removeAttribute(name);
    } else if (scopeValue.equals(SCOPE_SESSION)) {
        request.getSession().removeAttribute(name);
    } else if (scopeValue.equals(SCOPE_REQUEST)) {
        request.removeAttribute(name);
    } else if (scopeValue.equals(SCOPE_PAGE)) {
        pageContext.removeAttribute(name);
    } else {
        throw new JspException("Invalid scope: " + scope);
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) JspException(javax.servlet.jsp.JspException) PageContext(javax.servlet.jsp.PageContext)

Example 68 with JspException

use of javax.servlet.jsp.JspException in project OpenAM by OpenRock.

the class DSAMEValueTag method doStartTag.

/**
     * Performs start tag
     *
     * @return EVAL_BODY_INCLUDE always
     * @throws JspException if request context is null
     */
public int doStartTag() throws JspException {
    reset();
    key = (String) getValue("key");
    String value = "";
    try {
        ViewBeanManager viewBeanManager = getRequestContext().getViewBeanManager();
        LoginViewBean vb = (LoginViewBean) viewBeanManager.getViewBean(com.sun.identity.authentication.UI.LoginViewBean.class);
        //ViewBean viewBean = getParentViewBean();
        //LoginViewBean vb = (LoginViewBean) viewBean;
        value = (String) vb.getDisplayFieldValue(key);
        setValue("key", value);
    } catch (Exception ex) {
        setValue("key", key);
    }
    writeOutput(value);
    return SKIP_BODY;
}
Also used : ViewBeanManager(com.iplanet.jato.ViewBeanManager) LoginViewBean(com.sun.identity.authentication.UI.LoginViewBean) JspException(javax.servlet.jsp.JspException)

Example 69 with JspException

use of javax.servlet.jsp.JspException in project OpenAM by OpenRock.

the class DSAMEFormTag method setDefaultCommandChild.

public void setDefaultCommandChild(String name) {
    try {
        ViewBean vb = getParentViewBean();
        String value = (String) vb.getDisplayFieldValue(name);
        setValue("action", value);
    } catch (JspException ex) {
        setValue("action", name);
    }
}
Also used : JspException(javax.servlet.jsp.JspException) ViewBean(com.iplanet.jato.view.ViewBean)

Example 70 with JspException

use of javax.servlet.jsp.JspException in project adempiere by adempiere.

the class WorkflowTag method doStartTag.

//	setActivityID
/**
	 *  Start Tag
	 *  @return SKIP_BODY
	 * 	@throws JspException
	 */
public int doStartTag() throws JspException {
    Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
    //	Activity
    int AD_WF_Activity_ID = 0;
    String info = null;
    try {
        info = (String) ExpressionUtil.evalNotNull("workflow", "activityID", m_activityID_el, String.class, this, pageContext);
        if (info != null && info.length() != 0)
            AD_WF_Activity_ID = Integer.parseInt(info);
    } catch (Exception e) {
        log.severe("doStartTag - Activity" + e);
    }
    MWFActivity act = new MWFActivity(ctx, AD_WF_Activity_ID, null);
    if (AD_WF_Activity_ID == 0 || act == null || act.get_ID() != AD_WF_Activity_ID) {
        log.severe("doStartTag - Activity Not found - " + m_activityID_el + " (" + info + ")");
        return (SKIP_BODY);
    }
    String name = null;
    if (act.isUserApproval())
        name = "IsApproved";
    else if (act.isUserManual())
        name = "IsConfirmed";
    else
        return (SKIP_BODY);
    //	YesNo
    option[] yesNoOptions = new option[3];
    yesNoOptions[0] = new option(" ");
    yesNoOptions[0].addElement(" ");
    yesNoOptions[0].setSelected(true);
    yesNoOptions[1] = new option("Y");
    yesNoOptions[1].addElement(Util.maskHTML(Msg.translate(ctx, "Yes")));
    yesNoOptions[2] = new option("N");
    yesNoOptions[2].addElement(Util.maskHTML(Msg.translate(ctx, "No")));
    select yesNoSelect = new select(name, yesNoOptions);
    yesNoSelect.setID("ID_" + name);
    yesNoSelect.setClass(C_MANDATORY);
    //
    String nameTrl = Msg.translate(ctx, name);
    //	Assemble
    HtmlCode html = new HtmlCode();
    html.addElement(new b(nameTrl));
    html.addElement(yesNoSelect);
    html.addElement(new br());
    JspWriter out = pageContext.getOut();
    html.output(out);
    //
    return (SKIP_BODY);
}
Also used : MWFActivity(org.compiere.wf.MWFActivity) org.apache.ecs.xhtml.br(org.apache.ecs.xhtml.br) HtmlCode(org.compiere.util.HtmlCode) org.apache.ecs.xhtml.b(org.apache.ecs.xhtml.b) org.apache.ecs.xhtml.select(org.apache.ecs.xhtml.select) Properties(java.util.Properties) JspWriter(javax.servlet.jsp.JspWriter) JspException(javax.servlet.jsp.JspException) org.apache.ecs.xhtml.option(org.apache.ecs.xhtml.option)

Aggregations

JspException (javax.servlet.jsp.JspException)158 IOException (java.io.IOException)34 Map (java.util.Map)30 HashMap (java.util.HashMap)21 HttpServletRequest (javax.servlet.http.HttpServletRequest)21 JspWriter (javax.servlet.jsp.JspWriter)21 Iterator (java.util.Iterator)20 ActionMessages (org.apache.struts.action.ActionMessages)15 MockFormBean (org.apache.struts.mock.MockFormBean)15 InvocationTargetException (java.lang.reflect.InvocationTargetException)11 ActionMessage (org.apache.struts.action.ActionMessage)11 ArrayList (java.util.ArrayList)7 Collection (java.util.Collection)7 List (java.util.List)7 Locale (java.util.Locale)6 PageExpiredException (org.mifos.framework.exceptions.PageExpiredException)6 MalformedURLException (java.net.MalformedURLException)5 ModuleConfig (org.apache.struts.config.ModuleConfig)5 UserContext (org.mifos.security.util.UserContext)5 SimpleDateFormat (java.text.SimpleDateFormat)4