/** * Create the form tag. * * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag() */ public void doTag() throws JspException { context = (PageContext) getJspContext(); JspWriter out = context.getOut(); try { out.print("<script "); out.print(getJavascriptAttributes()); out.print(">"); JspFragment body = getJspBody(); if( body != null) { body.invoke(null); } out.print("</script>"); } catch (Exception e) { throw new JspException(e); } }
public void doTag() throws JspException { JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter o = pageContext.getOut(); try { o.print("<a "); o.print(getAttributes()); o.print(">"); if( body != null ) { body.invoke(null); } o.print("</a>"); } catch (Exception e) { throw new JspException(e); } }
public void doTag() throws JspException { TableRowTag rowTag = (TableRowTag) findAncestorWithClass(this, TableRowTag.class); ColumnTag columnTag = (ColumnTag)findAncestorWithClass(this, ColumnTag.class); if (columnTag == null) { throw new JspTagException("the <ur:columnContent> tag must" + " be nested within a <ur:column> tag"); } if (rowTag.isProcessColumn()) { JspFragment body = getJspBody(); try { body.invoke(null); } catch (IOException e) { e.printStackTrace(); throw new JspException("Error in columnContent", e); } } }
/** * Create the form tag. * * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag() */ public void doTag() throws JspException { JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter out = pageContext.getOut(); try { out.print("\n<form "); out.print(getAttributes()); out.print(">"); if( body!= null ) { out.print("<input type=\"hidden\" name=\"formName\" value=\"" + getName() + "\"/>"); body.invoke(null); } out.print("</form>"); } catch (Exception e) { throw new JspException(e); } }
public void doTag() throws JspException { JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter out = pageContext.getOut(); try { out.print("<th "); out.print(getAttributes()); out.print(">\n"); if( body!= null ) { body.invoke(null); } out.print("</th>"); } catch (Exception e) { throw new JspException(e); } }
public void doTag() throws JspException { JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter o = pageContext.getOut(); try { o.print("<thead "); o.print(getAttributes()); o.print(">"); if( body != null) { body.invoke(null); } o.print("</thead>"); } catch (Exception e) { throw new JspException(e); } }
public void doTag() throws JspException { JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter o = pageContext.getOut(); try { o.print("<td "); o.print(getAttributes()); o.print(">"); if( body != null) { body.invoke(null); } o.print("</td>"); } catch (Exception e) { throw new JspException(e); } }
public void doTag() throws JspException { JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter o = pageContext.getOut(); try { o.print("<caption "); o.print(getAttributes()); o.print(">"); if(body != null) { body.invoke(null); } o.print("</caption>"); } catch (Exception e) { throw new JspException(e); } }
public void doTag() throws JspException { JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter o = pageContext.getOut(); try { o.print("<tr "); o.print(getAttributes()); o.print(">"); if( body != null ) { body.invoke(null); } o.print("</tr>"); } catch (Exception e) { throw new JspException(e); } }
public void doTag() throws JspException { log.debug("do tag called"); JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter o = pageContext.getOut(); try { o.print("<table "); o.print(getHtmlTableAttributes()); o.print(">"); if( body != null ) { body.invoke(null); } o.print("</table>"); } catch (Exception e) { throw new JspException(e); } }
public void doTag() throws JspException { JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter o = pageContext.getOut(); try { o.print("<th "); o.print(getAttributes()); o.print(">"); if( body != null ) { body.invoke(null); } o.print("</th>"); } catch (Exception e) { throw new JspException(e); } }
/** * Create the form tag. * * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag() */ public void doTag() throws JspException { PageContext context = (PageContext) getJspContext(); o = context.getOut(); JspFragment body = getJspBody(); try { o.print("<div " + getAttributes().toString() + ">"); if(body != null) { body.invoke(null); } o.print("</div>"); } catch(Exception e) { throw new JspException("error occured in DivTag", e); } }
@SuppressWarnings ( "unchecked" ) @Override public void doTag () throws JspException, IOException { final Map<String, LinkedList<JspFragment>> stacks = (Map<String, LinkedList<JspFragment>>)getJspContext ().getAttribute ( PushTag.ATTR, PageContext.REQUEST_SCOPE ); if ( stacks == null ) { return; } final LinkedList<JspFragment> stack = stacks.get ( this.name ); if ( stack == null ) { return; } for ( final JspFragment fragment : stack ) { fragment.invoke ( getJspContext ().getOut () ); } stack.clear (); }
@Override @SuppressWarnings ( "unchecked" ) public void setJspBody ( final JspFragment jspBody ) { super.setJspBody ( jspBody ); Map<String, LinkedList<JspFragment>> stacks = (Map<String, LinkedList<JspFragment>>)getJspContext ().getAttribute ( ATTR, PageContext.REQUEST_SCOPE ); if ( stacks == null ) { stacks = new HashMap<> (); getJspContext ().setAttribute ( ATTR, stacks, PageContext.REQUEST_SCOPE ); } LinkedList<JspFragment> stack = stacks.get ( this.name ); if ( stack == null ) { stack = new LinkedList<> (); stacks.put ( this.name, stack ); } stack.add ( jspBody ); }
@Override public Tag executeTag() throws JspException, IOException { Boolean testValue; Object tagValue = getTagValue(test); if (tagValue instanceof Boolean) { testValue = (Boolean) tagValue; } else { testValue = Boolean.valueOf((String) tagValue); } if (testValue != null && testValue) { JspFragment body = getJspBody(); if (body != null) { body.invoke(null); } } return null; }
@Override public Tag executeTag() throws JspException, IOException { JspFragment body = getJspBody(); if (body != null) { body.invoke(null); } setRandomId("badge"); Span span = new Span(); span.addAttribute("style", getTagValue(style)) .addAttribute("class", Bootstrap.BADGE) .addAttribute("class", getTagValue(styleClass)) .addText(getTagValue(label)); appendTooltip(span); appendPopOver(span); appendRefId(span, id); appendAjax(id); appendBind(id); return span; }
@Override public Tag executeTag() throws JspException, IOException { StringWriter sw = new StringWriter(); JspFragment body = getJspBody(); if (body != null) { body.invoke(sw); } // Place the tag content as template template = sw.toString(); if (StringUtils.isNotBlank(template)) { setRandomId("tooltip"); // The HTML template must overwrite the title title = null; } return null; }
@Override public Tag executeTag() throws JspException, IOException { // Just to call nested tags JspFragment body = getJspBody(); if (body != null) { body.invoke(null); } Tag inputPart = executeInputPart(); Tag listPart = executeListPart(); appendDocScript(getAjaxFunction()); Set set = new Set(); set.addTag(inputPart); set.addTag(listPart); return set; }
@Override public Tag executeTag() throws JspException, IOException { // Just to call nested tags JspFragment body = getJspBody(); if (body != null) { body.invoke(null); } if (events.isEmpty()) { throw InvalidAttributeException.fromConflict("async", "asyncevent", "At least one inner tag [asyncevent] must be specified"); } appendDocScript(getAsyncFunction()); return null; }
@Override public Tag executeTag() throws JspException, IOException { StringWriter sw = new StringWriter(); JspFragment body = getJspBody(); if (body != null) { body.invoke(sw); } Td td = new Td(); td.addAttribute("id", id) .addAttribute("style", getTagValue(style)) .addAttribute("class", getTagValue(styleClass)) .addText(executeExpressions(sw.toString())); return td; }
@Override public Tag executeTag() throws JspException, IOException { StringWriter sw = new StringWriter(); JspFragment body = getJspBody(); if (body != null) { body.invoke(sw); } Div div = new Div(); div.addAttribute("id", id) .addAttribute("class", getTagValue(styleClass)) .addAttribute("style", "display: none;") .addAttribute("style", getTagValue(style)); div.addText(sw.toString()); appendDocScript(new StringBuilder(JSMART_AJAX_ATTACH.format(id))); return div; }
@Override public Tag executeTag() throws JspException, IOException { // Look for parameters JspFragment body = getJspBody(); if (body != null) { body.invoke(null); } String resource = (String) getTagValue(res); String resourceKey = (String) getTagValue(key); String message = getResourceString(resource, resourceKey); if (!params.isEmpty()) { message = formatText(message, params); } printOutput(message); return null; }
@Override public Tag executeTag() throws JspException, IOException { JspTag parent = getParent(); if (!(parent instanceof FormTagHandler) && !(parent instanceof RestTagHandler)) { throw ConstraintTagException.fromConstraint("recaptcha", "Tag must be placed inside [form] or [rest] tag"); } // Just to call nested tags JspFragment body = getJspBody(); if (body != null) { body.invoke(null); } setRandomId("recaptcha"); // ReCaptcha V2 if (version.equals(ReCaptchaHandler.RECAPTCHA_V2)) { return executeRecaptchaV2(parent); } // ReCaptcha V1 return executeRecaptchaV1(parent); }
@Override public Tag executeTag() throws JspException, IOException { StringWriter sw = new StringWriter(); JspFragment body = getJspBody(); if (body != null) { body.invoke(sw); } // Place the tag content as template template = sw.toString(); if (StringUtils.isNotBlank(template)) { setRandomId("popover"); // The HTML template must overwrite the content content = null; } return null; }
@Before public void setup() throws Exception { MockHttpServletRequest mockRequest = new MockHttpServletRequest(mockServletContext); Cookie[] cookieMonster = new Cookie[3]; cookieMonster[0] = new Cookie("TEST_COOKIE_A", "TEST_VALUE_A"); cookieMonster[1] = new Cookie("TEST_COOKIE_B", "TEST_VALUE_B"); cookieMonster[2] = new Cookie("TEST_COOKIE_C", "TEST_VALUE_C"); mockRequest.setCookies(cookieMonster); mockPageContext = new MockPageContext(mockServletContext, mockRequest, new MockHttpServletResponse()); tag = new PageTag(); tag.setJspContext(mockPageContext); // Required attributes of the PageTag are: id, title so set them here. tag.setId(ID); tag.setTitle(TITLE); // Disable appcache and google analytics for simplicity. tag.setAppcacheEnabled(APPCACHE); tag.setDisableGoogleAnalytics(true); JspFragment jspBodyFragment = mock(JspFragment.class); doAnswer(new FakeJspBodyAnswerer()).when(jspBodyFragment) .invoke((Writer) anyObject()); tag.setJspBody(jspBodyFragment); }
@Before public void setup() throws Exception { mockPageContext = new MockPageContext(mockServletContext, new MockHttpServletRequest(), new MockHttpServletResponse()); tag = new PageTag(); tag.setAppcacheEnabled("false"); tag.setJspContext(mockPageContext); tag.setJspBody(new JspFragment() { @Override public void invoke(Writer out) throws JspException, IOException { } @Override public JspContext getJspContext() { return null; } }); }
@Before public void setup() throws Exception { mockPageContext = new MockPageContext(mockServletContext); tag = new MultiPageTag(); tag.setJspContext(mockPageContext); // Required attributes of the PageTag are: id, title so set them here. tag.setId(ID); tag.setTitle(TITLE); // Disable appcache and google analytics for simplicity. tag.setAppcacheEnabled(APPCACHE); tag.setDisableGoogleAnalytics(true); JspFragment jspBodyFragment = mock(JspFragment.class); doAnswer(new FakeJspBodyAnswerer()).when(jspBodyFragment) .invoke((Writer) anyObject()); tag.setJspBody(jspBodyFragment); }
/** * パンクズリストを表示します。 * このメソッドはJSP-BODYを評価せずに、 * 既存のHTMLテンプレート、あるいはクラスコンフィグオーバライドされたHTMLテンプレートを利用します。 * @throws JspException JSP処理中にエラーが発生した場合 * @throws IOException 入出力エラーの場合 */ protected void render() throws JspException, IOException { render(new JspFragment() { @Override public JspContext getJspContext() { return PankuzuTag.this.getJspContext(); } @Override public void invoke(Writer out) throws JspException, IOException { JspContext context = getJspContext(); ViewId vid = (ViewId) context.getAttribute(var); String encodedUrl = encodeURL(vid.getUrl()); String item = Strings.substitute(DEFAULT_TEMPLATE, Maps .hash("url", encodedUrl) .map("label", Strings.escapeHTML(vid.getLabel())) .map("query", trimQueryMarkerIfGetRequestParameterExists(encodedUrl, vid.getQuery()))); context.getOut().print(item); } }); }
private String invokeFragmentIfNeeded( JspFragment fragment, String defaultValue, int currentIndex) throws JspException { PageContext p = pageContext; StringWriter w = new StringWriter(); if (fragment != null) { if (currentIndex > 0) p.setAttribute(var, currentIndex); try { fragment.invoke(w); } catch (IOException e) {throw new JspException(e);} if (currentIndex > 0) p.removeAttribute(var); } else { w.append(Strings.substitute( defaultValue, Maps.hash(var, String.valueOf(currentIndex)))); } return w.toString(); }
public void doTag() throws JspException { try { // Writer für die Ausgabe JspWriter out = getJspContext().getOut(); out.println("Echo:"); // Ausgabe des Body JspFragment f = getJspBody(); if (f != null) { f.invoke(out); } } catch (IOException e) { throw new JspException(e.getMessage()); } }
@Override public void doTag() throws JspException, IOException { // TODO Auto-generated method stub //���ʸ��ױ�ǩ������ ChooseTag parent=(ChooseTag) this.getParent(); if(test && !parent.isDo()){//���test����true�����ҵܱܵ�ǩû�б�ִ�� JspFragment jf=this.getJspBody(); jf.invoke(null); parent.setDo(true); } }
@Override public void doTag() throws JspException, IOException { // TODO Auto-generated method stub JspFragment jf=this.getJspBody(); StringWriter sw=new StringWriter();//newһ���������StringWriter�����ݴ��ǩ������� jf.invoke(sw); String content=sw.getBuffer().toString();//��ñ�ǩ������� //ת������������ content=filter(content); this.getJspContext().getOut().write(content); }
@Override public void doTag() throws JspException, IOException { // TODO Auto-generated method stub JspFragment jf=this.getJspBody(); this.getJspContext().getOut().write(date.toLocaleString()); for(int i=0;i<count;i++){ jf.invoke(null); } }
@Override public void doTag() throws JspException, IOException { // TODO Auto-generated method stub //���Ȼ�ñ�ǩ�� JspFragment jf=this.getJspBody(); //����ǩ��д�������,���Dz�д������������ǩ������ݲ���ִ�У���������ʾ //jf.invoke(this.getJspContext().getOut()); }
@Override public void doTag() throws JspException, IOException { // TODO Auto-generated method stub //���Ȼ�ñ�ǩ�� JspFragment jf=this.getJspBody(); //����ǩ��������Ϊ��д��������Ҫ����ǩ����������д�����滺�� StringWriter sw=new StringWriter(); jf.invoke(sw); //�ӻ����л�ñ�ǩ�����ݣ������� String content=sw.toString(); content=content.toUpperCase(); //�ٽ���֮�������д������� this.getJspContext().getOut().write(content); }
@Override public void doTag() throws JspException, IOException { // TODO Auto-generated method stub //���Ȼ�ñ�ǩ�� JspFragment jf=this.getJspBody(); //����ǩ������ִ��5�� for(int i=1;i<=5;i++){ jf.invoke(null);//����nullҲ��Ĭ��д��������ȼ��� jf.invoke(this.getJspContext().getOut()); } }
@Override public void doTag() throws JspException, IOException { MenuItemTag parent = (MenuItemTag) findAncestorWithClass(this, MenuItemTag.class); // TODO encode URL // PageContext context = (PageContext) getJspContext(); JspFragment body = getJspBody(); if (body != null) { body.invoke(new StringWriter()); } parent.addItem(new MenuItem(name, url, items)); }
/** * to get group entries for Item file */ public void doTag() throws JspException { log.debug("do start tag for ACL"); JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); IrAcl acl = mySecurityService.getAcl(itemFile); Set<IrUserGroupAccessControlEntry> fileEntries = new HashSet<IrUserGroupAccessControlEntry>(); if( acl != null ) { fileEntries = acl.getGroupEntries(); } pageContext.setAttribute("fileEntries", fileEntries); try { if( body != null ) { body.invoke(null); } } catch (IOException e) { throw new JspException(e); } }
/** * Create the text input tag. * * @see javax.servlet.jsp.tagext.SimpleTagSupport#doTag() */ public void doTag() throws JspException { BasicFormTag formTag = (BasicFormTag) findAncestorWithClass(this, BasicFormTag.class); if (formTag == null) { throw new JspTagException("the <ur:textArea> tag must" + " be nested within a <ur:form> tag"); } JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter out = pageContext.getOut(); try { out.print("<textarea "); out.print(getAttributes()); out.print(">"); if( body!= null ) { body.invoke(null); } out.print("</textarea>"); } catch (Exception e) { throw new JspException(e); } }
@SuppressWarnings("unchecked") public void doTag() throws JspException { if(collection == null) { collection = new LinkedList(); } JspFragment body = getJspBody(); PageContext pageContext = (PageContext) getJspContext(); JspWriter out = pageContext.getOut(); try { out.print("<table "); out.print(getAttributes()); out.print(">"); if(!TagUtil.isEmpty(getCaption())) { out.print("<caption>"); out.print(getCaption()); out.print("</caption>"); } out.print("\n"); if( body!= null ) { body.invoke(null); } out.print("</table>"); } catch (Exception e) { throw new JspException(e); } }