Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

6.4 newly created page is not saving

Sumanth-Narra
Level 2
Level 2

I'm creating a new project in AEM 6.4, got an instance from solution partner and building a basic component to read the sling model fields and converts the charters into upperCase.

I think there is no problem with the model, now I have created a page with using an existing template and author a new component on to page. when I build for the second time the page is showing 404 error and it's getting deleted from site admin.

Thanks

Sumanth

5 Replies
smacdonald2008
Level 10
Level 10

Can you describe what you mean by saying when you build for a second time? Do you mean, when you drop a second component onto the page? Or do you mean, if you create a 2nd page with the same page template? 

A simple SLing Model component that injects a textfield into the model via @Inject annotation, then performs an uppercase operation on the string using Java, and displays the results in the component UI will not break an AEM page.

Sumanth-Narra
Level 2
Level 2

building second time means, I have some small changes in the model. then the page is disappearing in site admin. 

component.html

/*

<sly data-sly-test.nameExists="${properties.text1}"> formated text is ${properties.text1}</sly>

<sly data-sly-use.link="org.practice.aem.core.models.LinkModel">
  <pre> name comes from link field ${link.formatText}</pre>
</sly>

<sly data-sly-test="${!nameExists}">
  <pre>Please enter the name </pre>
</sly>

*/

model

/*

@Model(adaptables = Resource.class)

public class LinkModel {

   @Inject @Optional
   private String text1;


  private String formatText;

   @PostConstruct
   protected void init() {

   if(text1 != null){

   this.formatText = Character.toUpperCase(this.text1.charAt(0)) + this.text1.substring(1);
   }

  }

   public String getFormatText() {

   return formatText;
   }

}

*/

smacdonald2008
Level 10
Level 10

Typically making a change to a component's Java logic does not result in a page disappearing.

If you make the change in Java - run:

mvn clean install

and then redeploy the OSGi bundle manually. The Java code will be updated and the Apps will not be overriden in the JCR.

Gaurav-Behl
Community Advisor
Community Advisor

when does the page disappears? At the time of package installation? If yes, then check if you have "replace' specified for that content path in filter.xml of package?

Could you share relevant logs?

Himanshu_Singhal
Community Advisor
Community Advisor

You might have created a new project and every time you must be making full build. Since, the project created from AEM plugin contains sample content as well, during build, it overrides the content as well. That's the reason after build your content disappears.
Either make the partial build or remove "ui.content" module from project and everything shall work fine.

Best regards,
Himanshu Singhal