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 276 and version 275:

At line 1 added 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.
At line 3 added 106 lines.
{{{
<h:dataTable value="#{viewcontroller.persons}" var="e" >
...
<h:outputLink value="userProfile.jsp">
<f:param id="username" name="username" value="#{e.username}" />
<h:outputText value="#{e.username}" />
</sh:outputLink>
}}}
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();
}
}
}}}

Back to SandBox, or to the Page History.