At line 1 changed 1 line. |
Matt, You could try using the outputLink rather than the commandLink. The output link will generate a standard link. You might try adding a base tag. All JSF jsp must be dispached thur the faces servlet. It looks like your are using the /faces/* servlet mapping. I put togather a simple JSF component for this - like struts. I belive the the struts JSF baseline has one. |
<pre> |
<?xml version="1.0"?> |
<!DOCTYPE page-specification PUBLIC |
"-//Apache Software Foundation//Tapestry Specification 3.0//EN" |
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> |
|
<page-specification class="org.appfuse.webapp.action.PersonForm"> |
<span style="color: yellow"><bean name="delegate" class="org.appfuse.webapp.action.Validator"/></span> |
At line 3 changed 3 lines. |
{{{ |
<h:dataTable value="#{viewcontroller.persons}" var="e" > |
... |
<bean name="requiredValidator" class="org.apache.tapestry.valid.StringValidator"> |
<set-property name="required" expression="true"/> |
<set-property name="clientScriptingEnabled" expression="true"/> |
</bean></span> |
At line 15 added 5 lines. |
<property-specification name="person" type="org.appfuse.model.Person"/> |
<property-specification name="manager" type="org.appfuse.service.Manager"> |
global.appContext.getBean("manager") |
</property-specification> |
<property-specification name="message" type="java.lang.String"/> |
At line 8 changed 5 lines. |
<h:outputLink value="userProfile.jsp"> |
<f:param id="username" name="username" value="#{e.username}" /> |
<h:outputText value="#{e.username}" /> |
</sh:outputLink> |
}}} |
<span style="color: yellow"><component id="firstNameField" type="ValidField"> |
<binding name="value" expression="person.firstName"/> |
<binding name="validator" expression="beans.requiredValidator"/> |
<message-binding name="displayName" key="person.firstName"/> |
</component> |
At line 14 changed 95 lines. |
You might try using an EL in the managed bean for your detail page. |
|
{{{ |
<managed-bean> |
<managed-bean-name>adduser</managed-bean-name> |
<managed-bean-class>xxx.User</managed-bean-class> |
<managed-bean-scope>request</managed-bean-scope> |
<managed-property> |
<property-name>username</property-name> |
<value>#{param['username']}</value> |
</managed-property> |
</managed-bean> |
}}} |
|
... or .... |
|
I might handle on the details page using the prerender callback of the script collector |
|
{{{ |
<hx:scriptCollector preRender="#{viewcontroller.load}"> |
|
public void load(FacesContext context) { |
|
|
// it looks like Shale is going to have a ViewController and BeanMapper to handle this kind of thing? |
|
ValueBinding valuebinding = context.getApplication().createValueBinding("#{addUser}"); |
xxx.User user = (User) valuebinding.getValue(context); |
|
|
String userid = (String) context.getRequestParameterMap().get("username"); |
user.setUserid(userId); |
} |
}}} |
|
Base tag render example.... |
|
{{{ |
public class OutputBaseRenderer extends HtmlBasicRenderer { |
|
public void encodeEnd(FacesContext context, UIComponent uicomponent) |
throws IOException { |
|
ResponseWriter writer = context.getResponseWriter(); |
writer.write("<base href=\""); |
writer.write(getActionURL(context, (OutputBase) uicomponent)); |
writer.write("\">"); |
|
writer = null; |
} |
|
protected String getActionURL( |
FacesContext context, |
OutputBase uicomponent) { |
|
String uri = context.getViewRoot().getViewId(); |
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); |
StringBuffer url = new StringBuffer(); |
url.append(request.getRequestURL()); |
|
// remove the Schema |
for (int i = 4; i < 5; i++ ) { |
if (url.charAt(i) == ':') { |
url.delete(0, i); |
break; |
} |
} |
|
// remove all but the server name |
for (int i = 3; i < url.length(); i++ ) { |
if ((url.charAt(i) == ':') || (url.charAt(i) == '/')) { |
url.setLength(i); |
break; |
} |
} |
|
|
if (uicomponent.isSecure()) { |
url.insert(0, "https"); |
} else { |
url.insert(0, "http"); |
} |
url.append(":").append(uicomponent.getServerPort()); |
|
url.append(context.getApplication().getViewHandler().getActionURL( |
context, |
uri)); |
|
uri = null; |
request = null; |
return url.toString(); |
} |
} |
}}} |
|
<component id="lastNameField" type="ValidField"> |
<binding name="value" expression="person.lastName"/> |
<binding name="validator" expression="beans.requiredValidator"/> |
<message-binding name="displayName" key="person.lastName"/> |
</component></span> |
</page-specification> |
</pre> |