In Struts 1, What is the Default Value of Type Attribute of <action> tag? - struts-1

In Struts 1, if the type attribute of the <action> tag has no value, what does it mean? Is there a default value for the type attribute that is used when it is not explicitly specified.
I'm basically trying to figure out what the following action does; as you can see it has no type attribute; it only has path and forward attributes:
<action path="/a/b/comp" forward="/components/d/my-comp.jsp">
</action>

The action that you have included above simply redirects from /a/b/comp.do to /components/d/my-comp.jsp. It is a shorthand for the following:
<action path="/a/b/comp"
parameter="/components/d/my-comp.jsp"
type="org.apache.struts.actions.ForwardAction">
</action>
So, for the action that you have included the type attribute is org.apache.struts.actions.ForwardAction.

Related

Marklogic - Xpath using get attribute value

I have displayed sample Xml data in below , If title lang ="it" then i want to get category attribute value ?
<book category="CLASSICS">
<title lang="it">Purgatorio</title>
<author>Dante Alighieri</author>
<year>1308</year>
<price>30.00</price>
</book>
"If title lang ="it" then i want to get category attribute value ?"
The XPath should be straightforward :
//book[title/#lang='it']/#category
You can also use following XPATH Expression.
doc("XML-URI")/book[title/#lang/string() eq "it"]/#category

param tag giving me a parsing error

this simple html5 example gives me an 'element param cannot be nested inside of element body'
error when using webmatrix 3 as a parser:
<body>
<object id = "a">
<param name = "b" id = "c">
</object>
</body>
Why the error, and what is another program I could use to check the syntax?
Ignore the webmatrix3 parser. It's valid HTML5:
W3 param tag
W3 valid global attributes
id is not an approved attribute. Try using the approved attributes for the object element as listed here:
http://www.w3schools.com/tags/tag_param.asp
I hope that helps.

Magento Block Tag

Please explain all the attributes of Magento block tag
<block type="catalog/product_featured" name="product_featured"
as="product_featured"
template="catalog/product/featured.phtml"></block>
<block type="catalog/product_featured" name="product_featured" template="catalog/product/featured.phtml">
<action method="setLimit"><limit>2</limit></action>
</block>
also why do we need two times the block tag
type = PHP file the template will look for the methods.. Here it is Mage_Catalog_Block_Product_Featured.php
name = Name of the block. It should be unique in the page.
as = Alias. Smaller form of name. It should be unique in it's parent block.
template = The template file (View) this block is attached to. You can call methods from block type inside this by using $this.. e.g. $this->getName()
name vs. as example:
<reference name="left">
<block type="block/type1" name="first_block" template="template1.phtml">
<block type="abc/abc" name="abc" as="common" template="abc.phtml"/>
</block>
<block type="block/type2" name="second_block" template="template2.phtml">
<block type="xyz/xyz" name="xyz" as="common" template="xyz.phtml"/>
</block>
</reference>
So, you can now call block name abc from first_block AND xyz from second_block as $this->getChildHtml('common');, but see both the blocks called will be different as per their calling parent.

make textfield required based on anther textfield in strtuts 2

in struts 2 how can i use the actionName-validation.xml to make a text field required based on another texfield value
i think this is done using custom validator but how?
i don't want to use javascript to do this.
You need something like this:
<validator type="required" short-circuit="true">
<param name="fieldName">textfield1</param>
<message>You must enter a value for textfield1.</message>
</validator>
<validator type="required" short-circuit="true">
<param name="fieldName">textfield2</param>
<message>You must enter a value for textfield2.</message>
</validator>
<validator type="expression">
<param name="expression">textfield1 gt textfield2</param>
<message>textfield2 must be greater than textfield1.</message>
</validator>
See the "Short-Circuiting Validator" docs.

XPath query to select all href attributes of <a> tag, which 'class' attribute equals specified string

I don't know why following query doesn't work:
//a/#href[#class='specified_string']
Try it the other way round:
//a[#class='specified_string']/#href
After all, class is an attribute of the <a> element, not an attribute of the href attribute.
An attribute cannot have attributes. Only elements can have attributes.
The original XPath expression:
//a/#href[#class='specified_string']
selects any href attribute of any a element, such that the href attribute has an attribute class whose value is 'specified_string'.
What you want is:
//a[#class='specified_string']/#href
that is: the href attribute of any a element that has class atribute with value 'specified_string'.
You basically say that you are looking for an attribute named href, whose attribute (this is the error) class should be equal to specified_string.
But you need to find the attribute href of an element a, whose attribute class is specified_string.
(ndim's answer overlapped mine)
There is not class attribute present in anchor tag I have href only. It is identified using //*[#href='value'] but //*a[#href='value'] is not working

Resources