Tiles insertAttribute Tag Error - struts2

I am new to StackOverflow, I am currently working on Tiles in struts2. Every thing coming up without error in the code. But when I run it on server, It tells that:
javax.servlet.ServletException: javax.servlet.jsp.JspException: Error
executing tag: Attribute 'menu' not found.
I added jar files as instucted.
Can anyone help me out??
<body>
<tiles:insertAttribute name="menu"></tiles:insertAttribute>
<tiles:insertAttribute name="footer"></tiles:insertAttribute>
</body>
}
Here is my Tiles.xml...
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"><tiles-definitions><definition name="baseLayout" template="/baseLayout.jsp">
<put-attribute name="title" value="Template"/>
<put-attribute name="banner" value="/banner.jsp"/>
<put-attribute name="menu" value="/menu.jsp"/>
<put-attribute name="body" value="/body.jsp"/>
<put-attribute name="footer" value="/footer.jsp"/></definition>
`<definition name="tiger" extends="baseLayout">
<put-attribute name="title" value="Tiger"/>
<put-attribute name="body" value="/tiger.jsp"/></definition>
<definition name="lion" extends="baseLayout">
<put-attribute name="title" value="Lion"/>
<put-attribute name="body" value="/lion.jsp"/> </definition></tiles-definitions>
`

Related

TFS2013 Requiring Comments on transitions to certain states

I'm creating a TFS 2013 Kanban board. I want to require an additional comment when the user switches the State to "Blocked From Progress"
Based on this post (http://social.msdn.microsoft.com/Forums/vstudio/en-US/9b672f4c-3054-481a-856d-4da650f25f74/how-to-require-comments-during-state-transition?forum=tfsprocess) I can require comments on all state changes. How do I limit it to just a transition to the "Blocked From Progress" State? Here's a section of code from my exported User Story xml file:
<FIELD name="HistoryHelper" refname="Demo.HistoryHelper" type="String">
<WHENNOT field="System.State" value="Blocked From Progress">
<COPY from="value" value="1" />
</WHENNOT>
<WHEN field="System.History" value="">
<COPY from="value" value="0" />
</WHEN>
<WHENNOT field="System.History" value="">
<COPY from="value" value="1" />
</WHENNOT>
<WHENCHANGED field="System.State">
<PROHIBITEDVALUES>
<LISTITEM value="0" />
</PROHIBITEDVALUES>
</WHENCHANGED>
</FIELD>
This is almost exactly the code from the above link, but I've added a check for the value of the State. Those lines don't seem to change the behavior at all. I've tried them at different places in the XML to no avail. Also, I've tried nesting a inside a and got errors. I don't know if there's a way to do an AND inside a WHEN.
EDIT
In addition to the accepted answer, I updated the new Field definition to be as follows:
<FIELD name="Blocked Reason" refname="CustomerProjects.BlockedReason" type="HTML" >
<WHENNOT field="System.State" value="Blocked From Progress">
<COPY from="value" value="" />
<READONLY />
</WHENNOT>
</FIELD>
I think a good solution for this would be to create a new field called "Blocked Reason" and then make it required on transitions into the "Blocked From Progress" state. You'd implement this like:
<Fields>
...
<FIELD name="Blocked Reason" refname="<company>.BlockedReason" type="HTML" />
...
</FIELDS>
<WORKFLOW>
...
<TRANSITIONS>
...
<TRANSITION from="<somestate>" to="Blocked From Progress">
...
<FIELDS>
<FIELD refname="<company>.BlockedReason">
<REQUIRED />
</FIELD>
</FIELDS>
</TRANSITION>
...
</TRANSITIONS>
...
</WORKFLOW>
You'd need to set that for each possible transition into the "Blocked From Progress" state. If you wanted you could also remove the text from the field using the tag on transitions out of the "Blocked From Progress" state.

Iterator (with struts2) is not working

I am trying to show a List. But nothing is displayed.
I used this tutorial:
http://www.roseindia.net/struts/struts2/struts2controltags/iterator-tag.shtml
but actually it is not working
Does anybody sees an error in this tutorial?
edit:
Thats ShowKeywords.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%#taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<title>Iterator Tag Example!</title>
</head>
<body>
<h1><span style="background-color: #FFFFcc">Iterator Tag Example!</span></h1>
<s:iterator value="myList" status="myListStatus">
<s:property /><br>
</s:iterator>
</body>
</html>
Struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<!-- mapping of global-results and global-exceptions -->
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
<constant name="struts.devMode" value="false"/>
<package name="default" extends="struts-default" namespace="/">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<default-action-ref name="Start"/>
<action name="ShowTest" class="de.nordakademie.librarymgmt.action.ShowTest">
<result>showKeywords</result>
</action>
</package>
</package>
</struts>
tiles
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="main" template="/jsp/main.jsp">
<put-attribute name="title" value="Dashboard"/>
<put-attribute name="menu" value="/jsp/menu.jsp"/>
<put-attribute name="header" value="/jsp/header.jsp"/>
<put-attribute name="content" value="/jsp/start.jsp"/>
</definition>
<definition name="showKeywords" extends="main">
<put-attribute name="title" value="Stichworte anzeigen"/>
<put-attribute name="content" value="/jsp/ShowKeywords.jsp"/>
</definition>
</tiles-definitions>
action ShowTest
package de.nordakademie.librarymgmt.action;
import com.opensymphony.xwork2.ActionSupport;
import java.util.*;
public class ShowTest extends ActionSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
private List<String> myList;
public String execute()throws Exception{
myList = new ArrayList<String>();
myList.add("Fruits");
myList.add("Apple");
myList.add("Mango");
myList.add("Orange");
myList.add("Pine Apple");
return SUCCESS;
}
public List<String> getMyList(){
return myList;
}
}
</package> is closed twice in struts.xml (a well-indented code would have immediately shown that);
you are returning a standard result, not a Tiles result; put default="true" in your result definition:
<result-type name="tiles"
default="true"
class="org.apache.struts2.views.tiles.TilesResult" />
2.0 DTD is old, update it with the correct DTD.
Ensure you have all the libraries needed and that they're the right versions.

TFS OData workitem get last insert id

I'm using TFS OData service to create work item which is work fine. now i need to get id of work item and insert into database for later reference can anyone guide me direction for this ?
here is what i get as a response.
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="https://tfsodata.visualstudio.com/DefaultCollection/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:etag="W/"datetime'2013-08-31T10%3A23%3A21.1439028%2B00%3A00'"" xmlns="http://www.w3.org/2005/Atom">
<id>https://tfsodata.visualstudio.com/DefaultCollection/WorkItems(0)</id>
<title type="text">my test work item</title>
<summary type="text">test work item created by isuru http://www.google.com</summary>
<updated>2013-08-31T10:23:21Z</updated>
<author>
<name />
</author>
<link rel="edit" title="WorkItem" href="WorkItems(0)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Attachments" type="application/atom+xml;type=feed" title="Attachments" href="WorkItems(0)/Attachments" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Links" type="application/atom+xml;type=feed" title="Links" href="WorkItems(0)/Links" />
<category term="Microsoft.Samples.DPE.ODataTFS.Model.Entities.WorkItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int32">0</d:Id>
<d:Project>My Website</d:Project>
<d:Type>Product Backlog Item</d:Type>
<d:WebEditorUrl m:null="true" />
<d:AreaPath m:null="true" />
<d:IterationPath m:null="true" />
<d:Revision m:type="Edm.Int32">0</d:Revision>
<d:Priority m:null="true" />
<d:Severity m:null="true" />
<d:StackRank m:type="Edm.Double">0</d:StackRank>
<d:AssignedTo m:null="true" />
<d:CreatedDate m:type="Edm.DateTime">2013-08-31T10:23:21.1419032+00:00</d:CreatedDate>
<d:CreatedBy m:null="true" />
<d:ChangedDate m:type="Edm.DateTime">2013-08-31T10:23:21.1439028+00:00</d:ChangedDate>
<d:ChangedBy m:null="true" />
<d:ResolvedBy m:null="true" />
<d:Title>my test work item</d:Title>
<d:State m:null="true" />
<d:Reason m:null="true" />
<d:CompletedWork m:type="Edm.Double">0</d:CompletedWork>
<d:RemainingWork m:type="Edm.Double">0</d:RemainingWork>
<d:Description>test work item created by isuru http://www.google.com</d:Description>
<d:ReproSteps m:null="true" />
<d:FoundInBuild m:null="true" />
<d:IntegratedInBuild m:null="true" />
<d:AttachedFileCount m:type="Edm.Int32">0</d:AttachedFileCount>
<d:HyperLinkCount m:type="Edm.Int32">0</d:HyperLinkCount>
<d:RelatedLinkCount m:type="Edm.Int32">0</d:RelatedLinkCount>
<d:Risk m:null="true" />
<d:StoryPoints m:type="Edm.Double">0</d:StoryPoints>
<d:OriginalEstimate m:type="Edm.Double">0</d:OriginalEstimate>
<d:BacklogPriority m:type="Edm.Double">0</d:BacklogPriority>
<d:BusinessValue m:type="Edm.Int32">0</d:BusinessValue>
<d:Effort m:type="Edm.Double">0</d:Effort>
<d:Blocked m:null="true" />
<d:Size m:type="Edm.Double">0</d:Size>
</m:properties>
</content>
</entry>
What I did was adding a Guid to a random field that you are not using and query for that Guid afterwards.
wi.Title = "New Work Item";
wi.FoundInBuild = Guid.NewGuid().ToString();
wi.Type = "Bug";
wi.Project = "TestProject";
context.AddToWorkItems(wi);
context.SaveChanges();
Debug.WriteLine(String.Format("Work item created"));
var createdWi = context.WorkItems.Where( d => d.FoundInBuild == wi.FoundInBuild);

How to retrieve data using xml

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<MasterDetailsResponse xmlns="http://192.168.100.173/ArvindMill/">
<MasterDetailsResult>
<GetAllMasterDetail>
<TABLENAME>item_master</TABLENAME>
<ITEMID>1</ITEMID>
<ITEMTYPE>CTS</ITEMTYPE>
<GROUP />
<VARIETY />
<FORM />
<STATUS />
<ITEM />
<GRADE />
<TYPE />
</GetAllMasterDetail>
<GetAllMasterDetail>
<TABLENAME>item_master</TABLENAME>
<ITEMID>2</ITEMID>
<ITEMTYPE>AGS</ITEMTYPE>
<GROUP /><VARIETY />
<FORM />
<STATUS />
<ITEM />
<GRADE />
<TYPE />
</GetAllMasterDetail>
<GetAllMasterDetail>
<TABLENAME>tablet_taluka_master</TABLENAME>
<VILLAGE>Anturli</VILLAGE>
<TALUKA>Anturli</TALUKA>
<TABLETUSERCODE />
<TABLETUSERNAME /><TABLETCODE />
<TABLETTALUKAID />
</GetAllMasterDetail>
<GetAllMasterDetail>
<TABLENAME>tablet_taluka_master</TABLENAME>
<VILLAGE>Bortha</VILLAGE>
<TALUKA>Sadgavan</TALUKA>
<TABLETUSERCODE /><TABLETUSERNAME />
<TABLETCODE />
<TABLETTALUKAID /></GetAllMasterDetail>
<GetAllMasterDetail>
<TABLENAME>tablet_taluka_master</TABLENAME>
<VILLAGE>Kukarmunda</VILLAGE>
<TALUKA>Kukarmunda</TALUKA>
<TABLETUSERCODE />
<TABLETUSERNAME /><TABLETCODE /><TABLETTALUKAID />
</GetAllMasterDetail>
The above code is the response returned from soapobject in android. How to retrieve the data from the above XML file? I want to display it in list view and the response returned from the soapobject contains more than one table so how to retrieve it?
If your are using Java use SAX Parser

How to manage resources in an F# project?

Can I use .resx files in F# 2.0 projects?
If so, how do I go about adding, and then using these resources.
Thanks in advance.
You can Add existing item a .resx file to an F# project, it should automatically get a BuildAction of EmbeddedResource and work. The VS tooling here isn't as good as the other languages yet, but MSBuild does all the heavy lifting, so it's just a matter of getting the right snippet of XML into the .fsproj file.
I'm using a .resx in an F# 2.0 project. Feel free to take a look at it and I hope it helps you. No great shakes but here it is for what it's worth.
http://github.com/OnorioCatenacci/ExtendedSearch
EDIT: For what it's worth, here's the relevant portion of the fsproj file
<ItemGroup>
<Compile Include="assemblyinfo.ExtendedSearch.exe.fs" />
<Compile Include="ExtendedSearch.fs" />
<EmbeddedResource Include="ExtendedSearch.resx" />
</ItemGroup>
And here's ExtendedSearch.resx:
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, ...</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, ...</value>
</resheader>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<data name = "AppDisplayName">
<value>Extended Search</value>
</data>
<data name="FilePathSpecLabel">
<value>Base File Path:</value>
</data>
<data name="FilePathSpecDefault">
<value>C:\</value>
</data>
<data name ="SelectDirButtonLabel">
<value>. . .</value>
</data>
<data name="FileNameSpecLabel">
<value>File Name Spec:</value>
</data>
<data name="FileNameSpecDefault">
<value>*.dll</value>
</data>
<data name="RecurseIntoSubdirsLabel">
<value>Recurse Into Subdirectories</value>
</data>
<data name ="MajorVerDefault">
<value>1</value>
</data>
<data name="MinorVerDefault">
<value>0</value>
</data>
<data name="RevisionVerDefault">
<value>0</value>
</data>
<data name="BuildVerDefault">
<value>0</value>
</data>
<data name="VersionLabel">
<value>File &Version:</value>
</data>
<data name="SearchButtonCaption">
<value>&Search</value>
</data>
<data name="CancelButtonCaption">
<value>&Cancel</value>
</data>
</root>
I hope this removes any future issues with people not being able to find this on GitHub.
Here is another way. Though I know it's too late for the original question, I hope it helps others.
Create a clean text file with a name=value format, one key/value pair per line. In a file named "strings.txt", write
name1=hello
name2=world
Create a resource file using ResGen.exe acting on your text file from Step 1. You can learn about ResGen at http://msdn.microsoft.com/en-us/library/ccec7sz1%28v=vs.80%29.aspx. ResGen will create a CLR binary file named "strings.resources". Put this resource file where your compiler can find it.
Add "--resource:strings.resources" as a compiler option. I did this from the "Other flags" textbox in the Build properties. You can find more info at http://msdn.microsoft.com/en-us/library/dd233171.aspx
Write the following in your F# project
open System.Resources
let res = ResourceManager("strings", System.Reflection.Assembly.GetExecutingAssembly())
res.GetString("name1") + res.GetString("name2") |> printfn "%s"
To add a resource to an existing F# project, per #"Onorio Catenacci" GitHub Linke above...
Create a text file and fill it with the content below then save and close it.
Rename this text file extension to .resx (XML resource file)
Update the Build Action to EmbeddedResource
The file should now open correctly in the VS resource editor allowing you to edit it's contents.
.resx file template:
<root>
<resheader name="resmimetype"><value>text/microsoft-resx</value></resheader>
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, ...</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, ...</value></resheader>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</root>

Resources