Scope of CSS styleClass in h:form, h:panelGrid
This may be more of a HTML/CSS question, but still relevant to JSF app design/impl. Basically, I would like to know whether container's styleClass is inherited by nested components. For example:
<h:form styleClass="formClass">
<h:panelGrid styleClass="panelGridClass" columns="2">
<h:outputText styleClass="output1Class"/>
<h:outputText styleClass="output2Class"/>
</h:panelGrid>
</h:form>
If I specify font style/color in "formClass" and I am content that all text inside the form will look the same, can I omit styleClass statements in nested components - two outputText's and panelGrid?
In general, what is the scope of styleClass declarations?
thanks
-nikita
Now the full answer....
An Html/Css Forum is a better place to ask this question.
I made some tests and the style is inherited by the nested components.
I think the scope of the styleClass is until another style overrides the previous one.
Similar Messages
-
Dreamweaver Tutorial - CSS to style contact form not showing in Browser
Hi I have followed the tutorial on
http://dreamweaverspot.com/css-dreamweaver-web-forms/.
It worked well so far in Dreamweaver all the changes are done,
however not after I have uploaded the page to the server. If you
look on www.theoldfort.com/contact.htm you can see only the border
the other styles are not being shown and the border is too wide. I
tried to make it narrower but didnt succeed.Styling form elements is like nailing jelly to the wall....
http://www.456bereastreet.com/archive/200701/styling_form_controls_with_css_revisited/
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"atomic king" <[email protected]> wrote in
message
news:gokba4$352$[email protected]..
> Hi I have followed the tutorial on
>
http://dreamweaverspot.com/css-dreamweaver-web-forms/.
It worked well so
> far in
> Dreamweaver all the changes are done, however not after
I have uploaded
> the
> page to the server. If you look on
www.theoldfort.com/contact.htm you can
> see
> only the border the other styles are not being shown and
the border is too
> wide.
> -
CSS keepalives for Oracle forms server
I'm trying to set up load balancing for oracle forms server and having issues with finding working keepalive method.
If I use uri keepalive, Oracle forms server crashes within a couple of minuites. TCP doesn't work either
service Ora-forms:9000
ip address 192.168.0.34
port 9000
keepalive type http
keepalive uri "/alive.gif"
keepalive frequency 30
It works for Oracle web server tho.
What keepalive do you guy use for Forms server?Here is what a script looks like using the "graceful" close approach..Graceful is at the bottom.
Regards
Pete..
!no echo
! Filename: ap-kal-fin
! Parameters: ip address
! Description:
! This script will open and close a socket on port 80.
! The close will be a FIN rather than a RST
! Failure Upon:
! Not establishing a connection with the host.
! Make sure the user has a qualified number of arguments
if ${ARGS}[#] "LT" "1"
echo "Usage: ap-kal-fin ip address.'"
exit script 1
endbranch
! Connect to the remote Host
set EXIT_MSG "Connect: Failed to connect to ${ARGS}[1]"
socket connect host ${ARGS}[1] port 80 tcp 2000
no set EXIT_MSG
socket disconnect ${SOCKET} graceful
exit script 0 -
At the beginning of my stylesheet I am using the following to
reset all margins, border and padding.
* { margin: 0; padding: 0; border: 0; }
With forms, that makes it mendatory for me to style them.
Meaning I do something like this:
.column01 input, .column01 textarea { border: 1px solid
#C3C3C3; border-top-color: #7C7C7C; border-bottom-color: #DDD; }
.column01 input.myBtn{ width: auto; margin-top:1px;
vertical-align: top; }
What I would now like to do and don't know how, is to reset
the myBtn to the browser default. So for example if I am looking at
this in Safari, it would give the glass look. Is there a way to do
that?
Thanks a lot for any help with this.Styling form elements is a tricky business. See this link -
http://www.456bereastreet.com/archive/200701/styling_form_controls_with_css_revisited/
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"brian914" <[email protected]> wrote in
message
news:fp9mai$qni$[email protected]..
> At the beginning of my stylesheet I am using the
following to reset all
> margins, border and padding.
> * { margin: 0; padding: 0; border: 0; }
>
> With forms, that makes it mendatory for me to style
them. Meaning I do
> something like this:
> .column01 input, .column01 textarea { border: 1px solid
#C3C3C3;
> border-top-color: #7C7C7C; border-bottom-color: #DDD; }
> .column01 input.myBtn{ width: auto; margin-top:1px;
vertical-align: top; }
>
> What I would now like to do and don't know how, is to
reset the myBtn to
> the
> browser default. So for example if I am looking at this
in Safari, it
> would
> give the glass look. Is there a way to do that?
>
> Thanks a lot for any help with this.
> -
Faulty error message in Eclipse
Hi,
I'm using Eclipse (version 3.0.2) together with the N. Takezoe's FacesIDE plugin (version 0.1.5).
Unfortunately - for code lines like <h:outputText value="#{msg[client.rc]}" styleClass="message"/> - I always get (in Eclipse's "Problems View" window) a corresponding error message:
msg[client.rc] is not defined
For your better understanding here are the most important code parts:
Extract from "modifyCam_1.jsp":
<%@ page contentType="text/html; charset=Cp1252" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252"/>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<title></title>
</head>
<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<f:view>
<f:loadBundle basename="resource.gui" var="gui"/>
<f:loadBundle basename="resource.hlp" var="hlp"/>
<f:loadBundle basename="resource.msg" var="msg"/>
<h:panelGrid cellspacing="0" columns="2" styleClass="centerArea" columnClasses="pageNavigation,pageBody">
<h:form>
<h:outputText value="#{gui['title_modifyCam']}" title="#{hlp['title_modifyCam']}" styleClass="bodyTitle"/>
<f:verbatim><br/><br/></f:verbatim>
<h:panelGrid cellspacing="0" columns="5" columnClasses="none,space,none,space,none">
<h:outputText value="#{gui['label_CamID']}" styleClass="label"/>
<h:outputText value=""/>
<h:inputText id="Cam_ID" value="#{client.camID}" title="#{hlp['input_CamID']}" required="true" styleClass="inputField"/>
<h:outputText value=""/>
<h:message for="Cam_ID" showSummary="true" styleClass="message"/>
<h:outputText value=""/>
<h:outputText value=""/>
<h:commandButton value="#{gui['button_Search']}" title="#{hlp['button_Search']}" action="#{client.searchCamera}" styleClass="button"/>
</h:panelGrid>
<f:verbatim><br/></f:verbatim>
<h:outputText value="#{msg[client.rc]}" styleClass="message"/>
</h:form>
</h:panelGrid>
</f:view>
</body>
</html>Extract from "ClientBean.java":
public String searchCamera() throws Exception {
rc = "camNotFound";
return rc;
}Extract from "msg.properties":
camModified = The entered camera data have been updated successfully
camNotFound = The specified camera was not found!
camDeleted = The selected camera has been deleted in the data baseExtract from "faces-config.xml":
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application>
<message-bundle>resource.gui</message-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
<application>
<message-bundle>resource.hlp</message-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
<application>
<message-bundle>resource.msg</message-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>go_modifyCam</from-outcome>
<to-view-id>/modifyCam_1.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/modifyCam_1.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/modifyCam_2.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>client</managed-bean-name>
<managed-bean-class>CamPortal.ClientBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>
Does anybody know how to prevent Eclipse from displaying such unnecessary - and annoying - error messages (because from technical point of view the mentioned line of code works perfectly) ?
Thanx in advance for your kind supportDid. you already check this discussion?
https://discussions.apple.com/thread/3814421?tstart=0 -
Hi,
I'm a novice in JSF technology and would like to know the following:
Is it possible to use a method's return value as an index for accessing a resource bundle?
For your better understanding here are the most important code parts:
Extract from "ClientBean.java":
public String searchCamera() throws Exception {
rc = "camNotFound";
return rc;
}Extract from "msg.properties":
camModified = The entered camera data have been updated successfully
camNotFound = The specified camera was not found!
camDeleted = The selected camera has been deleted in the data baseExtract from "modifyCam_1.jsp":
<%@ page contentType="text/html; charset=Cp1252" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252"/>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<title></title>
</head>
<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<f:view>
<f:loadBundle basename="resource.gui" var="gui"/>
<f:loadBundle basename="resource.hlp" var="hlp"/>
<f:loadBundle basename="resource.msg" var="msg"/>
<h:panelGrid cellspacing="0" columns="2" styleClass="centerArea" columnClasses="pageNavigation,pageBody">
<h:form>
<h:outputText value="#{gui['title_modifyCam']}" title="#{hlp['title_modifyCam']}" styleClass="bodyTitle"/>
<f:verbatim><br/><br/></f:verbatim>
<h:panelGrid cellspacing="0" columns="5" columnClasses="none,space,none,space,none">
<h:outputText value="#{gui['label_CamID']}" styleClass="label"/>
<h:outputText value=""/>
<h:inputText id="Cam_ID" value="#{client.camID}" title="#{hlp['input_CamID']}" required="true" styleClass="inputField"/>
<h:outputText value=""/>
<h:message for="Cam_ID" showSummary="true" styleClass="message"/>
<h:outputText value=""/>
<h:outputText value=""/>
<h:commandButton value="#{gui['button_Search']}" title="#{hlp['button_Search']}" action="#{client.searchCamera}" styleClass="button"/>
</h:panelGrid>
<f:verbatim><br/></f:verbatim>
<h:outputText value="#{client.rc}" styleClass="message"/>
<h:outputText value="#{msg['camNotFound']}" styleClass="message"/>
<h:outputText value="#{msg.camNotFound}" styleClass="message"/>
</h:form>
</h:panelGrid>
</f:view>
</body>
</html>Extract from "faces-config.xml":
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application>
<message-bundle>resource.gui</message-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
<application>
<message-bundle>resource.hlp</message-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
<application>
<message-bundle>resource.msg</message-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>go_modifyCam</from-outcome>
<to-view-id>/modifyCam_1.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/modifyCam_1.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/modifyCam_2.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>client</managed-bean-name>
<managed-bean-class>CamPortal.ClientBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>When I use the index directly in my jsp file, like
<h:outputText value="#{msg['camNotFound']}"/>
<h:outputText value="#{msg.camNotFound}"/>the corresponding text (The specified camera was not found!) is displayed correctly .
But I would need some construct similar to this one
<h:outputText value="#{msg[#{client.rc}]}"/>because I want the method (here: searchCamera) to decide which text should be displayed
Thanx in advance for your kind support<h:outputText value="#{msg[#{client.rc}]}"/>I guess the value should be "#{msg[client.rc]}".
-
In the code below during the initial rendering of the JSP the getProjects method is being called twice rather than once, this is the bind method for the f:selectItems tag.
I have added a phase listener which indicates the following:
INFO: Server startup in 7563 ms
PhaseTracker: Before: RESTORE_VIEW 1
PhaseTracker: After: RESTORE_VIEW 1
PhaseTracker: Before: RENDER_RESPONSE 6
ProjectSpendBean: GetProjects
ProjectSpendBean: GetProjects
PhaseTracker: After: RENDER_RESPONSE 6
Any ideas as this will cause performance issues as the data volume increases.
<%@ page contentType="text/html" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<f:view>
<f:loadBundle basename="bundles.tmsBundles" var="tms"/>
<head>
<title>
<h:outputText value="#{tms.tmsUserTitle}"/>
</title>
<link rel="stylesheet" type="text/css"
href="<%= request.getContextPath() %>/styles.css" />
</head>
<body>
<h:form>
<h:panelGrid columns="2" border="0" columnClasses="menu-style,body-style"
rowClasses="panel-top" width="100%" >
<h:panelGrid columns="1" border="0" >
<h:panelGrid columns="3" cellspacing="10" cellpadding="1" border="0" >
<%-- Project Name --%>
<h:outputLabel for="projectName" >
<h:outputText value="Project Name: " styleClass="text-normal" />
</h:outputLabel>
<h:selectOneMenu id="projectName"
styleClass="text-normal"
value="#{projectSpend.searchBookingCode}">
<f:selectItems value="#{projectSpend.projects}" />
</h:selectOneMenu>
<!-- submit button -->
<h:commandButton title="submit" value="Search" styleClass="text-normal"
actionListener="#{projectSpend.searchForSpends}" />
</h:panelGrid>
</h:panelGrid>
</h:panelGrid>
</h:form>
</body>
</f:view>What does the page look like when viewed in a browser?
Which version of DW are you using ?
If the site is messed up when viewing in a browser, it may be
best to link
to a live example of the page, that way people can check the
code to see if
there's anything wrong that may be causing the issue.
Nadia
Adobe® Community Expert : Dreamweaver
CSS Templates |Tutorials |SEO Articles
http://www.DreamweaverResources.com
~ Customisation Service Available ~
http://www.csstemplates.com.au
Spry Widget Examples
http://www.dreamweaverresources.com/spry-widgets/
~ Forum Posting Guidelines ~
http://www.adobe.com/support/forums/guidelines.html
"manchomark" <[email protected]> wrote in
message
news:fk9hq0$2r9$[email protected]..
> For some reason the rendering of the Layers in DW has
blow out. I don't
> think
> anything changed in the css and it was displaying
correctly. I did DUMP my
> config file for DW to see if it would resolve, but no.
>
> See this screen shot:
http://www.ntfb.org/dev/problem-layers.gif
>
> Someone said this is a known issue but I searched
extensively here on
> adobe
> and I didnt' see it. Using the keywords Render DW css
layers.
>
> Any advice is appreciated.
>
> -
How to put the form scope in session
Hi,
In struts you have the option of putting the scope of form as sesison in struts-config.xml.How
do you do the same thing in weblogic workshop 8.1?Workshop automatically generates
the config files for each workflow and it puts the default scope as request.
If I want to put the form scope in session.How can I do that?
Any help regarding this is appreciated
Thanks!
SridharI forgot to mention that to get a form in page flow scope you need to set
the form on the action annotation,
@jpf:action form="<form name>"
This allows the action to read and update from a FormData (or ActionForm)
member variable.
Here is an excerpt from the documentation
* @jpf:action form="_pageFlowForm"
protected Forward doit( MyForm myForm )
// _pageFlowForm is a member variable
// Note that myForm == _pageFlowForm
String name = _pageFlowForm.getFullName();
"John Rohrlich" <[email protected]> wrote in message
news:4034ecc7$[email protected]..
Sridhar,
If you want to put the form in session scope you can use the struts merge
feature of Workshop. There is a good dev2dev article
(http://dev2dev.bea.com/products/wlworkshop81/articles/Feit.jsp) on this
topic.
You might also consider the 8.1 SP2 feature, page flow scoped forms. Youcan
declare your form as a private member of your page flow (.jpf) and thenpass
the form from an action to a page by calling addOutputForm on yourforward,
for example,
forward.addOutputForm(yourForm);
- john
"sridhar" <[email protected]> wrote in message
news:4033fb96$[email protected]..
Hi,
In struts you have the option of putting the scope of form as
sesison
in struts-config.xml.How
do you do the same thing in weblogic workshop 8.1?Workshop automaticallygenerates
the config files for each workflow and it puts the default scope asrequest.
If I want to put the form scope in session.How can I do that?
Any help regarding this is appreciated
Thanks!
Sridhar -
PHP Email Form is not Emailing
HI,
I made a PHP email form and i was wondering if i did it
correct. I try to send a email but for some reason it wont work
here is the PHP code:
<?php
$emailSubject = 'Computer Question!';
$webMaster = '[email protected]';
$nameField = $_POST ['name'];
$phoneField = $_POST ['phone'];
$emailField = $_POST ['email'];
$questionField = $_POST ['question'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Phone: $phone <br>
Email: $email <br>
Question: $question <br>
EOD;
$headers = "From: $email\r\n";
$headers .="Content=type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Results Rendered as HTML */
$theResults = <<<EOD
?>
Here is the Email form:
:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post"
action="Contact form 505 test 2.php">
<table width="70%" border="1" cellpadding="6">
<tr>
<th width="16%" scope="col"><div align="right">
<label for="name">Name:</label>
</div></th>
<th width="84%" scope="col"><div align="left">
<input name="name" type="text" id="name" size="35"
maxlength="60" />
</div></th>
</tr>
<tr>
<th scope="row"><div align="right">
<label for="phone ">Phone Number</label>
</div></th>
<td><div align="left">
<input name="phone " type="text" id="phone " size="35"
maxlength="13" />
</div></td>
</tr>
<tr>
<th scope="row"><div align="right">
<label for="email">Email:</label>
</div></th>
<td><div align="left">
<input name="email" type="text" id="email" size="35"
maxlength="40" />
</div></td>
</tr>
<tr>
<th scope="row"><div align="right">
<label for="question">Question:</label>
</div></th>
<td><div align="left">
<textarea name="question" cols="26" rows="8"
id="question"></textarea>
</div></td>
</tr>
<tr>
<th scope="row"> </th>
<td><label for="Send Email"></label>
<input type="submit" name="Send Email" id="Send Email"
value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
Any help would be appreciated!
thanks.oO(jumpman310)
> I made a PHP email form and i was wondering if i did it
correct. I try to send
>a email but for some reason it wont work here is the PHP
code:
Next time please be more specific. "won't work" isn't really
helpful.
Anyway, the first thing to fix is the error reporting on your
testing
server, obviously it's not configured properly. In your
php.ini these
directives have to be set:
error_reporting = E_ALL|E_STRICT
display_errors = on
You should get some notices from your script. After fixing
those issues,
you should also read about header injection and how to
prevent it. Your
script is vulnerable and can be abused for sending spam. Also
consider
to use a class like PHPMailer to make things more secure and
convenient.
Some further notes about your form markup:
* It's very good that you make use of labels for your form
controls, but
in some cases the IDs of these controls contain spaces, which
is not
allowed.
* You don't really need a label for a submit button.
* Consider to drop all those div elements in the table
headers - you
don't need them. Use CSS to style the labels the way you
want, e.g.
form th {text-align: right}
I also use this:
label:hover {outline: 1px dotted #666}
* Check the markup of the "Name" row. The 'scope' attribute
is incorrect
and the form control should be inside a 'td', not a 'th'.
Micha -
Problems with file uploading servlet, the form action doesnt capture url
Hi, i have one problem. I am working on a project , i have created a servlet that takes uploaded files and processses them and links them back to user to download. The servlet works perfectly from my computer, I am using apache-tomcat-6.0.16 and java 1.6 , I have two forms called encrypt.html and decrypt.html, I will post both of them, now the problem is when somebody access it on the internet while i am running apache, they get a connection was reset on a firefox browser and same stuff on Internet Explorer.
i have checked my server logs and saw nothing unusual there, So please if you can help me, it is my project.
I am pasting html file and error message that other users where getting remotely.
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Stego Form</title>
<link rel='STYLESHEET' type='text/css' href='encrypt.css'>
</head>
<body>
<center>
<form name='encrypt' enctype='multipart/form-data' method='POST' action='http://localhost:8080/examples/temp2
' accept-charset='UTF-8'>
<input type='hidden' name='sfm_form_submitted' value='yes'>
</input>
<input type='hidden' name='eord' value='e'>
<select name='encryption' size='1'>
<option value='Select an encryption' selected>
Select an encryption
</option>
<option value='DES'>
DES
</option>
<option value='Tripple DES'>
Tripple DES
</option>
</select>
<input type='file' name='overt' size='20'>
<input type='file' name='covert' size='20'>
<input type='submit' name='submit' value='Submit'>
</form>
</center>
</body>
</html>so it works for me even if i access the page with my ip , but for others it doesnt work,
now the user got this xhtml page that i will show, i cant find attach button so i am pasting here.
here is the servlet coding
import java.io.*;
import java.util.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
public class temp2 extends HttpServlet
FileInputStream fin;
String filenames[] = new String[2],fieldname,fieldval;
String keyfile,IVfile;
String names[] = new String[2];
public temp2()
super();
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost(request, response);
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
String eord="";
List lst = null;
boolean isMultiPart = ServletFileUpload.isMultipartContent(request);
if (!isMultiPart) // check whether the post request is actually multipart
System.out.println("ERROR NOT MULTIPART");
System.exit(0);
DiskFileItemFactory fif = new DiskFileItemFactory();
ServletFileUpload sfu = new ServletFileUpload(fif);
sfu.setSizeMax(10000000);
try { lst = sfu.parseRequest(request); }
catch (FileUploadException ex)
{ System.out.println("ERROR IN PARSING FILES" + ex); System.exit(0); }
if(lst.isEmpty()) // check whether request is empty
System.out.println("ERROR LIST SIZE NOT GOOD : " + lst.size());
System.exit(0);
Iterator x = lst.iterator();
int i = 0;
FileItem f = (FileItem)x.next();
f = (FileItem)x.next();
System.out.println(f.getFieldName());
if(f.getFieldName().equalsIgnoreCase("eord")) // check hidden field to know the case : encrypt or decrypt
eord = f.getString();
System.out.println(f.getString());
else // if it is not first field exit
System.out.println("Invalid FORM");
System.exit(0);
f = (FileItem)x.next(); // next field
if(f.getFieldName().equalsIgnoreCase("encryption")) // type of encryption des / tdes
fieldname = f.getFieldName();
fieldval = f.getString();
System.out.println(f.getString());
if(eord.equalsIgnoreCase("e")) // if it is encryption form only file required
while(x.hasNext())
f = (FileItem)x.next();
if(!f.isFormField())
int check = f.getName().lastIndexOf(File.separator);
System.out.println(File.separator);
if(check==-1)
System.out.println(f.getName());
System.out.println("Unsupported browser : " + check);
System.exit(0);
File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
names[i] = ff.getName(); // original file names
try
f.write(ff);
filenames[i] = ff.getAbsolutePath();
// renamed
ff.deleteOnExit();
}catch(Exception e) {System.out.println("Error writing file"+ ff.getAbsolutePath()); System.exit(0);}
i++;
try { System.in.read(); } catch(Exception e) {}
}// endwhile
if(fieldval.equalsIgnoreCase("DES"))
System.out.println("DES 1"+filenames[1]);
javades o = new javades(filenames[1]); // the file to be encrypted
filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
System.out.println("should be original" + filenames[1]);
else if(fieldval.equalsIgnoreCase("Tripple DES"))
javatdes o = new javatdes(filenames[1]);
filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
System.out.println(filenames[1]);
System.out.println("Calling stego");
filenames[0] = "e:\\apache\\webapps\\temp\\" + names[0];
System.out.println("file 1 "+ filenames[0]);
System.out.println("file 2"+ filenames[1]);
try { System.in.read(); } catch(Exception e) {}
stego s = new stego(filenames[0],filenames[1]);
System.out.println("mainext " + s.mainext);
// encryption done, and new files are loaded, now lets hide
if(s.mainext.equalsIgnoreCase("wav"))
s.encodewav();
System.out.println("Encoded wave");
else if(s.mainext.equalsIgnoreCase("bmp"))
System.out.println("Encoded bmp");
s.encodebmp();
System.out.println("done !");
PrintWriter pr = response.getWriter();
pr.println("Greetings , Your work is done and saved, now download the following files");
pr.println("The secret key file is needed for getting back your hidden file, so download that too");
pr.write("<a href=\"/temp/files/IV.txt\">click here</a>");
pr.write("<br/><a href=\"/temp/files/key.txt\">click here</a>");
pr.write("<br/><a href=\"/temp/files/"+names[0]+"\">click here</a>");
return;
// if it is decryption case
else if(eord.equalsIgnoreCase("d"))
while(x.hasNext())
f = (FileItem)x.next();
if(!f.isFormField())
int check = f.getName().lastIndexOf(File.separator);
System.out.println(File.separator);
if(check==-1)
System.out.println(f.getName());
System.out.println("Unsupported browser : " + check);
System.exit(0);
File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
// else if ladder to store paths of stegofile keyfile and IVfile
if(f.getFieldName().equalsIgnoreCase("stegofile"))
filenames[0] = ff.getAbsolutePath();
else if(f.getFieldName().equalsIgnoreCase("keyfile"))
keyfile = ff.getAbsolutePath();
else if(f.getFieldName().equalsIgnoreCase("IVfile"))
IVfile = ff.getAbsolutePath();
try
f.write(ff); // writes whole file at once
}catch(Exception e) {System.out.println("Error writing file"); System.exit(0);}
}// endwhile
System.out.println("Calling stego");
System.out.println("file 1 "+ filenames[0]);
stego s = new stego(filenames[0]);
System.out.println("mainext " + s.mainext);
if(s.mainext.equalsIgnoreCase("wav"))
s.decodewav();
System.out.println("Encoded wave");
else if(s.mainext.equalsIgnoreCase("bmp"))
s.decodebmp();
System.out.println("Encoded bmp");
System.out.println("done !");
////// hidden file has been retrieved , now lets decrypt it
System.out.println("ext " + s.ext);
filenames[0] = "e:\\apache\\webapps\\temp\\"+s.filename;
System.out.println(filenames[0]);
System.out.println(keyfile);
System.out.println(IVfile);
if(fieldval.equalsIgnoreCase("DES"))
javades o = new javades(filenames[0],keyfile,IVfile); // the file to be encrypted
filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
System.out.println("should be original" + filenames[0]);
else if(fieldval.equalsIgnoreCase("Tripple DES"))
javatdes o = new javatdes(filenames[0],keyfile,IVfile);
filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
System.out.println(filenames[0]);
PrintWriter pr = response.getWriter();
pr.write("Greetings, you have successfully retrieved your hidden file, now download it from here <br>");
pr.write("<a href=\"http://localhost:8080/temp/files/" + (new File(filenames[0]).getName())+"\">Click here</a>");
}and here is the xhtml file the user receives, whe he clicks the submit button,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html [
<!ENTITY % htmlDTD
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % netErrorDTD
SYSTEM "chrome://global/locale/netError.dtd">
%netErrorDTD;
<!ENTITY loadError.label "Problem loading page">
<!ENTITY retry.label "Try Again">
<!-- Specific error messages -->
<!ENTITY connectionFailure.title "Unable to connect">
<!ENTITY connectionFailure.longDesc "&sharedLongDesc;">
<!ENTITY deniedPortAccess.title "This address is restricted">
<!ENTITY deniedPortAccess.longDesc "">
<!ENTITY dnsNotFound.title "Server not found">
<!ENTITY dnsNotFound.longDesc "
<ul>
<li>Check the address for typing errors such as
<strong>ww</strong>.example.com instead of
<strong>www</strong>.example.com</li>
<li>If you are unable to load any pages, check your computer's network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
</ul>
">
<!ENTITY fileNotFound.title "File not found">
<!ENTITY fileNotFound.longDesc "
<ul>
<li>Check the file name for capitalization or other typing errors.</li>
<li>Check to see if the file was moved, renamed or deleted.</li>
</ul>
">
<!ENTITY generic.title "Oops.">
<!ENTITY generic.longDesc "
<p>&brandShortName; can't load this page for some reason.</p>
">
<!ENTITY malformedURI.title "The address isn't valid">
<!ENTITY malformedURI.longDesc "
<ul>
<li>Web addresses are usually written like
<strong>http://www.example.com/</strong></li>
<li>Make sure that you're using forward slashes (i.e.
<strong>/</strong>).</li>
</ul>
">
<!ENTITY netInterrupt.title "The connection was interrupted">
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
<!ENTITY netOffline.title "Offline mode">
<!ENTITY netOffline.longDesc "
<ul>
<li>Uncheck "Work Offline" in the File menu, then try again.</li>
</ul>
">
<!ENTITY netReset.title "The connection was reset">
<!ENTITY netReset.longDesc "&sharedLongDesc;">
<!ENTITY netTimeout.title "The connection has timed out">
<!ENTITY netTimeout.longDesc "&sharedLongDesc;">
<!ENTITY protocolNotFound.title "The address wasn't understood">
<!ENTITY protocolNotFound.longDesc "
<ul>
<li>You might need to install other software to open this address.</li>
</ul>
">
<!ENTITY proxyConnectFailure.title "The proxy server is refusing connections">
<!ENTITY proxyConnectFailure.longDesc "
<ul>
<li>Check the proxy settings to make sure that they are correct.</li>
<li>Contact your network administrator to make sure the proxy server is
working.</li>
</ul>
">
<!ENTITY proxyResolveFailure.title "Unable to find the proxy server">
<!ENTITY proxyResolveFailure.longDesc "
<ul>
<li>Check the proxy settings to make sure that they are correct.</li>
<li>Check to make sure your computer has a working network connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
</ul>
">
<!ENTITY redirectLoop.title "The page isn't redirecting properly">
<!ENTITY redirectLoop.longDesc "
<ul>
<li>This problem can sometimes be caused by disabling or refusing to accept
cookies.</li>
</ul>
">
<!ENTITY unknownSocketType.title "Unexpected response from server">
<!ENTITY unknownSocketType.longDesc "
<ul>
<li>Check to make sure your system has the Personal Security Manager
installed.</li>
<li>This might be due to a non-standard configuration on the server.</li>
</ul>
">
<!ENTITY sharedLongDesc "
<ul>
<li>The site could be temporarily unavailable or too busy. Try again in a few
moments.</li>
<li>If you are unable to load any pages, check your computer's network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
</ul>
">
<!ENTITY % globalDTD
SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
- The Original Code is mozilla.org code.
- The Initial Developer of the Original Code is
- Netscape Communications Corporation.
- Portions created by the Initial Developer are Copyright (C) 1998
- the Initial Developer. All Rights Reserved.
- Contributor(s):
- Adam Lock <[email protected]>
- William R. Price <[email protected]>
- Henrik Skupin <[email protected]>
- Jeff Walden <[email protected]>
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK ***** -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Problem loading page</title>
<link rel="stylesheet" href="temp2_files/netError.css" type="text/css" media="all"/>
<!-- XXX this needs to be themeable -->
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAICSURBVHjaYvz//z8DJQAggJhwiDPvnmlzc2aR0O+JGezt+AwACCCsBhxfYhn59N41FWtXIxZOLu70niRGXVwGAAQQNgNYHj96O8HaWYdJW5ubwd4/mI2Ng7sblwEAAYRhwMm1URk/vn4SUNWVYGD8+YZBXZOZm5OLzRjoCmNsBgAEEKoBN82Y7l851GLrqMjM8Oc7A8O/3wwMP54wuAQFCXNycUzGZgBAAKEYcOaKZO2/f//5FbUVgBrfMoRVcgHpNwyKGjKMXDwCan0prFboBgAEELIBzDcvXyy2cVZhYPj9GWj7H4jo/38MDJ9OMDj7O/KzsjH3oxsAEEBwA/bNNipiZf7FI6cqwcDw8x2qqp8fGORUpVn4BEXlgGHhhCwFEEAwA9gfP3hdZ+Oizcjw+wvCdjgAuuLrFQbXIH9hTm7uqcgyAAEENuD4ctcebm5mbikFYRTbV7V/Q6j88Z5BSuY7q4CQgAjQFR4wYYAAAhtw89L5ZFsnRaDtn4CW/YXrAQcisit+PGVwDgrnZ2NnnwATBQggpsNLvGYLCAmxi8tLARWg+h3FBVBXSEj/ZZWQkRcCuiIQJAQQQCyvnj5KMDTkZ2JgYmRg4FchnHv+vmEwttLmeXT3VjKQtx4ggFgk5TXebV63UfT3ijOMxOZAVlZWdiB1EMQGCCBGSrMzQIABAFR3kRM3KggZAAAAAElFTkSuQmCC"/>
<script type="application/x-javascript"><![CDATA[
// Error url MUST be formatted like this:
// moz-neterror:page?e=error&u=url&d=desc
// Note that this file uses document.documentURI to get
// the URL (with the format from above). This is because
// document.location.href gets the current URI off the docshell,
// which is the URL displayed in the location bar, i.e.
// the URI that the user attempted to load.
function getErrorCode()
var url = document.documentURI;
var error = url.search(/e\=/);
var duffUrl = url.search(/\&u\=/);
return decodeURIComponent(url.slice(error + 2, duffUrl));
function getDescription()
var url = document.documentURI;
var desc = url.search(/d\=/);
// desc == -1 if not found; if so, return an empty string
// instead of what would turn out to be portions of the URI
if (desc == -1) return "";
return decodeURIComponent(url.slice(desc + 2));
function retryThis()
// Session history has the URL of the page that failed
// to load, not the one of the error page. So, just call
// reload(), which will also repost POST data correctly.
try {
location.reload();
} catch (e) {
// We probably tried to reload a URI that caused an exception to
// occur; e.g. a non-existent file.
function initPage()
var err = getErrorCode();
// if it's an unknown error or there's no title or description
// defined, get the generic message
var errTitle = document.getElementById("et_" + err);
var errDesc = document.getElementById("ed_" + err);
if (!errTitle || !errDesc)
errTitle = document.getElementById("et_generic");
errDesc = document.getElementById("ed_generic");
var title = document.getElementById("errorTitleText");
if (title)
title.parentNode.replaceChild(errTitle, title);
// change id to the replaced child's id so styling works
errTitle.id = "errorTitleText";
var sd = document.getElementById("errorShortDescText");
if (sd)
sd.textContent = getDescription();
var ld = document.getElementById("errorLongDesc");
if (ld)
ld.parentNode.replaceChild(errDesc, ld);
// change id to the replaced child's id so styling works
errDesc.id = "errorLongDesc";
// remove undisplayed errors to avoid bug 39098
var errContainer = document.getElementById("errorContainer");
errContainer.parentNode.removeChild(errContainer);
]]></script>
</head>
<body dir="ltr">
<!-- ERROR ITEM CONTAINER (removed during loading to avoid bug 39098) -->
<!-- PAGE CONTAINER (for styling purposes only) -->
<div id="errorPageContainer">
<!-- Error Title -->
<div id="errorTitle">
<h1 id="errorTitleText">The connection was reset</h1>
</div>
<!-- LONG CONTENT (the section most likely to require scrolling) -->
<div id="errorLongContent">
<!-- Short Description -->
<div id="errorShortDesc">
<p id="errorShortDescText">The connection to the server was reset while the page was loading.</p>
</div>
<!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
<div id="errorLongDesc">
<ul>
<li>The site could be temporarily unavailable or too busy. Try again in a few
moments.</li>
<li>If you are unable to load any pages, check your computer's network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.</li>
</ul>
</div>
</div>
<!-- Retry Button -->
<xul:button xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="errorTryAgain" label="Try Again" oncommand="retryThis();"/>
</div>
<!--
- Note: It is important to run the script this way, instead of using
- an onload handler. This is because error pages are loaded as
- LOAD_BACKGROUND, which means that onload handlers will not be executed.
-->
<script type="application/x-javascript">initPage();</script>
</body>
</html>thank you for your prompt reply in advance,
Regards,
Mihir PandyaHi, thank you for your replies, I found out few things about my servlet, and its portability
and i have few questions, although i marked this topic as answered i guess its ok to post
I am using javax.servlet.context.tempdir to store my files in that servletcontext temporary directory. But i dont know how to give hyperlink
of the modified files to the user for them to download the modified files.
What i am using to get the tempdir i will paste
File baseurl = (File)this.getServletContext().getAttribute("javax.servlet.context.tempdir");
System.out.println(baseurl);
baseurl = new File(baseurl.getAbsolutePath()+File.separator+"temp"+File.separator+"files");
baseurl.mkdirs();so i am storing my files in that temp/files folder and the servlet processes them and modifies them, then how to present them as
links to the user for download ?
and as the servlet is multithreaded by nature, if my servlet gets 2 different requests with same file names, i guess one of them will be overwritten
And i want to create unique directory for each request made to the servlet , so file names dont clash.
one another thing is that i want my servlet to be executed by my <form action> only, I dont want the user to simply type url and trigger the servlet
Reply A.S.A.P. please..
Thanks and regards,
Mihir Pandya -
CSS General Tips and Tricks, Please if you can add to this, thanks
I thought of some general guidelines in CSS and XHTML, please feel free to add some more if you think i missed, thanks in advance !
No Empty Divs
Use text-indents in hyperlinks for images and images background so that the div does not remain empty
Even if you have a division marker that contains a backgrounds and is embedding another inner-container (or any other reason), use a text-indent:-9999px so that it does not appear empty. This misuse has led to many misinterpretations by search engines
Validate your codes on W3C
Even if there is a warning, there’s always this possibility to wipe it out and write the right piece of code for it.
No Ids! Classes & inheritance
We’re in 2010 now ladies, things have changed and now it’s the new era. Like for me, it was quite a bite that day I got those slaps (uhh… let’s call that e-slaps for the sake of this article) from my boss, who clearly mentioned the important generic methodologies of using inheritance techniques in everything we do… And that included CSS my oh my..
Besides, even if you are using ids, make sure that they are unique and that they are not being duplicated elsewhere on your page. That’s the good thing with the W3C validator: it doesn’t miss those
Comment your lines of codes
There are many advantages for this, the major one I’m considering is to help situate the programmer in line who will be taking your codes elsewhere. It’s a form of diplomacy, hence good practice.
No Styling in your html pages: out!
It’s better to transfer all the related style, with comments alongside on your generic style sheet
Insert Images on web pages only if necessary
Whenever there is an opportunity not to insert an image as an <img src>, do it; the best practice is to load it as a background image and if possible use write any text that’s ever found on the image instead of importing the image from photoshop or any app you’re using down to tyou
Anti-aliasing of gif images for better image quality
I have this luck of having a chief who knows quite a sleek stuffs in photoshop and image rendering techniques and that includes gif images.
Integrators love gifs: light, minimal use of colors.. when they’res no curves in any way, but what about transparency ?
There are possibilities to avoid the use of pngs, which are usually heavier and take quite some time to load. Sometimes when gifs are being exported, codes or designers forget the background image on which the gif will be laid onto. That is why anti-aliasing techniques are very important for keeping the design intact.
use overflow: hidden instead of clear:both
More information can be found on this link:
http://www.quirksmode.org/css/clearing.html
To brief a bit, using clear is like ol’ school teaching stuff which was the fast-driven solution while the overflow:hidden seems to satisfy the major browsers like MSIE, FFx , Chrome, etc…
Minimise the use of style sheets
Avoid using different style sheets for different browsers. Use one generic style sheet, unless you have different themes for different pages, but that depends. All this creates confusion and that might also mean you are not be using the right html codes and the right css styles
To minimise the use of multiple style sheets, use:
i.e. <!–[if IE 6]><div id=”IE6″><![endif]–>
Validate your css codes on http://jigsaw.w3.org
Jigsaw is the CSS passport for integrators. I never knew it, but now O I know !
It’s the haven. The hide in our line of business. It’s what keeps our ego hmmm strong and heavily proud, the reason why integrators are so needed in the web business.
* Squeak *
Always have this final habit to validate your css in the following link
http://jigsaw.w3.org/ to make sure that you are in line with your css standards. Even if there are warnings, that would mean you are wrongly interpreting your css codes or that some styles have been duplicated here and there.
Conclusion
That’s all for now folks. I think , whenever I’ll have some more time, I’d probably create a CSS tips and tricks Part 2, cos amending what’s already there would sound so cheap and it’s not like facebook, uhh Sheran changed that article, etc..
It’s good to have some feedbacks and all, well, that’s probably interesting to know what’s out in the CSS jungle, so jot in some lines, criticise, be blunt and bold and don’t hesitate to contact me (except ma okes at work, you know who you are, ladies) for any info ya need
À La Prochaine !use CSS, it will save you time no matter how much DW does things automatically for you
if you don't know how it's done, ask or view source. css is client side code and can be viewed.
use divs instead of tables for layouts
firefox has a great plugin called HTML Validator (http://users.skynet.be/mgueury/mozilla/). you don't have to keep going to the w3c website to validate. when viewing your page within firefox it will validate it and tell you any errors and warnings. saves me a lot of time. it's also great if you're development environment is behind a firewall - you won't have to view source, copy & paste onto w3c validator. they don't have support for html5 yet
this could be more of style and preference but i use multiple files of css. usually 2 or 3. one is for the layout (layout.css), one is for forms (form.css) and one for display data. anything more can become more work when it's time to make any changes, especially with multiple people working on the same project
create a standard workflow. naming conventions for file names, class names, etc.
i'm not sure you can get away from those IE specific css. i've tried a campaign at work to not support IE so that we become fully compliant with the web but unfortunately, IE still has a lot of users. what we've done is support IE but the latest versions only. M$ is at least getting better with being compatible.
view the page in firefox and IE. if they work, then you should be fine with the other browsers. as a developer, it's my responsibility to ensure that any user whether mac or pc can view the website - as long as they are running the "latest" version of the browser. latest as in what the software developer still supports.
well that's my tips, tricks and a little pet peeve here and there -
HTML and CSS Best Practices for Eloqua?
Hello Topliners Community,
My name is Ben and I am a Web Designer. I am currently looking for any guidance on HTML and CSS best practices when working with Eloqua. I am interested in the best practices for e-mail and landing pages.
Thank you,
BenPersonally I like to upload my custom created html/css into Eloqua instead of using the WYSIWYG.
But if you must then right clicking on text boxes and click edit source is the way to go.
There was a good discussion on editing your forms with CSS:
Energize Your Eloqua10 Forms with CSS
created by Ryan Wheler on Nov 2, 2012 8:44 AM, last modified by Greg Stotler on Sep 19, 2013 2:00 PM
Version 2
CSS can be used to heavily customize the layout of forms in Eloqua10. In this article we will provide sample cover some common formatting use cases on Eloqua10 Landing Pages. Further details about uses of CSS in Eloqua10 form templates can be found here: EE12 - Do It - Eloqua - Energize E10 Forms
Eloqua10 Forms HTML Structure
Below is an outline of the structure of the HTML generated by Eloqua when a form is added to a landing page. By targeting the HTML classes highlighted below, we can control the layout of any form on your landing page.
For the rest of page: http://topliners.eloqua.com/docs/DOC-3015 -
How to clear the form after save?
Hi,
My environment is JSF1.2 and Hibernate3. Scope of my bean is request level. On JSF form where I press the save button, data is saved in the database and form is empty for new record.
I do not want to call method resetMe() because I have many beans with 10-20 fields per bean. I don't want to write such method again and again.
Can you please help me for better solution?
Here is my bean:
package test.bean;
import java.io.Serializable;
import javax.faces.event.ActionEvent;
import test.hib.CountryHome;
public class Country implements Serializable {
private Integer cPk;
private String cName;
private String cDesc;
public Country() {
public Integer getcPk() {
return cPk;
public void setcPk(Integer cPk) {
this.cPk = cPk;
public String getcName() {
return cName;
public void setcName(String cName) {
this.cName = cName;
public String getcDesc() {
return cDesc;
public void setcDesc(String cDesc) {
this.cDesc = cDesc;
public void save(ActionEvent ae) {
CountryHome ch = new CountryHome();
ch.save(this);
this.resetMe();
private void resetMe() {
this.setcPk(null);
this.setcName(null);
this.setcDesc(null);
}My database/hibernate class with save operation:
package test.hib;
import org.hibernate.SessionFactory;
import test.bean.Country;
import test.helper.HibernateUtil;
public class CountryHome {
private SessionFactory sf = HibernateUtil.getSessionFactory();
public void save(Country instance) {
sf.getCurrentSession().beginTransaction();
sf.getCurrentSession().saveOrUpdate(instance);
sf.getCurrentSession().getTransaction().commit();
}My JSF page:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Country Form</title>
</head>
<body>
<f:view>
<h:form>
<h:panelGrid border="1" columns="2">
<h:outputLabel value="Name: "></h:outputLabel>
<h:inputText value="#{country.cName}"></h:inputText>
<h:outputLabel value="Description: "></h:outputLabel>
<h:inputTextarea value="#{country.cDesc}"></h:inputTextarea>
</h:panelGrid>
<h:commandButton value="Save" actionListener="#{country.save}"></h:commandButton>
</h:form>
</f:view>
</body>
</html>What you are doing now will not create a maintenance nightmare in future, if you are doing it in a framework oriented fashion. We have done something similar in one of our biggest project( around 50 developers working 3 years). What we have done is, created a method resetBean() in our abstract backing bean like:
public void resetBean(){
// doing nothing
We didnt make it abstract, so that all backing bean in our project need not implement this method. Those who want to use this method can implement this method to reset the values in the backing bean.
One thing we achieved by doing this is, we dont let each developers do the reset logic in different ways.
One of the advantages of this over the redirect is, you have full control over resetting the form. Which means, sometimes, we may need partial resetting of the form.
Thanks and regards
Rick -
There is too much space after the form:
http://zooop.net/birch_center/
I can control the space by adding a height tag in this tag:
<iframe src="
http://www.birchcenter.com/OpenNewsletter/includethis.php"
frameborder="0" width="170" scrolling=no style="border:0px;
font:Verdana, Arial, Helvetica, sans-serif;
color:#666666"></iframe>
But when users enlarge their text either through their OS or
their browser, the "Subscribe" buttons sinks behind the text after
it, and is not functionlal.
Does anyone know why there is so much space after the form
and how I could get rid of it?
Thanks very much,
Emilie> Does anyone know why there is so much space after the
form and how I could
> get
> rid of it?
Many HTML tags have inherent margins, and <form> is one
of them. Use CSS to
control it -
form { margin:0; padding:0; }
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"zzzeeep" <[email protected]> wrote in
message
news:f0900b$h4f$[email protected]..
> There is too much space after the form:
>
>
http://zooop.net/birch_center/
>
> I can control the space by adding a height tag in this
tag:
>
> <iframe src="
http://www.birchcenter.com/OpenNewsletter/includethis.php"
> frameborder="0" width="170" scrolling=no
style="border:0px; font:Verdana,
> Arial, Helvetica, sans-serif;
color:#666666"></iframe>
>
> But when users enlarge their text either through their
OS or their
> browser,
> the "Subscribe" buttons sinks behind the text after it,
and is not
> functionlal.
>
> Does anyone know why there is so much space after the
form and how I could
> get
> rid of it?
>
> Thanks very much,
> Emilie
> -
I'm working on a site and putting in a google search box,
which is actually a form. My problem is that I've put the form in a
table row that I would like to stay nice and short. However, once
the form is in the row, it acts as if there's a <br> after
it, leaving a space below the form and making the whole row taller.
Is this an html quirk, and is there any way in Dreamweaver to
compensate for it?
The site is still in development, but the page is published
at
http://www.webwomandesign.com/test/cbd
Thanks.LOL - I like your attitude. Or as we say in Philly, your
att-e-tude.
You can come down for dinner....
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Brendan"
<Brendan.Collins@_RemoveThis_Singularity.co.uk> wrote in
message
news:[email protected]...
> Geez sorry Murray! ;-(
>
> Didn't know it would come up as invalid HTML, just know
that it worked for
> me in the past. Thanks for the heads up, will remember
now for the future,
> just as I remembered any time my dad told me off about
something! ;-)
>
> --
> ______________________________________________
> Rate your experiences with your UK and Ireland builders
at
>
http://www.ratethebuilder.co.uk
> =========================================
>
>
> "Murray *ACE*" <[email protected]>
wrote in message
> news:[email protected]...
>> Go to your room! 8)
>>
>> Why recommend invalid HTML to solve an easily solved
problem?
>>
>> Either put the form outside the table altogether,
e.g.,
>>
>> <form>
>> <table></table>
>> </form>
>>
>> or use CSS to manage the form tag's default
top/bottom margins.
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do
so!)
>> ==================
>>
http://www.dreamweavermx-templates.com
- Template Triage!
>>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
>>
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
>> ==================
>>
>>
>> "Brendan"
<Brendan.Collins@_RemoveThis_Singularity.co.uk> wrote in
>> message
>> news:[email protected]...
>> > Wyndy
>> >
>> > Try placing the form tags outside of the
<td> tag or even the <tr> tag.
>> > eg:
>> >
>> > <table>
>> > <tr>
>> > <form>
>> > <td></td>
>> > </form>
>> > </tr>
>> > </table>
>> >
>> > I find that stops the extra space in the table
cell.
>> >
>> > Brendan
>> > ______________________________________________
>> > Rate your experiences with your UK and Ireland
builders at
>> >
http://www.ratethebuilder.co.uk
>> > =========================================
>> >
>> >
>> > "Wyndy" <[email protected]>
wrote in message
>> > news:[email protected]...
>> >> I'm working on a site and putting in a
google search box, which is
>> > actually a
>> >> form. My problem is that I've put the form
in a table row that I would
>> > like to
>> >> stay nice and short. However, once the form
is in the row, it acts as
> if
>> >> there's a <br> after it, leaving a
space below the form and making the
>> > whole
>> >> row taller.
>> >>
>> >> Is this an html quirk, and is there any way
in Dreamweaver to
> compensate
>> > for
>> >> it?
>> >>
>> >> The site is still in development, but the
page is published at
>> >>
http://www.webwomandesign.com/test/cbd
>> >>
>> >> Thanks.
>> >>
>> >
>> >
>>
>>
>
>
Maybe you are looking for
-
SAP Internet Mail Gateway for MS Exchange 2003 Server
Hi, Has anybody successfully configured the IMG to work with MS Exchange 2003? We have our 4.6C currently configured to talk to Exchange 2000 through SXC Note 594428 - SXC: Exchange 2003 Server is not supported Solution R/3 Basis Release 3.1I to 4.6
-
Vendor International Name in DME file
Hello All, I am configuring DME payment file for Taiwanese client who use chinese charecters. Requirement- They need the vendor name to be displayed in chinese language (maintained in international Version in master data) and rest all other payment d
-
Dynamic UIs: Error: Duplicate variable name
Hello Friends I am facing one difficulty in dynamic UIs and i.e. whenever I want to add some more Dynamic UIs to the existing one it throws error like "Duplicate valriable name". I am having my code in wdDoModifyView Whatever I want to show in the st
-
CRM Catalog in webshop : link between product image and replicated image
Hello, I have successfully published a catalog in CRM E-Commerce, but I have to develop other BSPs in order to manage new functionnality. These BSP must keed based upon standard CRM catalog. I am unable to find the link between the product GUID (in t
-
My add-ons still appear to be installed and working, but I can't install more, or uninstall, or configure them.