I am working on a project where my client requires a feature in alfresco where a dropdown is selected automatically a textbox should be visible below that dropbox.
Can anybody help me with this?
Do i have to create a java class for this?
I am very new to this software.
Thanks in advance
you do not have need to create a java class for this you can do it using simply by surf page to create a surf page refer this link.
http://docs.alfresco.com/5.0/tasks/dev-extensions-share-tutorials-add-page.html
add your code of dropdown component and a textbox below it as html in .ftl file as explained above documentation link.
or you can do it by using binding share webscript to ftl page
http://docs.alfresco.com/5.0/tasks/dev-extensions-share-tutorials-add-page.html
If you wanted to get display your data in this page so you have to bind your webscript component to this page ex.
ftl file.
<#include "/org/alfresco/include/alfresco-template.ftl" />
<#templateHeader></#>
<#templateBody>
<#markup id="alf-hd">
<div id="alf-hd">
<#region scope="global" id="share-header" chromeless="true"/>
</div>
</#>
<#markup id="bd">
<div id="bd">
<#region scope="template" id="test-id"/>
</div>
</#>
</#>
<#templateFooter>
<#markup id="alf-ft">
<div id="alf-ft">
<#region id="footer" scope="global" />
</div>
</#>
</#>
template-instance file
<template-instance>
<template-type>org/alfresco/<<temp-type>></template-type>
<components>
<component>
<region-id>test-id</region-id>
<url>/components/test-url</url>
</component>
</components>
</template-instance>
This tag's ID must be same as your component's id which you have to define in your template-instance files for creating component refer this link
http://docs.alfresco.com/5.2/references/surf-object-xml-reference-component.html http://docs.alfresco.com/5.1/concepts/dev-extensions-share-surf-web-scripts.html
<#region scope="template" id="test-id"/>
refer this link for creation of webscript component
http://docs.alfresco.com/5.1/concepts/dev-extensions-share-surf-web-scripts.html your webscript url must be same as coponent's url
/components/test-url
Related
<a href="printAllocation.action?event=printAllocation&fundAlias=%{fundAlias}&fundName=%{fundName}&lendFromMonth=%{lendFromMonth}&lendFromYear=%{lendFromYear}&partListDate=%{partListDate}&partListType=%{partListType}&secLendIncome=%{secLendIncome}"
onClick="NewWindow(this.href,'Warning','1000','800','Yes');return false;">
<s:submit value="Print" cssClass="btnRedApple">
</s:submit></a>
Hi! in the above code I'm trying to pass the values from the current jsp to new window by using anchor tag for the button "print" but in new window I'm not getting the values.
This is done for the struts2 migration so can any one please help me in resolving this issue. how can I pass the value to the new window
Looks like you have a URL with many parameters. What makes it worse is including the URL in anchor tag. I suggest you use s:url of stuts 2.
Struts 2 “url” tag is used to create an URL and output it as a text
format. It’s never work by itself, but it can provides URL to other
tags like to create a hyperlink or to render an image
<s:url action="printAllocation.action" var="urlTagValue" >
<s:param name="event">printAllocation</s:param>
<s:param name="fundAlias" value="%{fundAlias}"></s:param>
<s:param name="fundName" value="%{fundName}"></s:param>
...//all the other parameters
</s:url>
this essentailly generates output in text format like below.
/theDomainOfYourWebApp/printAllocation.action?event=printAllocation&fundAlias=...
Add then use it your anchor tag
<a href="<s:property value="#urlTagValue" />" onClick="NewWindow(this.href,'Warning','1000','800','Yes');return false;>URL Tag Action (via property)</a>
We are currently converting a Spring mvc/jsp app into a jsf app.
Previously we could import the content of a JSP segment file into a text area like this
<textarea id="sectionSixPointOne" name="sectionSixPointOne">
<jsp:include page="sect_six_point_one.jspf"/>
</textarea>
Magically the content of the jsp appeared into the content of the text area.
We are trying to do the same with JSF, but I am about ready to shoot myself in the face.
We've tried
<h:inputTextarea id="sectionSixPointOne">
<ui:include src="section_six_sect_one.xhtml"/>
</h:inputTextarea>
But it includes the content after the textarea not inside it.
I have tried to include the content of as the value parameter of h:inputTextarea but the compiler gets it's knickers in a knot about the syntax/quotes/anglebrackets etc.
<h:inputTextarea id="sectionSixPointOne" value=<ui:include src="section_six_sect_one.xhtml"/>
</h:inputTextarea>
I would much rather include the content directly in the jsf pages rather than mucking about loading it into a backing bean.
Anyone got any ideas can what I want to do be done with jsf (apologies for any idiocy I am a total JSF newb?
Just put the <h:inputTextarea id="sectionSixPointOne"> with it's value to include in the file you want to include.
That way you don't need to insert it in some component, you just extracted the whole thing into its own file.
So you code looks like:
<ui:include src="section_six_sect_one.xhtml"/>
and in section_six_sect_one.xhtml":
<ui:composition xmlns=... >
<h:inputTextarea id="sectionSixPointOne" value="yourIncludedText"/>
...
I'm trying to add an action to a link inside a list item
It's inside a form:
<form name="searchForm" method="post" action="searchThis" id="querySubmiter">
Inside a list:
<li><img src="img/Logo/myLogo.png"/>
I'm a bit clueless as to how to make the connection.
Is it possible?
Use Struts 2 tags like
<s:a action="searchThis"><img src="<s:url value="/img/Logo/myLogo.png"/>"/></s:a>
There would be generated an anchor tag with the image. Note to use <s:url> tag to correctly define the path to the static resource. Also combined with <s:param> tag you could construct any link. See the documentation with example of the <s:a> tag.
I am working on a Java (Struts) based web application. I have to show some content by getting from DB in jsp. Example content:
<div>
some code here
<a> link here</>
</div>
I am using textarea for the time but when I put this into textarea using following tag:
<html:textarea property = "contentFromDB" rows = "12" cols = "70" styleClass = "textarea" disabled="true"/>
It shows the HTML in the textarea, is there any way I may show the content in the textarea with out HTML tags or I may show the content in any other tag like P or span, I cannot find these tags in the struts tagLib as well.
The <html:xxx> tags are for forms.
The best practice is to use JSTL's <c:out> with an appropriately-scoped object (e.g., a request attribute) and set escape to false:
<c:out value="xxx" escapeXml="false" />
Alternatively if you're on an antiquated container or just have nothing better to do, use the <bean:write> tag. I don't recall its escaping behavior(s), if any.
I am currently using Struts2 tags for my form, and to show its error messages. My question is that the default markup for showing error messages in Struts2 tags is the usage of <ul> tag. is there anyway I can change this? I want the error messages to be displayed as <span> not a list.
How would I achieve this?
Another option is to change the CSS for UL elements.
This approach works only if you specifically care about appearance, not the DOM itself.
You can override template files which are used for rendering errors. Copy actionerror.ftl and fielderror.ftl files from the simple theme from struts2-core jar to your application and modify them not to use ul/li tags.
The tags render according to their theme. The question then changes to: How do you change the theme? You can change it for the tag
(set theme attribute on the tag to simple), page, request, or generally.
http://struts.apache.org/2.2.1/docs/struts-2-themes.html
Personally I like writing html, that is I don't like any "help" from the struts2 default theme. So in my struts.xml I simply use:
<constant name="struts.ui.theme" value="simple" />
Web developers should know html.
Update:
Generally use YUI reset.css so I probably missed this...
If you extend ActionSupport on the action there is a getFieldErrors() method so you could use <s:property value='fieldError["field_name"]'/> that will return the associated error message string of course without any formatting.
It isn't much less readable than the <s:fielderror/> tag... after all we need to use property tags all the time anyways.
I had same issue I used following code to resolve my issue
<s:if test="fieldErrors.get('email').size() > 0">
<s:property value="fieldErrors.get('email').get(0)"/>
</s:if>
Where email is name of my field. This way we don't have to modify CSS.
Here is a tutorial to show the use of the Struts 2′s ActionError and ActionMessage class.
http://www.mkyong.com/struts2/struts-2-actionerror-actionmessage-example/
ActionError – is used to send error feedback message to user – display via < s:actionerror/ >
<s:if test="hasActionErrors()">
<div class="errors">
<s:actionerror/>
</div>
</s:if>
ActionMessage – is used to send information feedback message to user,display via < s:actionmessage/ >
<s:if test="hasActionMessages()">
<div class="welcome">
<s:actionmessage/>
</div>
</s:if>