Action form forward path not a url - servlets

What does it mean when I have a path like the example below in the first forward (then success forward)
<action
type="com.testpackage.servlettest"
path="/ClassHomepage"
scope="request">
<forward
name="success"
path=".class.homepage"
redirect="true" />
<forward
name="failure"
path="/Homepage.do"
module="/"
redirect="false" />
</action>
I understand the failure forward will forward to the page "/Homepage.do" if "failure" is returned
return mapping.findForward("failure");
But what happens if I return
return mapping.findForward("success");
What package will this try to load? How do I find out by looking at web.xml and struct-config.xml files?

You are using tiles, and you need to look in your tiles definition file (usually something like WEB-INF/tiles-defs.xml). Search for a <definition name=".class.homepage"> ... </definition> to find out which view it will direct to.

Related

xmlHTTP calling an Action gives me nothing

HTTP newbie here.
trying to call an action via. Postman.
Action looks like this:
<Action Name="SampleAction" IsBound="true">
<Parameter Name="bindingParameter" Type="NAV.DvTableDvProfile"/>
</Action>
My presumption was that something like this would work:
http://xxxx/DvTableDvProfile/SampleAction
I have tried different combinations of parameters etcetera.
The error I get:
: "The request URI is not valid. Since the segment 'DvTableDvProfile'
refers to a collection, this must be the last segment in the request
URI or it must be followed by an function or action that can be bound
to it otherwise all intermediate segments must refer to a single
resource."
Not sure where to go from here. Help is appreciated.

How can i remove the missing subpackage error in a phpcs ruleset?

I want to remove this because i dont need it on my project.
<rule ref="Squiz.Commenting.FileComment">
<properties>
<property name="subpackage" value="false"/>
</properties>
</rule>
See you
The way to exclude that specific error message in your ruleset.xml file is to use:
<exclude name="Squiz.Commenting.FileComment.MissingSubpackageTag" />
Use the -s command line argument to determine the code for a specific error message. You'll see something like this:
Missing #subpackage tag in file comment
(Squiz.Commenting.FileComment.MissingSubpackageTag)
If you want to exclude the whole sniff, you'd instead use:
<exclude name="Squiz.Commenting.FileComment" />
There are a lot of other things you can do in a ruleset file. See the docs for more examples: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml

Tiles - Spring MVC

What is the difference between
<tiles:useAttribute ...>
and
<tiles:insertAttribute ...>
Can you give some example?
See http://tiles.apache.org/2.2/framework/tiles-jsp/tlddoc/tiles/insertAttribute.html and http://tiles.apache.org/2.2/framework/tiles-jsp/tlddoc/tiles/useAttribute.html.
useAttribute declares a variable containing the attribute. insertAttribute inserts the attribute in the response. It's basically the same difference as there is between
String id = attributeValue("theAttribute");
and
out.println(attributeValue("theAttribute"));
Thanks #JB Nizet!
Actually i needed this tile attribute to be used in jsp page. I have found the difference and its almost same thing that you explained. However, I would like to share my example to those who are trying it on jsp page
code snippet of myLayout.jsp
<tiles:useAttribute name="my_title"/>
<c:if test="${not empty my_title}">
<tiles:insertAttribute name="my_title"/>
</c:if>
useAttribute will in some sense convert "my_title" into a variable which now can be manipulate as a normal jsp variable. This new variable will carry the value provided by tiles definition. Hence, the variable can be checked if its empty or blank and if it is not empty, the value is outputed to the browser(response) by using insertAttribute
Here is the sample tile definition:
<definition name="test" template="myLayout.jsp">
<put-attribute name="my_title" value="Web Blog" />
</definition>
enjoy!

spring webflow: redirect in end-state depending on some input

I have in my flow some input, i.e.
<input name="someInput" type="long" required="true"/>
and I'd like to redirect in an end-state to a location that depends on this input. I'm trying the following:
<end-state id="done" view="externalRedirect:contextRelative:/blahblah/${someInput}"/>
This is not working (the webflow does not replace ${someInput} with its value (it treats this as a standard string. Do you know how to do this properly?
If you are speaking about Webflow 2.0 please try
<end-state id="done" view="externalRedirect:contextRelative:/blahblah/#{someInput}"/>

Help with this (simple) regular expression...?

I'm using URL rewriting with my APS.NET application and haven't had much luck matching the following regular expressions...
<rewrite url="~/deals/(.+)$" to="~/Deals.aspx?deal_string=$1" />
<rewrite url="~/deals/(.+?)/edit$" to="~/EditDeals.aspx?deal_string=$1" />
I'm wanting a separate page for viewing a 'deal' to editing a 'deal'. I would like the URL to simply add '/edit' to a deal to go to the Edit Deal page.
Currently, all traffic goes to the first page.
The problem is that any url that matches the second one also matches with the first on (with a different $1 capture). Perhaps if you invert the sequence of declarations it will work. If the second and most specific is evaluated first it should do the job.
Also you could rewrite your expressions avoiding slash characters among your capture.
<rewrite url="~/deals/([ˆ/]+)$" to="~/Deals.aspx?deal_string=$1" />
<rewrite url="~/deals/(.+?)/edit$" to="~/EditDeals.aspx?deal_string=$1" />
The charset [ˆ/] means any char but /. The way the 1st expression would no longer match /deals/hello/edit.

Resources