Grails gsp template. Pass params from gsp and accept their on template - templates

<g:each var="dep" in="${depList}">
<tr>
<td>
${dep.depName}
</td>
<td>
${dep.location}
</td>
<td>
<g:render template="listTemplate" model="${dep.clients}"/>
</td>
<td>
<g:checkBox name="departments" value="${dep.id}" checked="false" />
</td>
</tr>
</g:each>
From gsp page I need send model(params) depList on the template where I'm accept their/ How can I do this?

very close:
<g:render template="listTemplate" model="[clients:dep.clients]"/>

You can use like this.
<g:each var="dep" in="${depList}">
<tr>
<td>
${dep.depName}
</td>
<td>
${dep.location}
</td>
<td>
<g:render template="listTemplate" model="[clientlist: dep.clients]"/>
</td>
<td>
<g:checkBox name="departments" value="${dep.id}" checked="false" />
</td>
</tr>
</g:each>

Related

Get verification code from a html string code using regex

I am currently writing an automation script, Where I read email Gmail through API and i am getting below html content. Now i need only code 191418 from this html content, I want to take it using regex. I tried with this
.*([0-9]{6})
To find 6 digit code but its returns 10 matchings, I am not good at regex, Can someone please help me to get the code using regex?
<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><u></u>
<div>
<center id="m_-2051398760120817894wrapper">
<table id="m_-2051398760120817894main" width="100%">
<tbody><tr id="m_-2051398760120817894logo">
<td>
<table width="100%">
<tbody><tr>
<td>
<img src="test.com/logo.png" width="140px" alt="xxxxx Logo" style="padding:0 10px">
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="18px"></td>
</tr>
<tr id="m_-2051398760120817894header">
<td>
<table width="100%">
<tbody><tr>
<td height="64px" style="background-color:#10069f;color:#fff;padding-left:24px;font-weight:700">Reset your password</td>
</tr>
</tbody></table>
</td>
</tr>
<tr id="m_-2051398760120817894content">
<td>
<table width="100%">
<tbody><tr>
<td style="background-color:#f6f5ff;padding:24px 24px 16px 24px">
<p style="margin-top:0">The following is the verification code required to complete your password reset.</p>
<p style="margin-bottom:24px">Enter the following verification code on the screen during the registration, and proceed to the next step.</p>
<div style="display:block;text-align:center;margin-bottom:8px;background-color:#fff;height:92px;font-weight:600;font-size:36px;line-height:92px">191418</div>
<span style="display:block;font-size:12px;color:#5d5d5d">*The verification code is valid only for 24 hours.</span>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="24px"></td>
</tr>
<tr id="m_-2051398760120817894footer">
<td>
<table width="100%">
<tbody><tr>
<td style="background-color:#6d7777;padding:16px 24px;font-size:12px;color:#fff">
<table width="100%">
<tbody><tr>
<td id="m_-2051398760120817894footer-left">
<span style="display:block">amnimo Inc.</span>
<span style="display:block">0-3-30 usaa-fso, xxxxxxxx-shi, Tokyo, 180-8750, Japan</span>
<span style="display:block">Phone: +81-422-52-6779</span>
<span id="m_-2051398760120817894copyright-mb" style="margin-top:16px">© 2020 <div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><u></u>
<div>
<center id="m_-2051398760120817894wrapper">
<table id="m_-2051398760120817894main" width="100%">
<tbody><tr id="m_-2051398760120817894logo">
<td>
<table width="100%">
<tbody><tr>
<td>
<img src="https://test.com/logo.png" width="140px" alt="Amnimo Logo" style="padding:0 10px">
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="18px"></td>
</tr>
<tr id="m_-2051398760120817894header">
<td>
<table width="100%">
<tbody><tr>
<td height="64px" style="background-color:#10069f;color:#fff;padding-left:24px;font-weight:700">Reset your password</td>
</tr>
</tbody></table>
</td>
</tr>
<tr id="m_-2051398760120817894content">
<td>
<table width="100%">
<tbody><tr>
<td style="background-color:#f6f5ff;padding:24px 24px 16px 24px">
<p style="margin-top:0">The following is the verification code required to complete your password reset.</p>
<p style="margin-bottom:24px">Enter the following verification code on the screen during the registration, and proceed to the next step.</p>
<div style="display:block;text-align:center;margin-bottom:8px;background-color:#fff;height:92px;font-weight:600;font-size:36px;line-height:92px">191418</div>
<span style="display:block;font-size:12px;color:#5d5d5d">*The verification code is valid only for 24 hours.</span>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td height="24px"></td>
</tr>
<tr id="m_-2051398760120817894footer">
<td>
<table width="100%">
<tbody><tr>
<td style="background-color:#6d7777;padding:16px 24px;font-size:12px;color:#fff">
<table width="100%">
<tbody><tr>
<td id="m_-2051398760120817894footer-left">
<span style="display:block">test Inc.</span>
<span style="display:block">2-9-32 ssdsa-sss, puakano-shi, Tokyo, 000-8000, Japan</span>
<span style="display:block">Phone: +81-000-00-652</span>
<span id="m_-2051398760120817894copyright-mb" style="margin-top:16px">© 2020 amnimo Inc.</span>
</td>
<td id="m_-2051398760120817894footer-right">
<span style="display:block">© 2020 amnimo Inc.</span>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</center>
</div>
</div></div> Inc.</span>
</td>
<td id="m_-2051398760120817894footer-right">
<span style="display:block">© 2020 test Inc.</span>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</center>
</div>
</div></div>
You should use some DOM library that will let you query the element you want and get its content. Parsing HTML with regex is bad idea.
If you must do it, getting six numbers is not enough - after inspecting, I see that it's div content. So I would write something among the lines:
<div[^>]*>\d{6}<\/div>
Pattern explanation:
<div - match <div literally
[^>]* - match zero or more characters other from >
> - match > literally
\d{6} - match 6 digits
<\/div> - match <\/div> literally
Regex demo
EDIT
In order to extract desired text, use capturing groups:
<div[^>]*>(\d{6})<\/div>
Then text in first capturing group will be your desired result.
Maybe try word boundaries, which will prevent matching inside longer numbers:
\b([0-9]{6})\b
https://regex101.com/r/dQAiHU/1/

Hyperlink in custom display form

I am trying to add a field that holds a hyperlink in a custom display form. I have the following code:
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>ATO</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<a href="https://intelshare.intelink.gov/sites/carm/Shared%20Documents/ATO%20Letters/' + #eMASSID + '.pdf'">
<xsl:value-of select="#ATO"/>
</a>
</td>
</tr>
However it only shows the "ATO" text, it doesn't display the hyperlink. I am pretty new to using SharePoint designer so I'm not to sure where to go from here.
Sample test demo:
<tr>
<td width="190px" valign="top" class="ms-formlabel">
<H3 class="ms-standardheader">
<nobr>Employee Type</nobr>
</H3>
</td>
<td width="400px" valign="top" class="ms-formbody">
<a href="https://intelshare.intelink.gov/sites/carm/Shared%20Documents/ATO%20Letters/{#Company_x0020_name}.pdf">
<xsl:value-of select="#Employee_x0020_Type"/>
</a>
<xsl:value-of select="#Employee_x0020_Type"/>
</td>
</tr>
Result:

how to print the product variants in report sale order

I want to print the variants product as a description of the product in report sale order. For that i have added a new tag th description and i have used span t-esc="', '.join([x.attribute_id for x in o.order_line.product_id.product_tmpl_id.attribute_line_ids])"/ but it shows error QWebException: "sequence item 0: expected string, product.attribute found" while evaluating
"', '.join([x.attribute_id for x in doc.order_line.product_id.product_tmpl_id.attribute_line_ids])" .Any help please ?
<t t-foreach="doc.order_line" t-as="l">
<tr t-if="l.product_uom_qty">
<td>
<span t-field="l.product_id.name"/>
</td>
<td>
<span><t t-esc="', '.join([x.attribute for x in doc.order_line.product_id.product_tmpl_id.seller_ids])"/> </span>
</td>
<td>
<span t-field="l.product_id.default_code"/>
</td>
<td>
<span><t t-esc="', '.join([x.product_code for x in doc.order_line.product_id.product_tmpl_id.attribute_line_ids])"/> </span>
</td>
<td class="text-right">
<span t-field="l.product_uom_qty"/>
<span groups="product.group_uom" t-field="l.product_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td class="text-right">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), l.tax_id))"/>
</td>
</tr>
</t>
</tbody>
i find the solution and it works
<td>
<t t-foreach="l.product_id.attribute_line_ids" t-as="variant">
-<span t-field="variant.attribute_id"/>:
<span t-field="variant.value_ids.name"/>
</t>
</td>

Code after CFInclude seems to disappear or is not rendered

Having some issues with a ColdFusion application here. I'm trying to add in a <cfinclude template="header.cfm"/> and it renders correctly however the rest of the cf code seems to disappear, not sure if its not being rendered or just not showing up because of the cfinclude statement running. This is for a page header I'm trying to insert.
Is there a way to insert the cfincludes and have it stop so the rest of the page can process? Does my question make sense?
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="header.png" fwbase="default.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="1" -->
<tr>
<td><img name="grantpro" src="images/grantpro.gif" width="411" height="80" border="0" alt=""></td>
<td><img name="gpimage" src="images/gpimage.jpg" width="189" height="80" border="0" alt=""></td>
</tr>
<tr>
<td colspan="2" align="center">
<table width="599px" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td colspan="4"><div align="center"><font size="5"><strong>FDC Menu</strong></font></div></td>
</tr>
<td colspan="3"><strong>FDC Pending Proposals:</strong></td>
</tr>
<tr>
<td> </td>
<td colspan="2">By Applicant Name</td>
</tr>
<tr>
<td> </td>
<td colspan="2">By Grant Type</td>
</tr>
<tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="3"><strong>FDC Funded Proposals:</strong></td>
</tr>
<tr>
<td> </td>
<td colspan="2"><strong><em>Current Year</em></strong></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>By Applicant Name</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>By Grant Type</td>
</tr>
<tr>
<td> </td>
<td colspan="2"><em><strong>Prior Years</strong></em></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>By Applicant Name </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>By Grant Type</td>
<cfinclude template="cssmenu/header.cfm"/>
</table>
<p align="center"><strong>Logout</strong></p> </td>
The following code shows where the problem is
<tr>
<td> </td>
<td> </td>
<td>By Grant Type</td>
<cfinclude template="cssmenu/header.cfm"/>
</table>
Solution 1:
This is the recommended solution
The <cfinclude> probably should be moved outside of the </table>
Solution 2:
cssmenu/header.cfm would need to finish the current table row and start an new one. This is not recommended. It is not modular at all.
</tr>
<tr>
<td colspan="3">
... Content goes here ...
</td>
</tr>
You are missing a </tr> before the <cfinclude>. Also it seems like an odd place to include a header, rather add another table row and td and include the header inside of the <td> not in between the table code as this is causing it to break.

How to disable HappyAxis.jsp page from axis2 web service?

For Security reasons. I dont want to display my server details to anybody.
http://:/MyServices/axis2-web/HappyAxis.jsp
When i clicked above link it shows my server related details.
How to disable HappyAxis.jsp page from axis2 web service?
You need to make 2 changes.
1) Remove the following code from the index.jsp file in the WAR file / Web Application
<li>Validate
<br/>
Check the system to see whether all the required libraries are in place
and view the system information. </li>
Folder --> WebContent\axis2-web\index.jsp / Warfile\axis2-web\index.jsp
Modified index.jsp code
<%# page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<jsp:include page="include/httpbase.jsp"/>
<title>Axis 2 - Home</title>
<link href="axis2-web/css/axis-style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<jsp:include page="include/header.inc" />
<br/>
<h1>Welcome!</h1>
Welcome to the new generation of Axis. If you can see this page you have
successfully deployed the Axis2 Web Application. However, to ensure that Axis2
is properly working, we encourage you to click on the validate link.
<br/>
<ul>
<li>Services
<br/>
View the list of all the available services deployed in this server.
</li>
<%--<li>Do an interop test
<br/>
You can run Interoperability tests here
</li>--%>
<li>Administration
<br/>
Console for administering this Axis2 installation.
</li>
</ul>
<jsp:include page="include/footer.inc"/>
</body>
</html>
2) Rename the HappyAxis.jsp to a new name (Say ServerDetails.jsp) and modify the LeftFrame.jsp to show the newly created ServerDetails.jsp. By this way only when you login you can see the HappyAxis.jsp / ServerDetails.jsp link.
<tr>
<td colspan="2" >
<b>Happy Axis</b>
</td>
</tr>
<tr>
<td>
</td>
<td>
Validate
</td>
</tr>
Complete modified LeftFrame.jsp
<%--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
--%>
<%# page import="org.apache.axis2.Constants" %>
<%# page import="org.apache.axis2.context.ConfigurationContext" %>
<%# page import="org.apache.axis2.context.ServiceContext" %>
<%# page import="org.apache.axis2.context.ServiceGroupContext" %>
<%# page import="org.apache.axis2.deployment.util.PhasesInfo" %>
<%# page import="org.apache.axis2.description.AxisModule" %>
<%# page import="org.apache.axis2.description.AxisOperation" %>
<%# page import="org.apache.axis2.description.AxisService" %>
<%# page import="org.apache.axis2.description.AxisServiceGroup" %>
<%# page import="org.apache.axis2.description.Parameter" %>
<%# page import="org.apache.axis2.engine.AxisConfiguration" %>
<%# page import="org.apache.axis2.engine.Handler" %>
<%# page import="org.apache.axis2.engine.Phase" %>
<%# page import="org.apache.axis2.util.JavaUtils" %>
<%# page import="java.util.ArrayList" %>
<%# page import="java.util.Collection" %>
<%# page import="java.util.Enumeration" %>
<%# page import="java.util.HashMap" %>
<%# page import="java.util.Hashtable" %>
<%# page import="java.util.Iterator" %>
<%# page contentType="text/html;charset=UTF-8" language="java" %>
<table width="100%" style="border-right:1px solid #CCCCCC;">
<tr>
<td colspan="2" >
<b>Tools </b>
</td>
</tr>
<tr>
<td>
</td>
<td>
Upload Service
</td>
</tr>
<tr>
<td colspan="2" >
<b><nobr>System Components </nobr></b>
</td>
</tr>
<tr>
<td>
</td>
<td >
Available Services
</td>
</tr>
<tr>
<td>
</td>
<td >
Available Service Groups
</td>
</tr>
<tr>
<td>
</td>
<td >
Available Modules
</td>
</tr>
<tr>
<td>
</td>
<td>
Globally Engaged Modules
</td>
</tr>
<tr>
<td>
</td>
<td >
Available Phases
</td>
</tr>
<tr>
<td colspan="2" >
<b>Execution Chains</b>
</td>
</tr>
<tr>
<td>
</td>
<td>
Global Chains
</td>
</tr>
<tr>
<td>
</td>
<td>
Operation Specific Chains
</td>
</tr>
<tr>
<td colspan="2" >
<b>Engage Module</b>
</td>
</tr>
<tr>
<td>
</td>
<td>
For all Services
</td>
</tr>
<tr>
<td>
</td>
<td>
For a Service Group
</td>
</tr>
<tr>
<td>
</td>
<td>
For a Service
</td>
</tr>
<tr>
<td>
</td>
<td>
For an Operation
</td>
</tr>
<tr>
<td colspan="2" >
<b>Services</b>
</td>
</tr>
<tr>
<td>
</td>
<td>
Deactivate Service
</td>
</tr>
<tr>
<td>
</td>
<td>
Activate Service
</td>
</tr>
<tr>
<td>
</td>
<td>
Edit Parameters
</td>
</tr>
<tr>
<td colspan="2" >
<b>Contexts</b>
</td>
</tr>
<tr>
<td>
</td>
<td>
View Hierarchy
</td>
</tr>
<tr>
<td colspan="2" >
<b>Happy Axis</b>
</td>
</tr>
<tr>
<td>
</td>
<td>
Validate
</td>
</tr>
</table>
Also the new jsp ServerDetails.jsp can be accessed by the user if they know the path. If you want secure futher either you delete the Happy axis jsp and remove reference from the index.jsp or else modify the AdminServlet to add security validation for this JSP org.apache.axis2.transport.http.AxisAdminServlet