Struts File Upload

CSS | Prototype | SiteMesh | DisplayTag

JSP#

<s:property value="lastName" />
<s:property value="#session.addressListFile" />
<s:iterator value="addresses" status="i">
	<tr>
		<td><s:property value="#i.getIndex()" /></td>
		<td><s:property value="addresses[#i.getIndex()]" /></td>
	</tr>
</s:iterator>	

UTF-8#

1. Save as UTF-8 (Most important)
Save the files in real UTF-8, use a separate text editor like notepad++ to change it if necessary!

2. If you redirect from an index.html, make sure this index.html has a also proper

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

3. JSP:

<%@ page pageEncoding="UTF-8" %> 
4. WEB-INF/classes/log4j.properties:
log4j.appender.stdout.encoding=UTF-8
5a. WEB-INF/classes/struts.xml
<constant name="struts.i18n.encoding" value="UTF-8"/> 
5b. WEB-INF/classes/struts.properties:
struts.i18n.encoding=UTF-8
6. Use POST to submit, otherwise it is encoding again in the URL (with HTTP GET)
<form action="LinkEdit.action" method="post">	

Themes and rendering <s:xxx> tags#

Use the simple theme to suppress special rendering (for example: a form element places elements into a table):
<s:form cssClass="addrForm" action="addressList" 
    method="post" enctype="multipart/form-data"
    theme="simple" >
The tag reference will show you the attribute options.

Copying a Project in Eclipse#

Copy in Eclipse and adjust following manually:
  • <wb-module deploy-name> tag in .settings/org.eclipse.wst.common.component
  • Project properties > Web Project Settings

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-) was last changed on 28-Mär-2017 14:37 by UnbekannterAutor