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());
}
}
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);
}
}
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;
}
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);
}
}
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);
}
Aggregations