Combine p:orderList with p:inplace - primefaces

I would like to have a list of entries which I can shift/order and at the same time editable.
So I tought to combine p:orderList with p:inplace this way:
<p:scrollPanel style="width:300px;height:100px" scrollMode="native">
<p:orderList var="title" value="#{detailModel.afterObject.metadata.getTitlesAsList()}" type="definition">
<f:facet name="description">
<p:inplace id="basic" editor="true">
<p:inputText value="#{title.value}" required="true"/>
</p:inplace>
</f:facet>
</p:orderList>
</p:scrollPanel>
but I get the following error:
java.lang.NullPointerException
at org.primefaces.component.orderlist.OrderListRenderer.encodeOptions(OrderListRenderer.java:152)
at org.primefaces.component.orderlist.OrderListRenderer.encodeList(OrderListRenderer.java:108)
at org.primefaces.component.orderlist.OrderListRenderer.encodeMarkup(OrderListRenderer.java:79)
at org.primefaces.component.orderlist.OrderListRenderer.encodeEnd(OrderListRenderer.java:49)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:61)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:45)
at org.primefaces.component.scrollpanel.ScrollPanelRenderer.encodeMarkup(ScrollPanelRenderer.java:51)
at org.primefaces.component.scrollpanel.ScrollPanelRenderer.encodeEnd(ScrollPanelRenderer.java:30)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:619)
Do I miss something or it is not possible doing so?
If I use :dataList instead I don't get the error, but it has a strang behaviour; when I click on an entry, all the entries become editable, but then they remain in the edit-mode and nothing more is possibe...
Any suggestions?
EDIT
Here is the bean:
public class DoiDetailModel extends DetailModel
{
private List< String > selectedTitles;
private List< String > selectedCreators;
private String title;
private String creator;
public DoiDetailModel()
{
super();
}
public List< String > getSelectedTitles()
{
return selectedTitles;
}
public void setSelectedTitles( List< String > selectedTitles )
{
this.selectedTitles = selectedTitles;
}
}

Related

How to pass data from one Managed Bean to another? [duplicate]

This question already has answers here:
Creating master-detail pages for entities, how to link them and which bean scope to choose
(2 answers)
Closed 4 years ago.
I am developing a website using JSF 2.2 and Primefaces 6.1 where I have, initially, 2 pages: A "list" page, where I can show the data to the user, and a "create" page, where I can create new data or edit existing ones.
NOTE: "Cargo" means occupation.
list.xhtml:
...
<h:form>
<p:commandButton value="Cadastrar" styleClass="ui-button-sucesso" action="create.xhtml?faces-redirect=true"/>
</h:form>
...
<h:form>
<p:dataTable value="#{cargoListMB.listaCargo}" var="cargo" rowKey="#{cargo.codigo}" emptyMessage="Nenhum cargo encontrado" filteredValue="#{cargoListMB.listaCargoFiltro}">
<f:facet name="header">Tabela de Cargos</f:facet>
<p:column headerText="Código" sortBy="#{cargo.codigo}" filterBy="#{cargo.codigo}" filterPosition="top">
<h:outputText value="#{cargo.codigo}"/>
</p:column>
<p:column headerText="Nome" sortBy="#{cargo.nome}" filterBy="#{cargo.nome}" filterPosition="top" filterMatchMode="contains">
<h:outputText value="#{cargo.nome}"/>
</p:column>
<p:column headerText="Funcionários" sortBy="#{cargo.funcionariosNesteCargo}"filterBy="#{cargo.funcionariosNesteCargo}" filterPosition="top">
<h:outputText value="#{cargo.funcionariosNesteCargo}"/>
</p:column>
<p:column headerText="Editar">
<p:commandButton icon="fa fa-pencil" title="Editar" styleClass="ui-button-icone-apenas" action="create.xhtml?faces-redirect=true">
<f:param name="objcargo" value="#{cargo.codigo}"/>
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
CargoListMB.java:
#ManagedBean(name = "cargoListMB")
#ViewScoped
public class CargoListMB implements Serializable {
private List<Cargo> listaCargo;
private List<Cargo> listaCargoFiltro;
public List<Cargo> getListaCargo() {
if (listaCargo == null) {
listaCargo = CargoDAO.listarTodos(); //load data from database
}
return listaCargo;
}
public void setListaCargo(List<Cargo> listaCargo) {
this.listaCargo = listaCargo;
}
...
}
create.xhtml:
<h:form>
<f:metadata>
<f:viewParam name="objcargo" value="#{cargoCreateMB.cargo}" converter="cargoConverter"/>
<f:viewAction action="#{cargoCreateMB.inicializar()}"/>
</f:metadata>
<div class="ui-grid ui-grid-responsive">
<div class="ui-grid-row">
<div class="ui-grid-col-6">
<h1 class="if-page-title"><h:outputText value="#{cargoCreateMB.cargo.codigo == 0? 'Cadastro de Cargos' : 'Edição de cargo'}"/></h1>
</div>
<div class="ui-grid-col-6"></div>
</div>
<br/>
<div class="ui-grid-row">
<div class="ui-grid-col-12">
<div class="ui-grid-row">
<div class="ui-grid-col-1">
<p:outputLabel for="nome" value="Nome:"/>
</div>
<div class="ui-grid-col-3">
<p:inputText id="nome" placeholder="nome" value="#{cargoCreateMB.cargo.nome}" required="true""/>
</div>
<div class="ui-grid-col-8">
<p:message for="nome"/>
</div>
</div>
<br/>
<div class="ui-grid-row">
<div class="ui-grid-col-3">
<p:commandButton value="Salvar" actionListener="#{cargoCreateMB.salvar}" update="form" styleClass="ui-button-salvar"/>
</div>
<div class="ui-grid-col-9"></div>
</div>
</div>
</div>
</div>
</h:form>
CargoCreateMB.java
#ManagedBean(name = "cargoCreateMB")
#ViewScoped
public class CargoCreateMB implements Serializable {
private Cargo cargo;
public void salvar() {
try {
ControleCargo.insereCargo(cargo); //saves the 'occupation' on the database
MensagensUtil.mensagemInfo("Atenção", "Cargo inserido com sucesso");
} catch (RuntimeException e) {
MensagensUtil.mensagemInfo("Erro", "Erro ao inserir cargo");
System.out.println("Erro: " + e);
}
}
public void inicializar() {
//QUESTION!! : Due to a JSF page's life cycle, could I put this code on the constructor??
if (this.cargo == null) {
this.limpar();
}
}
private void limpar() {
cargo = new Cargo();
}
public Cargo getCargo() {
return cargo;
}
public void setCargo(Cargo cargo) {
this.cargo = cargo;
}
}
As you can see, I am trying to pass the selected 'occupation' from page list.xhtml to crate.xhtml using <f:param> and <f:viewParam> tags. When I click on button 'Cadastrar' (means 'register'), everything works fine (the "cargo" object is initially null, as expected), but when I click on the edit button, the "cargo.codigo" (occupation's ID) value, sent by the <f:param> tag, does not "arrive" to the "cargo" object. The converter ('cargoConverter') should be working fine, BUT, when I checked the String value that the method getAsObject was receiving, it was ALWAYS "0", no matter which occupation I choose on my list.
I also tried to send the "raw" data: Instead of using a converter, I sent the "cargo.codigo" value directly to a String field, but it was ALWAYS null.
Could someone help me discover what was my mistake? Also, if it is possible, is there another way to send data to other Managed Beans? Thanks in advance.
Edit: Based on Kukeltje's comments, I formatted my code (which can be seen above) and removed all the nested <h:form> elements BUT the problem still persists. Therefore, the answers on question How to use <h:form> in JSF page? didn't help at all and this question is not a duplicate.
Based on Kukeltje's comments and tips and the answers on this question, I managed to find my mistake: my <f:metadata> was indeed inside a <h:form>
tag. I removed it from there and it worked perfectly.

Primefaces 5.2, when menuitem should be evaluated/executed?

I am using JSF 2.2 with Primefaces 5.2 to implement my JSF project. I'm trying put a linkage with menuitem by using outcome to access my backing bean controller in my main.xhtml such as:
<h:form prependId="false" id="headerForm">
......
<p:menubar >
<p:submenu label="#{apps['application.staff.myinfo']}" icon="ui-icon-document">
<p:menuitem value="#{apps['application.staff.myinfo']}" immediate="true" outcome="#{staffControlBean.viewStaff()}" process="#form" update="#all" icon="fa fa-fw fa-leaf"
disabled="#{empty loginControlBean.staffSession.username}"/>
<p:separator />
<p:menuitem value="Quit" url="#" />
</p:submenu>
</p:menubar>
......
</h:form>
My backing bean as:
#Named(value = "staffControlBean")
#SessionScoped
public class StaffControlBean implements Serializable{
private static final String STAFF_VIEW="/staff/staffView.xhtml";
......
public String viewStaff(){
logger.info("View staff from menuitem clicked.");
if(loginControlBean.getStaffSession().isChangePassword()){
logger.info("password has to be changed before use this services.");
loginControlBean.fireChangePasswordDialog();
return "";
}else {
return STAFF_VIEW;
}
}
......
}
From above snippet you will see, I expect when I click the menuitem from the menubar, backing end controller method viewStaff will be invoked to return a change password dialog or return to my staff view.
But unfortunately, every time when I access (or refresh) main.xhtml without click any menuitem from menubar, the backing bean method was evaluated/executed twice. This is what I found from my server log:
......
####<Nov 10, 2016 2:02:29 PM AEDT> <Info> <com.longz.ozssc.web.staff.StaffControlBean> <macmini16g.tweedheadstorage.com.au> <OzsscWEBServer> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <bc92beef-9f93-4923-a503-9a9cee37010d-00000071> <1478746949108> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-000000> <View staff from menuitem clicked.>
####<Nov 10, 2016 2:02:29 PM AEDT> <Info> <com.longz.ozssc.web.staff.StaffControlBean> <macmini16g.tweedheadstorage.com.au> <OzsscWEBServer> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <bc92beef-9f93-4923-a503-9a9cee37010d-00000071> <1478746949109> <[severity-value: 64] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-000000> <View staff from menuitem clicked.>
......
My question is: When the linkage or buttons in the JSF will be evaluated or executed? Why it always been evaluated or executed when the page was loaded or refreshed. How I can avoid it happen?
Any advice are welcome and appreciated.

Getting NPE while redirecting to the same JSP page after submitting a form

After submitting a form on the profile page it goes to the controller where it then updates a database to then redirect back to the same page that the form was on. However i get an error trying to return to the same page. I can however redirect to another page without any issues?
Any help would be great.
The Form
<form action="controller" method="post">
Link Name:<br>
<input type="text" name="createLinkName">
<br>
Link Content:<br>
<input type="text" name="createLinkContent">
<br>
<input type="hidden" name="command" value="createLink" />
<input type="submit" value="Submit">
</form>
Catching The Form Request
else if (command.equals("createLink"))
{
String linkName = request.getParameter("createLinkName");
String linkContent = request.getParameter("createLinkContent");
User sessionU = new User();
sessionU = (User)request.getSession().getAttribute("user");
int userID = sessionU.getId();
System.out.println(userID);
createLink(request, response, linkName, linkContent, userID);
}
createLink()
protected void createLink(HttpServletRequest request, HttpServletResponse response, String name, String content, int userID) throws IOException, ServletException
{
profileHandler ph = new profileHandler();
ph.createLink(request, response, name, content, userID);
request.getRequestDispatcher("profilePage.jsp").forward(request, response);
}
Handler that deals with the sql
public class profileHandler {
private final DatabaseManager dbMgr;
public profileHandler()
{
this.dbMgr = new DatabaseManager();
}
public void createLink(HttpServletRequest request, HttpServletResponse response, String name, String content, int userID)
{
dbMgr.establishConnection();
String CREATE_LINK = "INSERT INTO linkedaccounts (linkname, linkaddress, userid) VALUES ('" + name + "', '" + content + "', " + userID + ")";
dbMgr.prepareStatement(CREATE_LINK);
dbMgr.executePreparedStatement();
dbMgr.releaseConnection();
}
There isn't a problem with the sql as it is updated the Database just fine. Just wont allow me to eith stay on the same page as the form or just redirect back to it!
Thanks Again.
edit-
ERROR LOG:
Warning: StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.profilePage_jsp._jspService(profilePage_jsp.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)

How to disable <p:tab>

I want to disable <p:tab> using <p:commandButton>
File.xhtml
<h:form id="tabUserModule">
<p:tabView value="#{listModule.toArray()}" var="car" id="tabView1" widgetVar="delg1">
<p:tab title="#{car[0].module}" id="styleChoix" disabled="#{disableTag.disableTa}" >
<p:tabView orientation="left" >
<p:tab title=" Prototype " >
<h:panelGrid >
<p:commandButton value="Disable" oncomplete="delg1.select(0)"
action="#{disableTag.buttonAction}" update=":tabUserModule:tabView1:styleChoix"/>
.....
Bean.java
#ManagedBean
#ViewScoped
public class DisableTag implements Serializable {
private static final long serialVersionUID = 7179479455651980518L;
private boolean disableTa=false;
public boolean isDisableTa() {
return disableTa;
}
public void setDisableTa(boolean disableTa) {
this.disableTa = disableTa;
}
public void buttonAction()
{
disableTa = true;
}
}
But when i execute this code all tab are disabled so how can i solve this issue plz?
i want to disable tab surrounded by orange
You should change your update attribute to
update=":tabUserModule:tabView1"
only instead of your original ":tabUserModule:tabView1:styleChoix"
This means you have to update the whole p:tabView element instead of a specific tab only. Because upon inspection of the rendered html, this is a disabled="false" of your tab having the <div> as the <p:tabView> and the <li> and <a> combination as your individual <p:tab>:
<div id="tabUserModule:tabView1" ...>
<li class="ui-state-default ui-corner-top" ...>
....
</li>
</div>
but with disabled="true" it is rendered as:
<div id="tabUserModule:tabView1" ...>
<li class="ui-state-default ui-tabs-selected ui-state-active ui-corner-top ui-state-disabled" ...>
....
</li>
</div>
Notice the addition of the ui-state-disabled in the class attribute of the <li> tag which causes it to be disabled.
Hope this helps.

Salesforce Visual force pages

My object is Consumer:
Here is a Consumer object has a following fields and want to create a record. But the null pointer exception is reported.
Visualforce page:
<apex:page controller="signup1" >
<apex:form >
<h1>User SignUp</h1>
<apex:panelGrid columns="2" style="margin-top:2em;">
<p><b>Name :</b><br />
<apex:inputField id="name" value="{!con.Name}"/>
</p>
<p><b>Address :</b><br />
<apex:inputField id="address" value="{!con.address__c}"/>
</p>
<p><b>Email Id :</b><br />
<apex:inputField required="true" id="emailid" value="{!con.email_id__c}"/>
</p>
<p><b>Password :</b><br />
<apex:inputSecret id="password" value="{!con.password__c}"/>
</p>
<p><b>Confirm Password :</b><br />
<apex:inputSecret id="confirmpassword" value="{!con.Confirm_Password__c}"/>
</p>
<p><b>Security Question :</b><br />
<apex:inputField required="true" id="securityquestion" value="{!con.Security_Question__c}"/>
</p>
<p><b>Answer :</b><br />
<apex:inputField required="true" id="answer" value="{!con.Answer__c}" />
</p>
<p><b>Ph No :</b><br />
<apex:inputField required="true" id="phno" value="{!con.phone__c}"/>
</p>
<p><b>Pan Card No :</b><br />
<apex:inputField required="true" id="pancardno" value="{!con.Pan_Card_No__c}"/>
</p>
<p> <apex:commandButton action="{!registerUser}" value="SignUp" id="SignUp"/></p>
</apex:panelGrid>
</apex:form>
</apex:page>
controller :
public class signup1
{
Consumer__c con = new Consumer__c();
public void signup1()
{
con = [SELECT Name, address__c, email_id__c, password__c, Confirm_Password__c, Security_Question__c, Answer__c, phone__c from Consumer__c where Name =: ApexPages.currentPage().getParameters().get('Name')];
}
public Consumer__c getcon()
{
return con;
}
public PageReference registerUser()
{
try
{
insert Con;
}
catch(System.DMLException e)
{
ApexPages.addMessages(e);
return null;
}
PageReference pageRef = new PageReference(ApexPages.currentPage().getUrl());
pageRef.setRedirect(true);
return pageRef;
}
}
I cannot insert data into the Consumer object due to the null exception.
This coding the entirely wrong.
1. What is the purpose of the fetching the fields Name, address__c, email_id__c, password__c, Confirm_Password__c, Security_Question__c, Answer__c and phone__c from customer object, as those input fields only.
2. why don't you have Standard Controller on Customer object.
3. If you are fetching values based on name, you need to put search button next to name field and fetch values.
regards,
PK
Consumer is not accessible in your Visual Force page as there is no getter or setter method for it.
public class signup1
{
public Consumer__c con {get; set;}
public signup1()
{
try
{
// Make sure 'ApexPages.currentPage().getParameters().get('Name')' is indeed not null.
con = [SELECT Name, address__c, email_id__c, password__c, Confirm_Password__c, Security_Question__c, Answer__c, phone__c from Consumer__c where Name =: ApexPages.currentPage().getParameters().get('Name')];
}
catch(Exception ex)
{
system.debug(ex.getMessage());
}
}
..............
}
You are not setting the values retrieved from the VF page into any parameter in the controller. First set them. Then create a object of type Consumer and then assign these values from VF page into the fields from the object. Only then you will be able to insert con.