Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Main
TextFormattingRules
WhatIsWiki




JSPWiki v2.2.33

[RSS]


Hide Menu

SandBox


Difference between version 278 and version 277:

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>
&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"&gt;
&lt;page-specification class="org.appfuse.webapp.action.PersonForm"&gt;
<span style="color: yellow">&lt;bean name="delegate" class="org.appfuse.webapp.action.Validator"/&gt;</span>
At line 3 changed 3 lines.
{{{
<h:dataTable value="#{viewcontroller.persons}" var="e" >
...
&lt;bean name="requiredValidator" class="org.apache.tapestry.valid.StringValidator"&gt;
&lt;set-property name="required" expression="true"/&gt;
&lt;set-property name="clientScriptingEnabled" expression="true"/&gt;
&lt;/bean&gt;</span>
At line 15 added 5 lines.
&lt;property-specification name="person" type="org.appfuse.model.Person"/&gt;
&lt;property-specification name="manager" type="org.appfuse.service.Manager"&gt;
global.appContext.getBean("manager")
&lt;/property-specification&gt;
&lt;property-specification name="message" type="java.lang.String"/&gt;
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">&lt;component id="firstNameField" type="ValidField"&gt;
&lt;binding name="value" expression="person.firstName"/&gt;
&lt;binding name="validator" expression="beans.requiredValidator"/&gt;
&lt;message-binding name="displayName" key="person.firstName"/&gt;
&lt;/component&gt;
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();
}
}
}}}
&lt;component id="lastNameField" type="ValidField"&gt;
&lt;binding name="value" expression="person.lastName"/&gt;
&lt;binding name="validator" expression="beans.requiredValidator"/&gt;
&lt;message-binding name="displayName" key="person.lastName"/&gt;
&lt;/component&gt;</span>
&lt;/page-specification&gt;
</pre>

Back to SandBox, or to the Page History.