Viva!
Primeiro peço desculpa se cometo algum erro básico de Java, mas sou um iniciado.
Estou desenvolvendo uma biblioteca digital com 2 softwares open source ELATED e FEDORA (www.fedora.info).
Tenho uma página em JSP, que me deixa criar colecções sem caracteres especiais como “ç” “à” ou “ã”…mas bloqueia quando tento criar uma com esses mesmos caracteres. (página abaixo)
Daquilo que percebo não deve estar definido o encoding charset correctamente…
Alguém sabe se este tipo de definição pode ser acrescentado na JSP ou precisa de ser adicionado na classe?. De qualquer modo, como faço isso?
Cumprimentos
António
PS-tentei por diversas vezes contactar que desenvolveu o software mas em vão…
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix=“html” %>
<%@ page errorPage=“error.jsp”
import=“java.util.,
org.acs.elated.exception.SecurityException,
org.acs.elated.ui.listAdapter.,
org.acs.elated.app.,
java.net.,
java.text.,
org.acs.elated.commons.,
org.acs.elated.lucene.*” %>
<jsp:useBean id=“fedoraManager” scope=“session” class=“org.acs.elated.app.AppMgr” />
<html:html xhtml=“true”>
Edit Collection @import url("stylesheet.css");<!--
function Confirmation () {
msg = "Do you want to delete this object?";
if (confirm(msg)) {
return true;
} else {
return false;
}
}
// -->
</script>
<%--****************************** HEADER *********************************--%>
<%
/************************Fields Pulled off Request***********************
**REQUIRED** collectionPID - pid of the current collection
**OPTIONAL** start - if not passed from previous page, it will start at first element
**OPTIONAL** tabbedContext - which tabbed pane to highlight
************************Fields Pulled off Request************************/
%>
<%
//get all request parameters and attributes
String collectionPID = HTTPUtils.getValue(request, "collectionPID");
String startString = HTTPUtils.getValue(request, "start");
String tabbedContext = HTTPUtils.getValue(request, "tabbedContext");
SecurityClearance sc = fedoraManager.getSecurityMgr().getCollectionClearance(collectionPID);
boolean isAuthenticated = fedoraManager.getUser().isAuthenticated();
ItemListAdapter listAdapter = new ItemListAdapter(request,
fedoraManager, tabbedContext);
if (fedoraManager.getCollectionMgr().isCollaborativeCollection(collectionPID)) {
String url = "/" + Config.getProperty("DEFAULT_WEB_MODULE") + "/collaborativeCollectionEdit.jsp?collectionPID=" +
collectionPID + "&tabbedContext=collCollection";
url = response.encodeRedirectURL(url);
response.sendRedirect(url);
}
else{
tabbedContext = "myCollection";
}
if(!sc.canView()){
throw new SecurityException("Access Violation");
}
if (isAuthenticated) {
%>
<jsp:include page=“privateHeader.jsp” />
<jsp:include page=“privateTabs.jsp”>
<jsp:param name=“currentPage” value="<%= tabbedContext %>" />
</jsp:include>
<%
} else {
%>
<jsp:include page=“publicHeader.jsp” />
<%
}
%>
<%
int start = 0;
if (startString != null) {
start = Integer.parseInt(startString);
}
%>
<br />
<h1>Collection</h1>
<h2>
<jsp:include page="breadCrumbs.jsp">
<jsp:param name="collectionPID" value="<%= collectionPID %>" />
<jsp:param name="tabbedContext" value="<%= tabbedContext %>" />
</jsp:include>
</h2>
<%--****************************** ERROR *********************************--%>
<div class="error">
<html:errors />
</div>
<%--********************** MAIN of collectionEdit**************************--%>
<div class="r-aligned">
<%
// set attribute for html:link parameter to View Collection Info page
HashMap viewCollParam = new HashMap();
viewCollParam.put("collectionPID", collectionPID);
viewCollParam.put("tabbedContext", tabbedContext);
request.setAttribute("viewCollParam", viewCollParam);
request.setAttribute("collectionPID", collectionPID);
%>
<html:link forward=“viewCollectionInfo” name=“viewCollParam”>
View
</html:link>
collection information.
<%
// if you did not create the collection then you
// cannot add items to the collection
if (sc.canAdd()) {
HashMap addItemParam = new HashMap();
addItemParam.put("collectionPID", collectionPID);
addItemParam.put("tabbedContext", tabbedContext);
request.setAttribute("addItemParam", addItemParam);
%>
<html:link forward=“bulkIngest” name=“addItemParam”>Ingest</html:link> a group of files into this collection
<html:link forward=“createItem” name=“addItemParam”>
Add</html:link> an new item to this collection.
<html:link forward=“createCollection” name=“addItemParam”>
Add</html:link> a folder to this collection
<%
}
List itemList = fedoraManager.getCollectionMembers(collectionPID);
if(itemList.size() == 0){%>
<br />
<br />
<p><strong>There are no items in this collection!</strong></p>
<br />
<%}else{
int numResults = itemList.size();
int next = start + 20;
int begin = start - 20;
if (next >= numResults + 1) {
next = numResults;
}
if (begin < 0) {
begin = 0;
}
%>
<h5>
Displaying items
<%= start + 1 %>-
<%= next %> out of
<%= numResults %>
</h5>
<%
itemList = itemList.subList(start, next);
Iterator it = itemList.iterator();
HashMap p = new HashMap();
if (begin != start) {
p.put("start", Integer.toString(begin));
p.put("collectionPID", collectionPID);
p.put("tabbedContext", tabbedContext);
request.setAttribute("param", p);
%>
<html:link forward="editCollection" name="param">
Previous
</html:link>
<%
} else {
%>
<span class="inactive">Previous</span>
<%
}
%>
|
<%
if (next != numResults) {
p = new HashMap();
p.put("start", Integer.toString(next));
p.put("collectionPID", collectionPID);
p.put("tabbedContext", tabbedContext);
request.setAttribute("param", p);
%>
<html:link forward="editCollection" name="param">
Next
</html:link>
<%
} else {
%>
<span class="inactive">Next</span>
<%
}
%>
<div class="tabledata">
<table>
<tr>
<th>
Preview
</th>
<th>
Title
</th>
<th>
Description
</th>
<th>
Creation Date
</th>
</tr>
<%
while (it.hasNext()) {
%>
<tr>
<%
ItemInfoBean item = (ItemInfoBean)it.next();
listAdapter.setItemInfoBean(item, collectionPID);
%>
<td align="center">
<html:image src="<%= listAdapter.getPreviewURL() %>" styleClass="icon" alt="<%= listAdapter.getTitle() %>" />
</td>
<td>
<%
if(listAdapter.isItem()){
listAdapter.putItemHashMap();%>
<html:link forward="viewItem" name="param"><%= listAdapter.getTitle() %></html:link>
<%}else{
listAdapter.putCollectionHashMap();%>
<html:link forward="editCollection" name="param"><%= listAdapter.getTitle() %></html:link>
<%}%>
<br />
</td>
<td><%= listAdapter.getDescription() %></td>
<td>
<%=listAdapter.getDate()%>
</td>
<%
if (sc.canDelete()) {%>
<td>
<%
if(listAdapter.isItem()){
listAdapter.putDeleteItemHashMap();%>
<html:link action="/deleteAction" name="params" onclick="return Confirmation()">
Delete item
</html:link>
<%} else{
listAdapter.putDeleteCollectionHashMap();%>
<html:link action="/deleteAction" onclick="return Confirmation()" name="params">
Delete Collection
</html:link>
<%}%>
</td>
<%}%>
</tr>
<%} // end of while
%>
</table>
</div>
<%
if (begin != start) {
p.put("start", Integer.toString(begin));
p.put("collectionPID", collectionPID);
request.setAttribute("param", p);
%>
<html:link forward="editCollection" name="param">
Previous
</html:link>
<%
} else {
%>
<span class="inactive">Previous</span>
<%
}
%>
|
<%
if (next != numResults) {
p = new HashMap();
p.put("start", Integer.toString(next));
p.put("collectionPID", collectionPID);
request.setAttribute("param", p);
%>
<html:link forward="editCollection" name="param">
Next
</html:link>
<%
} else {
%>
<span class="inactive">Next</span>
<%
}
} // end of there are items
// only show the create item button if user is authenticated
// if you did not create the collection then you cannot add items to the collection
if (sc.canAdd()) {
%>
<html:link forward=“createItem” name=“addItemParam”>
Add
</html:link>
an item to this collection.
<%
}
%>
<%
List fields = new ArrayList();
try {
fields = fedoraManager.getCollectionMgr().getExtMetaDataFields(collectionPID);
if (!fields.isEmpty()) {
%>
Custom MetaData
<%
}
} catch (Exception e) {
// this means that there was no additional metadata and hence
// we want to print nothing
}
if (sc.canAdd()) {
HashMap map = new HashMap();
map.put("addFileURL", "1");
map.put("collectionPID", collectionPID);
map.put("addField", "1");
map.put("tabbedContext", "myCollection");
request.setAttribute("map", map);
%>
<html:link forward=“editCollection” name=“map”>
Add
</html:link>
a metadata field for this collection.
<%
String addField = (String)request.getParameter(“addField”);
if (addField != null) {
if (addField.equals("1")) {
%>
<html:form action="/customFieldAction" method=“POST”>
<html:text property=“fieldName” />
<html:hidden property=“pid” value="<%= collectionPID %>" />
<html:submit />
</html:form>
<%
}
}
}
if (!fields.isEmpty()) {
Iterator it1 = fields.iterator();
%>
-
<%= fieldName %> [remove]
<%
while (it1.hasNext()) {
String fieldName = (String)it1.next();
%>
<% } %>
<%
}
%>
<%–****************************** FOOTER *********************************–%>
<jsp:include page=“footer.jsp” />