I'm using Jdevloper 11g R2 and I have a .JSPX page that contains an ADF Rich Text Editor.
This editor can contain text and Images and different styles.
how can i pass the value of this editor to my bean?
my goal is to take this value and send it as a body in my email.
but how it can be stored? should it be saved as a string eventhough the editor have images?
any help is really appreciated
Thank you
You can create binding for the RichTextEditor which will be of type oracle.adf.view.rich.component.rich.input.RichTextEditor
as private RichTextEditor myEditor;
Write setter and getter methods for the component in your bean as below
public void setMyEditor(RichTextEditor myEditor) {
this.myEditor= myEditor;
}
public RichTextEditor getMyEditor() {
return myEditor;
}
Now you may access the value entered in the component with the getter method and use it as you wish.
The value of richTextEditor is stored as CLOB type in database.
Related
I've created a custom data type in umbraco and I would like to check the value before it is saved and provide error messages if it is not ok.
How do you enforce validation rules on a data type?
have you consider using ValidationProperty for this purpose?
Once you added the attribute, you can implement the property by adding your validation logic. This way you can make sure about data validation before you user save the record with new custom datatype.
E.g
[ValidationProperty("HasValidValue")]
public partial class MyDataEditor : System.Web.UI.UserControl,
umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
In your Custom datatype logic and then has something like following....
public string HasValidValue
{
get
{
if (CheckIfDataIsValid())
return "Valid";
else
return String.Empty;
}
}
This way you can do it at code level.
Thanks,
Jigar
I am new to struts 2. I created an action class that insert data from JSP page to a bean using ModelDriven interface.
The problem is that i have some non 'Stringproperties in the bean likeLong,Date` ... etc
The problem is:
when i press submit button in the jsp page i get an error saying that it did not find the a string setter for that particular property.
for example if i have in my bean
package com.hsms.aseza.enteringApproval
Class EnteringApproval
private Date approvalDate
Date getApprovalDate()
{
return employeeId;
}
void setApprovalDate(Date employeeId)
{
this.employeeId = employeeId;
}
when the action class that implement the model driven is executed, it fires a run time exception
java.lang.NoSuchMethodException: com.hsms.aseza.enteringApproval.EnteringApproval.setApprovalDate([Ljava.lang.String;)
Is there anyway to solve this problem without writing a String setter for my Date property?
I think that your problem is conversion i.e. conversion from String to your java.util.Date Object. This class extends this which is responsible for converting from String to other types like Long, Double etc. If you check the source code for DefaultTypeConverter, you won't see any conversion for either java.util.Date or java.sql.Date. So i think what you should do is to write a converter for approvalDate. My previous post on this will guide you on the procedure, all you will need is to edit the code to suit your needs.
On your jsp, follow this datepicker example
Use the same format i.e date format used to display your date in your jsp with SimpleDateFormat to do your conversion in convertFromString method of your converter and return the converted java.util.Date or java.sql.Date.
Let me know if you have issues implementing this.
Try use the s:date tag in your jsp.
Edit:
Try use:
<s:textfield key="objEnteringApproval.approvalDate"></s:textfield>
in which objEnteringApproval is your public accessible variable in your controller.
Make sure you have initialized your bean in your action class
Private YourBean bean = new YourBean();
Or you can have it in the constructor
Make sure your getter and setter are public
If you are trying to type date on the jsp page, please use datepicker e.g. sx:datetimepicker or sj:datepicker
I have a typed class in actionscript:
public class Cat {
public var id:int;
public var name:String;
}
I am using an instance variable in an mxml component:
<valueobjects:Cat id="selected_cat"/>
In IntelliJ the id for cat is coming up as an error, "invalid integer value", although it will compile without error. This error appears in the IDE when editing the file and lists it as an error at bottom. Does anyone know of any tricks to tell IntelliJ about this class or the property. Or are there any metadata tags to identify the attribute so the mxml parser will be happy?
Thanks in advanced.
Yes, the problem is, that usually id is a String used in markup to set an id of type String. Flex supports that via UIComponent or IMXMLObject. You should not use ValueObjects in the markup, unless the class implements IMXMLObject.
To declare a non-visual object in markup you have to use the fx:declarations tag in Flex 4 and above.
The id property in each mxml tag (whether visual or not) acts as a way to reference this object from the rest of the code.
In other words, its the markup equivalent of this.
var selected_car:Car
So the id has to be a String property always.
In your class you declare the id as an int property which is confusing for the compiler because it doesn't know which one is valid.
If you need to work with your class without changing it, you'll have to create instances using AS and not MXML. If you need to work with mxml (to have binding enabled etc) you'll need to change the property name to something like catID perhaps.
I've successfully created a custom field inheriting from SPFieldText and happily have complete control over rendering it on the input form as a control.
Problem:
I have a need to create a link to a popup with the ListId and ListitemID in the querystring when rendering the field using GetFieldValueAsHtml().
Something like this:
public class CustomField : SPFieldText
{
public CustomField (SPFieldCollection fields, string fieldName)
: base(fields, fieldName)
{
}
public CustomField (SPFieldCollection fields, string typeName, string displayName)
: base(fields, typeName, displayName)
{
}
public override string GetFieldValueAsHtml(object value)
{
return string.Format(
"javascript:window.open('{0}/_layouts/Popup.aspx?ListId={1}&ItemId={2}','Popup','status=0,scrollbars=0,titlebar=0,resizable=1,toolbar=0,location=0,width=600,height=500');return false;",
SPContext.Current.Web.ServerRelativeUrl.TrimEnd('/'),
LISTID, LISTITEM.ID
);
}
Clearly SPContext doesn't hold a reference to the list or item and none of the properties seem to expose the current item. I tried overloading properties in the control but these don't seem to be invoked when rendering the field.
// None of these properties are invoked when rendering the field as above
public class CustomFieldControl : TextField
{
public override object ItemFieldValue
public override object ListItemFieldValue
public override string Text
public override object Value
}
I've experimented with the RenderPattern in fldtypes_Custom.xml but again this is also ignored when rendering the field using GetFieldValueAsHtml();
Am I naively expecting something that's not possible?
I'm open to any approach that avoids rewriting the web part... or just tell me it can't be done.
(The existing web part renders a grid and calls GetFieldValueAsHtml(). We know we can change the web part to achieve this but that's not an ideal solution for other reasons).
Not sure if this will work with SharePoint 2007, but with SharePoint 2010 one can easily fetch the currently being displayed ListItem by using SPContext.Current.ListItem.
For anyone stumbling across this, I confirmed that what I was aiming to do is not possible.
We were forced to make changes in the web part to achieve this level of customization. As outlined in the question, The existing web part renders a grid and calls GetFieldValueAsHtml().
I am working on an ASP.NET MVC based CMS that presents a rather extreme case. The system must allow the user to add custom content types based on different fields, and for every field, one can add options and validations. The thing is that everything is stored in a complex DB and extracted at runtime using LINQ.
I am pretty fresh with ASP>NET MVC so the following dilemma came to mind
How should I make the content creation view so that form helpers are not predefined int he view code but are loaded based on the type of the field ? Do I have to create a factory class that checks the value of the type property of the field, and then returns a helper based on that or there's a better way to do it. This one seems pretty rigid to me , because anytime I make a change in the Fieldtypes table, I will have to make sure to create a check for that new type too.
public class CType {
string Name; //e.g Post Article etc
List<ContentData> data ;
...
}
public class ContentData {
string Data; // Basically this is the data stored for each field
FieldInstance fieldInstance;
...
}
public class FieldInstance {
string Title; // e.g Title Body etc.
FieldType Type ; // e.g textbox textarea image checkbox etc
...
}
public class FieldType {
string Type; // e.g textbox textarea image checkbox etc
...
}
I see an HTML Helper in your future. The HTML Helper can work through your Model at runtime and output the appropriate HTML for the View. If you go that route, I suggest you get to know the StringBuilder and TagBuilder classes. They'll simplify things and help make your HTML Helper much more readable.
I did not know about the concept of templated helpers. This is what happens when you're new to something. Pretty much, this is what fixed my problem
http://msdn.microsoft.com/en-us/library/ee308450%28VS.100,printer%29.aspx